evt-message_store 1.2.0.0 → 2.3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/message_store/controls/category.rb +3 -1
- data/lib/message_store/get/substitute.rb +1 -0
- data/lib/message_store/stream_name.rb +44 -28
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 156de8cf748968c091d28df2d2ce7b9c25d0a996ada4d6f473a1a31667bee851
|
4
|
+
data.tar.gz: 81aab6e0f701fdf1c9c9263c0548b6f8f22d8b75241b3720af314e2cc47b211d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83be616f3481e506586e349480ff6cbb2e53d369aae02eb1de2c312d3c94e04c8a455652a4581a08ba57fb15cc8a7765043ac42a334aaf13a1ca48931865ce61
|
7
|
+
data.tar.gz: 6df8f35fae0c431eaa6fa79716eb254953e39593f7b76ebea2c1310ed928c0c65974bb072b902a608d23404d30bd771afd5b8fe1511660a5ab3778f97a894c25
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module MessageStore
|
2
2
|
module Controls
|
3
3
|
module Category
|
4
|
-
def self.example(category: nil, randomize_category: nil)
|
4
|
+
def self.example(category: nil, type: nil, types: nil, randomize_category: nil)
|
5
5
|
if randomize_category.nil?
|
6
6
|
if !category.nil?
|
7
7
|
randomize_category = false
|
@@ -16,6 +16,8 @@ module MessageStore
|
|
16
16
|
category = "#{category}#{SecureRandom.hex(16)}XX"
|
17
17
|
end
|
18
18
|
|
19
|
+
category = Controls::StreamName.stream_name(category, type: type, types: types)
|
20
|
+
|
19
21
|
category
|
20
22
|
end
|
21
23
|
end
|
@@ -2,49 +2,57 @@ module MessageStore
|
|
2
2
|
module StreamName
|
3
3
|
Error = Class.new(RuntimeError)
|
4
4
|
|
5
|
-
def self.
|
5
|
+
def self.id_separator
|
6
6
|
'-'
|
7
7
|
end
|
8
8
|
|
9
|
-
def self.
|
10
|
-
'
|
9
|
+
def self.compound_id_separator
|
10
|
+
'+'
|
11
11
|
end
|
12
12
|
|
13
|
-
def self.
|
14
|
-
'
|
13
|
+
def self.category_type_separator
|
14
|
+
':'
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
def self.compound_type_separator
|
18
|
+
'+'
|
19
19
|
end
|
20
20
|
|
21
|
-
def self.stream_name(
|
22
|
-
if
|
23
|
-
raise Error, "Category
|
21
|
+
def self.stream_name(category, stream_id=nil, cardinal_id: nil, id: nil, ids: nil, type: nil, types: nil)
|
22
|
+
if category == nil
|
23
|
+
raise Error, "Category must not be omitted from stream name"
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
types.unshift(type) unless type.nil?
|
26
|
+
stream_name = category
|
28
27
|
|
29
|
-
type_list =
|
30
|
-
type_list
|
28
|
+
type_list = []
|
29
|
+
type_list.concat(Array(type))
|
30
|
+
type_list.concat(Array(types))
|
31
31
|
|
32
|
-
|
33
|
-
stream_name = "#{stream_name}#{category_delimiter}#{type_list}" unless type_list.nil?
|
32
|
+
type_part = type_list.join(compound_type_separator)
|
34
33
|
|
35
|
-
if not
|
36
|
-
|
37
|
-
id = id.join(compound_id_delimiter)
|
38
|
-
end
|
34
|
+
if not type_part.empty?
|
35
|
+
stream_name = "#{stream_name}#{category_type_separator}#{type_part}"
|
39
36
|
end
|
40
37
|
|
41
|
-
|
38
|
+
id_list = []
|
39
|
+
id_list << cardinal_id if not cardinal_id.nil?
|
40
|
+
|
41
|
+
id_list.concat(Array(stream_id))
|
42
|
+
id_list.concat(Array(id))
|
43
|
+
id_list.concat(Array(ids))
|
44
|
+
|
45
|
+
id_part = id_list.join(compound_id_separator)
|
46
|
+
|
47
|
+
if not id_part.empty?
|
48
|
+
stream_name = "#{stream_name}#{id_separator}#{id_part}"
|
49
|
+
end
|
42
50
|
|
43
51
|
stream_name
|
44
52
|
end
|
45
53
|
|
46
54
|
def self.split(stream_name)
|
47
|
-
stream_name.split(
|
55
|
+
stream_name.split(id_separator, 2)
|
48
56
|
end
|
49
57
|
|
50
58
|
def self.get_id(stream_name)
|
@@ -56,7 +64,15 @@ module MessageStore
|
|
56
64
|
|
57
65
|
return [] if ids.nil?
|
58
66
|
|
59
|
-
ids.split(
|
67
|
+
ids.split(compound_id_separator)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.get_cardinal_id(stream_name)
|
71
|
+
id = get_id(stream_name)
|
72
|
+
|
73
|
+
return nil if id.nil?
|
74
|
+
|
75
|
+
id.split(compound_id_separator).first
|
60
76
|
end
|
61
77
|
|
62
78
|
def self.get_category(stream_name)
|
@@ -64,15 +80,15 @@ module MessageStore
|
|
64
80
|
end
|
65
81
|
|
66
82
|
def self.category?(stream_name)
|
67
|
-
!stream_name.include?(
|
83
|
+
!stream_name.include?(id_separator)
|
68
84
|
end
|
69
85
|
|
70
86
|
def self.get_category_type(stream_name)
|
71
|
-
return nil unless stream_name.include?(
|
87
|
+
return nil unless stream_name.include?(category_type_separator)
|
72
88
|
|
73
89
|
category = get_category(stream_name)
|
74
90
|
|
75
|
-
category.split(
|
91
|
+
category.split(category_type_separator)[1]
|
76
92
|
end
|
77
93
|
|
78
94
|
def self.get_type(*args)
|
@@ -84,7 +100,7 @@ module MessageStore
|
|
84
100
|
|
85
101
|
return [] if type_list.nil?
|
86
102
|
|
87
|
-
type_list.split(
|
103
|
+
type_list.split(compound_type_separator)
|
88
104
|
end
|
89
105
|
|
90
106
|
def self.get_types(*args)
|
@@ -92,7 +108,7 @@ module MessageStore
|
|
92
108
|
end
|
93
109
|
|
94
110
|
def self.get_entity_name(stream_name)
|
95
|
-
get_category(stream_name).split(
|
111
|
+
get_category(stream_name).split(category_type_separator)[0]
|
96
112
|
end
|
97
113
|
end
|
98
114
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evt-message_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Eventide Project
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-casing
|