ruby_event_store 2.17.1 → 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 +45 -37
- data/lib/ruby_event_store/dispatcher.rb +6 -14
- data/lib/ruby_event_store/event.rb +20 -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
|
@@ -13,7 +13,7 @@ module RubyEventStore
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
# Limits the query to certain stream.
|
|
16
|
-
# {
|
|
16
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
17
17
|
#
|
|
18
18
|
# @param stream_name [String] name of the stream to get events from
|
|
19
19
|
# @return [Specification]
|
|
@@ -22,7 +22,7 @@ module RubyEventStore
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
# Limits the query to events before or after another event.
|
|
25
|
-
# {
|
|
25
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
26
26
|
#
|
|
27
27
|
# @param start [String] id of event to start reading from.
|
|
28
28
|
# @return [Specification]
|
|
@@ -32,7 +32,7 @@ module RubyEventStore
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
# Limits the query to events before or after another event.
|
|
35
|
-
# {
|
|
35
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
36
36
|
#
|
|
37
37
|
# @param stop [String] id of event to start reading from.
|
|
38
38
|
# @return [Specification]
|
|
@@ -42,7 +42,7 @@ module RubyEventStore
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
# Limits the query to events that occurred before given time.
|
|
45
|
-
# {
|
|
45
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
46
46
|
#
|
|
47
47
|
# @param time [Time]
|
|
48
48
|
# @return [Specification]
|
|
@@ -58,7 +58,7 @@ module RubyEventStore
|
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
# Limits the query to events that occurred on or before given time.
|
|
61
|
-
# {
|
|
61
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
62
62
|
#
|
|
63
63
|
# @param time [Time]
|
|
64
64
|
# @return [Specification]
|
|
@@ -74,7 +74,7 @@ module RubyEventStore
|
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
# Limits the query to events that occurred after given time.
|
|
77
|
-
# {
|
|
77
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
78
78
|
#
|
|
79
79
|
# @param time [Time]
|
|
80
80
|
# @return [Specification]
|
|
@@ -90,7 +90,7 @@ module RubyEventStore
|
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
# Limits the query to events that occurred on or after given time.
|
|
93
|
-
# {
|
|
93
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
94
94
|
#
|
|
95
95
|
# @param time [Time]
|
|
96
96
|
# @return [Specification]
|
|
@@ -106,7 +106,7 @@ module RubyEventStore
|
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
# Limits the query to events within given time range.
|
|
109
|
-
# {
|
|
109
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
110
110
|
#
|
|
111
111
|
# @param time_range [Range]
|
|
112
112
|
# @return [Specification]
|
|
@@ -119,7 +119,7 @@ module RubyEventStore
|
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
# Sets the order of time sorting using transaction time
|
|
122
|
-
# {
|
|
122
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}
|
|
123
123
|
#
|
|
124
124
|
# @return [Specification]
|
|
125
125
|
def as_at
|
|
@@ -127,7 +127,7 @@ module RubyEventStore
|
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
# Sets the order of time sorting using validity time
|
|
130
|
-
# {
|
|
130
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}
|
|
131
131
|
#
|
|
132
132
|
# @return [Specification]
|
|
133
133
|
def as_of
|
|
@@ -135,7 +135,7 @@ module RubyEventStore
|
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
# Sets the order of reading events to ascending (forward from the start).
|
|
138
|
-
# {
|
|
138
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
139
139
|
#
|
|
140
140
|
# @return [Specification]
|
|
141
141
|
def forward
|
|
@@ -143,7 +143,7 @@ module RubyEventStore
|
|
|
143
143
|
end
|
|
144
144
|
|
|
145
145
|
# Sets the order of reading events to descending (backward from the start).
|
|
146
|
-
# {
|
|
146
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
147
147
|
#
|
|
148
148
|
# @return [Specification]
|
|
149
149
|
def backward
|
|
@@ -151,7 +151,7 @@ module RubyEventStore
|
|
|
151
151
|
end
|
|
152
152
|
|
|
153
153
|
# Limits the query to specified number of events.
|
|
154
|
-
# {
|
|
154
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
155
155
|
#
|
|
156
156
|
# @param count [Integer] maximal number of events to retrieve
|
|
157
157
|
# @return [Specification]
|
|
@@ -162,7 +162,7 @@ module RubyEventStore
|
|
|
162
162
|
|
|
163
163
|
# Executes the query based on the specification built up to this point.
|
|
164
164
|
# Yields each batch of records that was retrieved from the store.
|
|
165
|
-
# {
|
|
165
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
166
166
|
#
|
|
167
167
|
# @yield [Array<Event>] batch of events
|
|
168
168
|
# @return [Enumerator, nil] Enumerator is returned when block not given
|
|
@@ -174,7 +174,7 @@ module RubyEventStore
|
|
|
174
174
|
|
|
175
175
|
# Executes the query based on the specification built up to this point.
|
|
176
176
|
# Yields events read from the store if block given. Otherwise, returns enumerable collection.
|
|
177
|
-
# {
|
|
177
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
178
178
|
#
|
|
179
179
|
# @yield [Event] event
|
|
180
180
|
# @return [Enumerator, nil] Enumerator is returned when block not given
|
|
@@ -186,7 +186,7 @@ module RubyEventStore
|
|
|
186
186
|
|
|
187
187
|
# Executes the query based on the specification built up to this point
|
|
188
188
|
# and maps the result using provided block.
|
|
189
|
-
# {
|
|
189
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
190
190
|
#
|
|
191
191
|
# @return [Array] of mapped result
|
|
192
192
|
def map(&block)
|
|
@@ -196,7 +196,7 @@ module RubyEventStore
|
|
|
196
196
|
|
|
197
197
|
# Reduces the results of the query based on the specification
|
|
198
198
|
# built up to this point result using provided block.
|
|
199
|
-
# {
|
|
199
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
200
200
|
#
|
|
201
201
|
# @param accumulator starting state for reduce operation
|
|
202
202
|
# @return reduce result as defined by block given
|
|
@@ -206,7 +206,7 @@ module RubyEventStore
|
|
|
206
206
|
end
|
|
207
207
|
|
|
208
208
|
# Calculates the size of result set based on the specification build up to this point.
|
|
209
|
-
# {
|
|
209
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
210
210
|
#
|
|
211
211
|
# @return [Integer] Number of events to read
|
|
212
212
|
def count
|
|
@@ -215,7 +215,7 @@ module RubyEventStore
|
|
|
215
215
|
|
|
216
216
|
# Executes the query based on the specification built up to this point.
|
|
217
217
|
# Returns array of domain events.
|
|
218
|
-
# {
|
|
218
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
219
219
|
#
|
|
220
220
|
# @return [Array<Event>]
|
|
221
221
|
def to_a
|
|
@@ -223,7 +223,7 @@ module RubyEventStore
|
|
|
223
223
|
end
|
|
224
224
|
|
|
225
225
|
# Specifies that events should be obtained in batches.
|
|
226
|
-
# {
|
|
226
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
227
227
|
#
|
|
228
228
|
# Looping through a collection of events from the store
|
|
229
229
|
# can be inefficient since it will try to instantiate all
|
|
@@ -244,10 +244,18 @@ module RubyEventStore
|
|
|
244
244
|
end,
|
|
245
245
|
)
|
|
246
246
|
end
|
|
247
|
-
|
|
247
|
+
|
|
248
|
+
def in_batches_of(batch_size = DEFAULT_BATCH_SIZE)
|
|
249
|
+
warn <<~EOW
|
|
250
|
+
RubyEventStore::Specification#in_batches_of is deprecated and will be removed in the next major release.
|
|
251
|
+
|
|
252
|
+
Use #in_batches instead.
|
|
253
|
+
EOW
|
|
254
|
+
in_batches(batch_size)
|
|
255
|
+
end
|
|
248
256
|
|
|
249
257
|
# Specifies that only first event should be read.
|
|
250
|
-
# {
|
|
258
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
251
259
|
#
|
|
252
260
|
# @return [Specification]
|
|
253
261
|
def read_first
|
|
@@ -255,7 +263,7 @@ module RubyEventStore
|
|
|
255
263
|
end
|
|
256
264
|
|
|
257
265
|
# Specifies that only last event should be read.
|
|
258
|
-
# {
|
|
266
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
259
267
|
#
|
|
260
268
|
# @return [Specification]
|
|
261
269
|
def read_last
|
|
@@ -264,7 +272,7 @@ module RubyEventStore
|
|
|
264
272
|
|
|
265
273
|
# Executes the query based on the specification built up to this point.
|
|
266
274
|
# Returns the first event in specified collection of events.
|
|
267
|
-
# {
|
|
275
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
268
276
|
#
|
|
269
277
|
# @return [Event, nil]
|
|
270
278
|
def first
|
|
@@ -273,7 +281,7 @@ module RubyEventStore
|
|
|
273
281
|
|
|
274
282
|
# Executes the query based on the specification built up to this point.
|
|
275
283
|
# Returns the last event in specified collection of events.
|
|
276
|
-
# {
|
|
284
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
277
285
|
#
|
|
278
286
|
# @return [Event, nil]
|
|
279
287
|
def last
|
|
@@ -281,17 +289,25 @@ module RubyEventStore
|
|
|
281
289
|
end
|
|
282
290
|
|
|
283
291
|
# Limits the query to certain event type(s).
|
|
284
|
-
# {
|
|
292
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
285
293
|
#
|
|
286
294
|
# @types [Class, Array(Class)] types of event to look for.
|
|
287
295
|
# @return [Specification]
|
|
288
296
|
def of_type(*types)
|
|
289
297
|
Specification.new(reader, result.dup { |r| r.with_types = types.flatten })
|
|
290
298
|
end
|
|
291
|
-
|
|
299
|
+
|
|
300
|
+
def of_types(*types)
|
|
301
|
+
warn <<~EOW
|
|
302
|
+
RubyEventStore::Specification#of_types is deprecated and will be removed in the next major release.
|
|
303
|
+
|
|
304
|
+
Use #of_type instead.
|
|
305
|
+
EOW
|
|
306
|
+
of_type(*types)
|
|
307
|
+
end
|
|
292
308
|
|
|
293
309
|
# Limits the query to certain events by given even ids.
|
|
294
|
-
# {
|
|
310
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
295
311
|
#
|
|
296
312
|
# @param event_ids [Array(String)] ids of event to look for.
|
|
297
313
|
# @return [Specification]
|
|
@@ -302,7 +318,7 @@ module RubyEventStore
|
|
|
302
318
|
# Reads single event from repository.
|
|
303
319
|
# Returns the event with specified id or nil if event is not found
|
|
304
320
|
# in specified collection of events.
|
|
305
|
-
# {
|
|
321
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
306
322
|
#
|
|
307
323
|
# @return [Event, nil]
|
|
308
324
|
def event(event_id)
|
|
@@ -312,7 +328,7 @@ module RubyEventStore
|
|
|
312
328
|
# Reads single existing event from repository.
|
|
313
329
|
# Returns the event with specified id or raises [EventNotFound] error if
|
|
314
330
|
# event is not found in specified collection of events.
|
|
315
|
-
# {
|
|
331
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
316
332
|
#
|
|
317
333
|
# @return [Event]
|
|
318
334
|
def event!(event_id)
|
|
@@ -322,7 +338,7 @@ module RubyEventStore
|
|
|
322
338
|
# Reads all events of given ids from repository.
|
|
323
339
|
# Yields each event (found by id in specified collection of events)
|
|
324
340
|
# read from the store if block given. Otherwise, returns enumerable collection.
|
|
325
|
-
# {
|
|
341
|
+
# {https://railseventstore.org/docs/core-concepts/read Find out more}.
|
|
326
342
|
#
|
|
327
343
|
# @yield [Event] event
|
|
328
344
|
# @return [Enumerator] Enumerator is returned when block not given
|
|
@@ -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: []
|