evt-message_store 1.1.0.0 → 2.3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/message_store/controls.rb +1 -0
- data/lib/message_store/controls/category.rb +3 -1
- data/lib/message_store/controls/time.rb +22 -20
- data/lib/message_store/get/substitute.rb +1 -0
- data/lib/message_store/read.rb +1 -0
- data/lib/message_store/stream_name.rb +65 -22
- metadata +3 -5
- data/lib/message_store/postgres +0 -1
- data/lib/message_store/postgres.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10704ac2544b2ef44429b0e55c4c44ccc78fe460c141b1927997b00d7d2dea75
|
4
|
+
data.tar.gz: b217d7aa1b18943f71cfb8c450c3820da418ec6c465acfe23c02cf948563a925
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a898788cd605db367f529f2f750899b40cf164908ee8297c0e3e3e092c246953704a2021be8a25c5b9ace959b14a82536184f641228b6845cb7a49ee3ba2730c
|
7
|
+
data.tar.gz: 0272bc2fe2995e8448ccaee0e452037782a03581c0b77844233d27eaec2614971c2625959409c68b273a2027df7609a683ffb52ab21e179b41e075f0ed8203d0
|
@@ -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
|
@@ -8,52 +8,54 @@ module MessageStore
|
|
8
8
|
|
9
9
|
module Raw
|
10
10
|
def self.example
|
11
|
-
|
12
|
-
Clock::UTC.now(time)
|
11
|
+
Clock::Controls::Time::Raw.example
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
15
|
module ISO8601
|
17
16
|
def self.example(time=nil)
|
18
|
-
|
19
|
-
|
17
|
+
Clock::Controls::Time::ISO8601.example(time)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.precision
|
21
|
+
3
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
23
25
|
module Processed
|
24
26
|
def self.example(time=nil, offset_milliseconds: nil)
|
25
|
-
|
26
|
-
|
27
|
-
ISO8601.example(time)
|
27
|
+
offset_milliseconds ||= self.offset_milliseconds
|
28
|
+
Clock::Controls::Time::Offset.example(offset_milliseconds, time: time, precision: ISO8601.precision)
|
28
29
|
end
|
29
30
|
|
30
31
|
module Raw
|
31
32
|
def self.example(time=nil, offset_milliseconds: nil)
|
32
|
-
|
33
|
-
offset_milliseconds
|
34
|
-
offset = Rational(offset_milliseconds, 1000)
|
35
|
-
time += offset
|
36
|
-
time
|
33
|
+
offset_milliseconds ||= Processed.offset_milliseconds
|
34
|
+
Clock::Controls::Time::Offset::Raw.example(offset_milliseconds, time: time, precision: ISO8601.precision)
|
37
35
|
end
|
38
36
|
end
|
37
|
+
|
38
|
+
def self.offset_milliseconds
|
39
|
+
11
|
40
|
+
end
|
39
41
|
end
|
40
42
|
|
41
43
|
module Effective
|
42
44
|
def self.example(time=nil, offset_milliseconds: nil)
|
43
|
-
|
44
|
-
|
45
|
-
ISO8601.example(time)
|
45
|
+
offset_milliseconds ||= self.offset_milliseconds
|
46
|
+
Clock::Controls::Time::Offset.example(offset_milliseconds, time: time, precision: ISO8601.precision)
|
46
47
|
end
|
47
48
|
|
48
49
|
module Raw
|
49
50
|
def self.example(time=nil, offset_milliseconds: nil)
|
50
|
-
|
51
|
-
offset_milliseconds
|
52
|
-
offset = Rational(offset_milliseconds, 1000)
|
53
|
-
time += offset
|
54
|
-
time
|
51
|
+
offset_milliseconds ||= Effective.offset_milliseconds
|
52
|
+
Clock::Controls::Time::Offset::Raw.example(offset_milliseconds, time: time, precision: ISO8601.precision)
|
55
53
|
end
|
56
54
|
end
|
55
|
+
|
56
|
+
def self.offset_milliseconds
|
57
|
+
1
|
58
|
+
end
|
57
59
|
end
|
58
60
|
end
|
59
61
|
end
|
data/lib/message_store/read.rb
CHANGED
@@ -2,70 +2,113 @@ 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.
|
9
|
+
def self.compound_id_separator
|
10
|
+
'+'
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.category_type_separator
|
10
14
|
':'
|
11
15
|
end
|
12
16
|
|
13
|
-
def self.
|
17
|
+
def self.compound_type_separator
|
14
18
|
'+'
|
15
19
|
end
|
16
20
|
|
17
|
-
def self.stream_name(
|
18
|
-
if
|
19
|
-
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"
|
20
24
|
end
|
21
25
|
|
22
|
-
|
23
|
-
types.unshift(type) unless type.nil?
|
26
|
+
stream_name = category
|
24
27
|
|
25
|
-
type_list =
|
26
|
-
type_list
|
28
|
+
type_list = []
|
29
|
+
type_list.concat(Array(type))
|
30
|
+
type_list.concat(Array(types))
|
31
|
+
|
32
|
+
type_part = type_list.join(compound_type_separator)
|
33
|
+
|
34
|
+
if not type_part.empty?
|
35
|
+
stream_name = "#{stream_name}#{category_type_separator}#{type_part}"
|
36
|
+
end
|
27
37
|
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
31
50
|
|
32
51
|
stream_name
|
33
52
|
end
|
34
53
|
|
35
54
|
def self.split(stream_name)
|
36
|
-
stream_name.split(
|
55
|
+
stream_name.split(id_separator, 2)
|
37
56
|
end
|
38
57
|
|
39
58
|
def self.get_id(stream_name)
|
40
59
|
split(stream_name)[1]
|
41
60
|
end
|
42
61
|
|
62
|
+
def self.get_ids(stream_name)
|
63
|
+
ids = get_id(stream_name)
|
64
|
+
|
65
|
+
return [] if ids.nil?
|
66
|
+
|
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
|
76
|
+
end
|
77
|
+
|
43
78
|
def self.get_category(stream_name)
|
44
79
|
split(stream_name)[0]
|
45
80
|
end
|
46
81
|
|
47
82
|
def self.category?(stream_name)
|
48
|
-
!stream_name.include?(
|
83
|
+
!stream_name.include?(id_separator)
|
49
84
|
end
|
50
85
|
|
51
|
-
def self.
|
52
|
-
return nil unless stream_name.include?(
|
86
|
+
def self.get_category_type(stream_name)
|
87
|
+
return nil unless stream_name.include?(category_type_separator)
|
53
88
|
|
54
89
|
category = get_category(stream_name)
|
55
90
|
|
56
|
-
category.split(
|
91
|
+
category.split(category_type_separator)[1]
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.get_type(*args)
|
95
|
+
get_category_type(*args)
|
57
96
|
end
|
58
97
|
|
59
|
-
def self.
|
60
|
-
type_list =
|
98
|
+
def self.get_category_types(stream_name)
|
99
|
+
type_list = get_type(stream_name)
|
61
100
|
|
62
101
|
return [] if type_list.nil?
|
63
102
|
|
64
|
-
type_list.split(
|
103
|
+
type_list.split(compound_type_separator)
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.get_types(*args)
|
107
|
+
get_category_types(*args)
|
65
108
|
end
|
66
109
|
|
67
110
|
def self.get_entity_name(stream_name)
|
68
|
-
get_category(stream_name).split(
|
111
|
+
get_category(stream_name).split(category_type_separator)[0]
|
69
112
|
end
|
70
113
|
end
|
71
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.2
|
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:
|
11
|
+
date: 2020-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-casing
|
@@ -155,8 +155,6 @@ files:
|
|
155
155
|
- lib/message_store/message_data/read.rb
|
156
156
|
- lib/message_store/message_data/write.rb
|
157
157
|
- lib/message_store/no_stream.rb
|
158
|
-
- lib/message_store/postgres
|
159
|
-
- lib/message_store/postgres.rb
|
160
158
|
- lib/message_store/read.rb
|
161
159
|
- lib/message_store/read/iterator.rb
|
162
160
|
- lib/message_store/stream_name.rb
|
@@ -180,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
178
|
- !ruby/object:Gem::Version
|
181
179
|
version: '0'
|
182
180
|
requirements: []
|
183
|
-
rubygems_version: 3.
|
181
|
+
rubygems_version: 3.1.2
|
184
182
|
signing_key:
|
185
183
|
specification_version: 4
|
186
184
|
summary: Common primitives for platform-specific message store implementations
|
data/lib/message_store/postgres
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
lib/message_store/Users/sbellware/projects/eventide/message-store-postgres/lib/message_store/postgre
|
@@ -1 +0,0 @@
|
|
1
|
-
lib/message_store/Users/sbellware/projects/eventide/message-store-postgres/lib/message_store/postgre
|