ruby_event_store 2.18.0 → 2.19.0
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/ruby_event_store/client.rb +22 -12
- data/lib/ruby_event_store/dispatcher.rb +6 -14
- data/lib/ruby_event_store/event.rb +5 -5
- data/lib/ruby_event_store/immediate_async_dispatcher.rb +6 -10
- data/lib/ruby_event_store/immediate_dispatcher.rb +17 -0
- data/lib/ruby_event_store/in_memory_repository.rb +13 -7
- data/lib/ruby_event_store/instrumented_broker.rb +52 -20
- data/lib/ruby_event_store/instrumented_dispatcher.rb +22 -2
- data/lib/ruby_event_store/instrumented_repository.rb +47 -15
- data/lib/ruby_event_store/mappers/default.rb +14 -6
- data/lib/ruby_event_store/mappers/instrumented_batch_mapper.rb +26 -4
- data/lib/ruby_event_store/mappers/instrumented_mapper.rb +41 -4
- data/lib/ruby_event_store/mappers/null_mapper.rb +4 -0
- data/lib/ruby_event_store/mappers/transformation/event_class_remapper.rb +4 -0
- data/lib/ruby_event_store/projection.rb +87 -55
- data/lib/ruby_event_store/specification.rb +47 -31
- data/lib/ruby_event_store/specification_result.rb +23 -23
- data/lib/ruby_event_store/sync_scheduler.rb +31 -0
- data/lib/ruby_event_store/version.rb +1 -1
- data/lib/ruby_event_store.rb +2 -0
- metadata +4 -2
|
@@ -54,7 +54,7 @@ module RubyEventStore
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
# Limited results. True if number of read elements are limited
|
|
57
|
-
# {
|
|
57
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
58
58
|
#
|
|
59
59
|
# @return [Boolean]
|
|
60
60
|
def limit?
|
|
@@ -62,7 +62,7 @@ module RubyEventStore
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
# Results limit or infinity if limit not defined
|
|
65
|
-
# {
|
|
65
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
66
66
|
#
|
|
67
67
|
# @return [Integer|Infinity]
|
|
68
68
|
def limit
|
|
@@ -70,7 +70,7 @@ module RubyEventStore
|
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
# Stream definition. Stream to be read or nil
|
|
73
|
-
# {
|
|
73
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
74
74
|
#
|
|
75
75
|
# @return [Stream|nil]
|
|
76
76
|
def stream
|
|
@@ -78,7 +78,7 @@ module RubyEventStore
|
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
# Starting position. Event id of starting event
|
|
81
|
-
# {
|
|
81
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
82
82
|
#
|
|
83
83
|
# @return [String]
|
|
84
84
|
def start
|
|
@@ -86,7 +86,7 @@ module RubyEventStore
|
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
# Stop position. Event id of stopping event
|
|
89
|
-
# {
|
|
89
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
90
90
|
#
|
|
91
91
|
# @return [String|Symbol]
|
|
92
92
|
def stop
|
|
@@ -94,7 +94,7 @@ module RubyEventStore
|
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
# Ending time.
|
|
97
|
-
# {
|
|
97
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
98
98
|
#
|
|
99
99
|
# @return [Time]
|
|
100
100
|
def older_than
|
|
@@ -102,7 +102,7 @@ module RubyEventStore
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
# Ending time.
|
|
105
|
-
# {
|
|
105
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
106
106
|
#
|
|
107
107
|
# @return [Time]
|
|
108
108
|
def older_than_or_equal
|
|
@@ -110,7 +110,7 @@ module RubyEventStore
|
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
# Starting time.
|
|
113
|
-
# {
|
|
113
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
114
114
|
#
|
|
115
115
|
# @return [Time]
|
|
116
116
|
def newer_than
|
|
@@ -118,7 +118,7 @@ module RubyEventStore
|
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
# Starting time.
|
|
121
|
-
# {
|
|
121
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
122
122
|
#
|
|
123
123
|
# @return [Time]
|
|
124
124
|
def newer_than_or_equal
|
|
@@ -126,7 +126,7 @@ module RubyEventStore
|
|
|
126
126
|
end
|
|
127
127
|
|
|
128
128
|
# Time sorting strategy. Nil when not specified.
|
|
129
|
-
# {
|
|
129
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
130
130
|
#
|
|
131
131
|
# @return [Symbol]
|
|
132
132
|
def time_sort_by
|
|
@@ -134,7 +134,7 @@ module RubyEventStore
|
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
# Read direction. True is reading forward
|
|
137
|
-
# {
|
|
137
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
138
138
|
#
|
|
139
139
|
# @return [Boolean]
|
|
140
140
|
def forward?
|
|
@@ -142,7 +142,7 @@ module RubyEventStore
|
|
|
142
142
|
end
|
|
143
143
|
|
|
144
144
|
# Read direction. True is reading backward
|
|
145
|
-
# {
|
|
145
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
146
146
|
#
|
|
147
147
|
# @return [Boolean]
|
|
148
148
|
def backward?
|
|
@@ -150,7 +150,7 @@ module RubyEventStore
|
|
|
150
150
|
end
|
|
151
151
|
|
|
152
152
|
# Size of batch to read (only for :batch read strategy)
|
|
153
|
-
# {
|
|
153
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
154
154
|
#
|
|
155
155
|
# @return [Integer]
|
|
156
156
|
def batch_size
|
|
@@ -158,7 +158,7 @@ module RubyEventStore
|
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
# Ids of specified event to be read (if any given)
|
|
161
|
-
# {
|
|
161
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
162
162
|
#
|
|
163
163
|
# @return [Array|nil]
|
|
164
164
|
def with_ids
|
|
@@ -166,7 +166,7 @@ module RubyEventStore
|
|
|
166
166
|
end
|
|
167
167
|
|
|
168
168
|
# Read by specified ids. True if event ids have been specified.
|
|
169
|
-
# {
|
|
169
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
170
170
|
#
|
|
171
171
|
# @return [Boolean]
|
|
172
172
|
def with_ids?
|
|
@@ -174,7 +174,7 @@ module RubyEventStore
|
|
|
174
174
|
end
|
|
175
175
|
|
|
176
176
|
# Event types to be read (if any given)
|
|
177
|
-
# {
|
|
177
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
178
178
|
#
|
|
179
179
|
# @return [Array|nil]
|
|
180
180
|
def with_types
|
|
@@ -182,7 +182,7 @@ module RubyEventStore
|
|
|
182
182
|
end
|
|
183
183
|
|
|
184
184
|
# Read by specified event types. True if event types have been specified.
|
|
185
|
-
# {
|
|
185
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
186
186
|
#
|
|
187
187
|
# @return [Boolean]
|
|
188
188
|
def with_types?
|
|
@@ -190,7 +190,7 @@ module RubyEventStore
|
|
|
190
190
|
end
|
|
191
191
|
|
|
192
192
|
# Read strategy. True if items will be read in batches
|
|
193
|
-
# {
|
|
193
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
194
194
|
#
|
|
195
195
|
# @return [Boolean]
|
|
196
196
|
def batched?
|
|
@@ -198,7 +198,7 @@ module RubyEventStore
|
|
|
198
198
|
end
|
|
199
199
|
|
|
200
200
|
# Read strategy. True if first item will be read
|
|
201
|
-
# {
|
|
201
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
202
202
|
#
|
|
203
203
|
# @return [Boolean]
|
|
204
204
|
def first?
|
|
@@ -206,7 +206,7 @@ module RubyEventStore
|
|
|
206
206
|
end
|
|
207
207
|
|
|
208
208
|
# Read strategy. True if last item will be read
|
|
209
|
-
# {
|
|
209
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
210
210
|
#
|
|
211
211
|
# @return [Boolean]
|
|
212
212
|
def last?
|
|
@@ -214,7 +214,7 @@ module RubyEventStore
|
|
|
214
214
|
end
|
|
215
215
|
|
|
216
216
|
# Read strategy. True if all items will be read
|
|
217
|
-
# {
|
|
217
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
218
218
|
#
|
|
219
219
|
# @return [Boolean]
|
|
220
220
|
def all?
|
|
@@ -222,7 +222,7 @@ module RubyEventStore
|
|
|
222
222
|
end
|
|
223
223
|
|
|
224
224
|
# Read strategy. True if results will be sorted by timestamp
|
|
225
|
-
# {
|
|
225
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
226
226
|
#
|
|
227
227
|
# @return [Boolean]
|
|
228
228
|
def time_sort_by_as_at?
|
|
@@ -230,7 +230,7 @@ module RubyEventStore
|
|
|
230
230
|
end
|
|
231
231
|
|
|
232
232
|
# Read strategy. True if results will be sorted by valid_at
|
|
233
|
-
# {
|
|
233
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
234
234
|
#
|
|
235
235
|
# @return [Boolean]
|
|
236
236
|
def time_sort_by_as_of?
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RubyEventStore
|
|
4
|
+
class SyncScheduler
|
|
5
|
+
DEPRECATION_MESSAGE = <<~EOW
|
|
6
|
+
DEPRECATION WARNING: Passing a class as a subscriber is deprecated and will be removed in the next major release.
|
|
7
|
+
Pass an instance or lambda instead, e.g. subscribe(MyHandler.new, to: [MyEvent]).
|
|
8
|
+
EOW
|
|
9
|
+
|
|
10
|
+
def call(subscriber, event, _)
|
|
11
|
+
if Class === subscriber
|
|
12
|
+
warn DEPRECATION_MESSAGE
|
|
13
|
+
subscriber = subscriber.new
|
|
14
|
+
end
|
|
15
|
+
subscriber.call(event)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def verify(subscriber)
|
|
19
|
+
if Class === subscriber
|
|
20
|
+
warn DEPRECATION_MESSAGE
|
|
21
|
+
begin
|
|
22
|
+
subscriber.new.respond_to?(:call)
|
|
23
|
+
rescue ArgumentError
|
|
24
|
+
false
|
|
25
|
+
end
|
|
26
|
+
else
|
|
27
|
+
subscriber.respond_to?(:call)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
data/lib/ruby_event_store.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "ruby_event_store/sync_scheduler"
|
|
3
4
|
require_relative "ruby_event_store/dispatcher"
|
|
4
5
|
require_relative "ruby_event_store/subscriptions"
|
|
5
6
|
require_relative "ruby_event_store/broker"
|
|
@@ -42,6 +43,7 @@ require_relative "ruby_event_store/serializers/yaml"
|
|
|
42
43
|
require_relative "ruby_event_store/batch_enumerator"
|
|
43
44
|
require_relative "ruby_event_store/correlated_commands"
|
|
44
45
|
require_relative "ruby_event_store/link_by_metadata"
|
|
46
|
+
require_relative "ruby_event_store/immediate_dispatcher"
|
|
45
47
|
require_relative "ruby_event_store/immediate_async_dispatcher"
|
|
46
48
|
require_relative "ruby_event_store/composed_dispatcher"
|
|
47
49
|
require_relative "ruby_event_store/composed_broker"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_event_store
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.19.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Arkency
|
|
@@ -53,6 +53,7 @@ files:
|
|
|
53
53
|
- lib/ruby_event_store/event_type_resolver.rb
|
|
54
54
|
- lib/ruby_event_store/expected_version.rb
|
|
55
55
|
- lib/ruby_event_store/immediate_async_dispatcher.rb
|
|
56
|
+
- lib/ruby_event_store/immediate_dispatcher.rb
|
|
56
57
|
- lib/ruby_event_store/in_memory_repository.rb
|
|
57
58
|
- lib/ruby_event_store/instrumented_broker.rb
|
|
58
59
|
- lib/ruby_event_store/instrumented_dispatcher.rb
|
|
@@ -96,6 +97,7 @@ files:
|
|
|
96
97
|
- lib/ruby_event_store/specification_result.rb
|
|
97
98
|
- lib/ruby_event_store/stream.rb
|
|
98
99
|
- lib/ruby_event_store/subscriptions.rb
|
|
100
|
+
- lib/ruby_event_store/sync_scheduler.rb
|
|
99
101
|
- lib/ruby_event_store/transform_keys.rb
|
|
100
102
|
- lib/ruby_event_store/version.rb
|
|
101
103
|
homepage: https://railseventstore.org
|
|
@@ -121,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
121
123
|
- !ruby/object:Gem::Version
|
|
122
124
|
version: '0'
|
|
123
125
|
requirements: []
|
|
124
|
-
rubygems_version:
|
|
126
|
+
rubygems_version: 4.0.6
|
|
125
127
|
specification_version: 4
|
|
126
128
|
summary: Implementation of an event store in Ruby
|
|
127
129
|
test_files: []
|