ruby_event_store 0.35.0 → 0.36.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/Makefile +2 -3
- data/lib/ruby_event_store.rb +0 -2
- data/lib/ruby_event_store/errors.rb +0 -1
- data/lib/ruby_event_store/in_memory_repository.rb +1 -1
- data/lib/ruby_event_store/projection.rb +1 -1
- data/lib/ruby_event_store/spec/event_repository_lint.rb +23 -14
- data/lib/ruby_event_store/version.rb +1 -1
- metadata +3 -6
- data/lib/ruby_event_store/async_dispatcher.rb +0 -26
- data/lib/ruby_event_store/async_proxy_strategy.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74ce24e16b83c5ce7158f1b2ca79e56ca2ea6b389957198b3f8478e20de1ca75
|
4
|
+
data.tar.gz: 7a3e066734b62828598475d528ef7d50c2b5420604f8d2746b8b769a45be4cff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0158753e75e020c5a6e3b2699dc96049cbd1aef1cb87c11754e12f7397fca770b46b4871b92764bb7599370270eeb75e0417e7f4fc77495b2d05cc9031dc86c6'
|
7
|
+
data.tar.gz: c4fcf49f6a4ba43487a105b53836360db48b442ff6b805a9364ba9e751b28bd8d671454d977455387dd71cfdeb717f6ce7d8ac8617df6a09ae979351202e27c8
|
data/Gemfile
CHANGED
data/Makefile
CHANGED
@@ -9,12 +9,11 @@ IGNORE = RubyEventStore::InMemoryRepository\#append_with_synchronize \
|
|
9
9
|
RubyEventStore::Client::Within\#add_thread_global_subscribers \
|
10
10
|
RubyEventStore::DeprecatedReadAPIRunner* \
|
11
11
|
RubyEventStore::DeprecatedReadAPIRewriter* \
|
12
|
-
RubyEventStore::AsyncDispatcher* \
|
13
|
-
RubyEventStore::AsyncProxyStrategy::Inline* \
|
14
12
|
RubyEventStore::SpecificationResult\#count \
|
15
13
|
RubyEventStore::SpecificationResult\#direction \
|
16
14
|
RubyEventStore::SpecificationResult\#stream_name \
|
17
|
-
RubyEventStore::SpecificationResult\#global_stream?
|
15
|
+
RubyEventStore::SpecificationResult\#global_stream? \
|
16
|
+
RubyEventStore::Client::Within\#call
|
18
17
|
SUBJECT ?= RubyEventStore*
|
19
18
|
|
20
19
|
include ../lib/install.mk
|
data/lib/ruby_event_store.rb
CHANGED
@@ -21,8 +21,6 @@ require 'ruby_event_store/mappers/null_mapper'
|
|
21
21
|
require 'ruby_event_store/batch_enumerator'
|
22
22
|
require 'ruby_event_store/correlated_commands'
|
23
23
|
require 'ruby_event_store/link_by_metadata'
|
24
|
-
require 'ruby_event_store/async_proxy_strategy'
|
25
|
-
require 'ruby_event_store/async_dispatcher'
|
26
24
|
require 'ruby_event_store/immediate_async_dispatcher'
|
27
25
|
require 'ruby_event_store/composed_dispatcher'
|
28
26
|
require 'ruby_event_store/version'
|
@@ -6,7 +6,6 @@ module RubyEventStore
|
|
6
6
|
InvalidPageStart = Class.new(ArgumentError)
|
7
7
|
InvalidPageSize = Class.new(ArgumentError)
|
8
8
|
EventDuplicatedInStream = Class.new(StandardError)
|
9
|
-
NotSupported = Class.new(StandardError)
|
10
9
|
ReservedInternalName = Class.new(StandardError)
|
11
10
|
InvalidHandler = Class.new(StandardError)
|
12
11
|
ProtobufEncodingFailed = Class.new(StandardError)
|
@@ -3,9 +3,9 @@ module RubyEventStore
|
|
3
3
|
class SRecord
|
4
4
|
def self.new(
|
5
5
|
event_id: SecureRandom.uuid,
|
6
|
-
data:
|
7
|
-
metadata:
|
8
|
-
event_type:
|
6
|
+
data: '{}',
|
7
|
+
metadata: '{}',
|
8
|
+
event_type: 'SRecordTestEvent'
|
9
9
|
)
|
10
10
|
SerializedRecord.new(
|
11
11
|
event_id: event_id,
|
@@ -643,31 +643,31 @@ module RubyEventStore
|
|
643
643
|
end
|
644
644
|
|
645
645
|
it 'data attributes are retrieved' do
|
646
|
-
event = SRecord.new(data: "
|
646
|
+
event = SRecord.new(data: '{"order_id":3}')
|
647
647
|
repository.append_to_stream(event, stream, version_any)
|
648
648
|
retrieved_event = read_all_streams_forward(repository, :head, 1).first
|
649
|
-
expect(retrieved_event.data).to eq("
|
649
|
+
expect(retrieved_event.data).to eq('{"order_id":3}')
|
650
650
|
end
|
651
651
|
|
652
652
|
it 'metadata attributes are retrieved' do
|
653
|
-
event = SRecord.new(metadata: "
|
653
|
+
event = SRecord.new(metadata: '{"request_id":3}')
|
654
654
|
repository.append_to_stream(event, stream, version_any)
|
655
655
|
retrieved_event = read_all_streams_forward(repository, :head, 1).first
|
656
|
-
expect(retrieved_event.metadata).to eq("
|
656
|
+
expect(retrieved_event.metadata).to eq('{"request_id":3}')
|
657
657
|
end
|
658
658
|
|
659
659
|
it 'data and metadata attributes are retrieved when linking' do
|
660
660
|
skip unless test_link_events_to_stream
|
661
661
|
event = SRecord.new(
|
662
|
-
data: "
|
663
|
-
metadata: "
|
662
|
+
data: '{"order_id":3}',
|
663
|
+
metadata: '{"request_id":4}',
|
664
664
|
)
|
665
665
|
repository.
|
666
666
|
append_to_stream(event, stream, version_any).
|
667
667
|
link_to_stream(event.event_id, stream_flow, version_any)
|
668
668
|
retrieved_event = read_stream_events_forward(repository, stream_flow).first
|
669
|
-
expect(retrieved_event.metadata).to eq("
|
670
|
-
expect(retrieved_event.data).to eq("
|
669
|
+
expect(retrieved_event.metadata).to eq('{"request_id":4}')
|
670
|
+
expect(retrieved_event.data).to eq('{"order_id":3}')
|
671
671
|
expect(event).to eq(retrieved_event)
|
672
672
|
end
|
673
673
|
|
@@ -1151,10 +1151,10 @@ module RubyEventStore
|
|
1151
1151
|
)
|
1152
1152
|
repository.update_messages([
|
1153
1153
|
a = SRecord.new(event_id: events[0].event_id.clone, data: events[0].data, metadata: events[0].metadata, event_type: events[0].event_type),
|
1154
|
-
b = SRecord.new(event_id: events[1].event_id.dup,
|
1155
|
-
c = SRecord.new(event_id: events[2].event_id,
|
1154
|
+
b = SRecord.new(event_id: events[1].event_id.dup, data: '{"test":1}', metadata: events[1].metadata, event_type: events[1].event_type),
|
1155
|
+
c = SRecord.new(event_id: events[2].event_id, data: events[2].data, metadata: '{"test":2}', event_type: events[2].event_type),
|
1156
1156
|
d = SRecord.new(event_id: events[3].event_id.clone, data: events[3].data, metadata: events[3].metadata, event_type: "event_type3"),
|
1157
|
-
e = SRecord.new(event_id: events[4].event_id.dup,
|
1157
|
+
e = SRecord.new(event_id: events[4].event_id.dup, data: '{"test":4}', metadata: '{"test":42}', event_type: "event_type4"),
|
1158
1158
|
])
|
1159
1159
|
expect(repository.read(specification.result).to_a).to eq([a,b,c,d,e])
|
1160
1160
|
expect(repository.read(specification.stream("whatever").result).to_a).to eq([a,b,c])
|
@@ -1210,6 +1210,15 @@ module RubyEventStore
|
|
1210
1210
|
'8a6f053e-3ce2-4c82-a55b-4d02c66ae6ea',
|
1211
1211
|
'd345f86d-b903-4d78-803f-38990c078d9e'
|
1212
1212
|
]).in_batches.result).to_a[0]).to eq([e1,e3])
|
1213
|
+
expect(repository.read(specification.stream('Stream A').with_id([
|
1214
|
+
'8cee1139-4f96-483a-a175-2b947283c3c7'
|
1215
|
+
]).read_first.result)).to eq(e2)
|
1216
|
+
expect(repository.read(specification.stream('Stream B').with_id([
|
1217
|
+
'8cee1139-4f96-483a-a175-2b947283c3c7'
|
1218
|
+
]).read_first.result)).to eq(nil)
|
1219
|
+
expect(repository.read(specification.stream('Stream B').with_id([
|
1220
|
+
'c31b327c-0da1-4178-a3cd-d2f6bb5d0688'
|
1221
|
+
]).read_first.result)).to eq(nil)
|
1213
1222
|
expect(repository.read(specification.with_id([]).result).to_a).to eq([])
|
1214
1223
|
end
|
1215
1224
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_event_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.36.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkency
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -38,8 +38,6 @@ files:
|
|
38
38
|
- README.md
|
39
39
|
- exe/res-deprecated-read-api-migrator
|
40
40
|
- lib/ruby_event_store.rb
|
41
|
-
- lib/ruby_event_store/async_dispatcher.rb
|
42
|
-
- lib/ruby_event_store/async_proxy_strategy.rb
|
43
41
|
- lib/ruby_event_store/batch_enumerator.rb
|
44
42
|
- lib/ruby_event_store/client.rb
|
45
43
|
- lib/ruby_event_store/composed_dispatcher.rb
|
@@ -99,8 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
97
|
- !ruby/object:Gem::Version
|
100
98
|
version: '0'
|
101
99
|
requirements: []
|
102
|
-
|
103
|
-
rubygems_version: 3.0.0.beta2
|
100
|
+
rubygems_version: 3.0.2
|
104
101
|
signing_key:
|
105
102
|
specification_version: 4
|
106
103
|
summary: Event Store in Ruby
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module RubyEventStore
|
2
|
-
# @deprecated Use RubyEventStore::ImmediateAsyncDispatcher instead
|
3
|
-
class AsyncDispatcher < PubSub::Dispatcher
|
4
|
-
def initialize(proxy_strategy: AsyncProxyStrategy::Inline.new, scheduler:)
|
5
|
-
@async_proxy_strategy = proxy_strategy
|
6
|
-
@scheduler = scheduler
|
7
|
-
warn <<~EOW
|
8
|
-
RubyEventStore::AsyncDispatcher has been deprecated.
|
9
|
-
|
10
|
-
Use RubyEventStore::ImmediateAsyncDispatcher instead
|
11
|
-
EOW
|
12
|
-
end
|
13
|
-
|
14
|
-
def call(subscriber, _, serialized_event)
|
15
|
-
if @scheduler.async_handler?(subscriber)
|
16
|
-
@async_proxy_strategy.call(->{ @scheduler.call(subscriber, serialized_event) })
|
17
|
-
else
|
18
|
-
super
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def verify(subscriber)
|
23
|
-
@scheduler.async_handler?(subscriber) || super
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module RubyEventStore
|
2
|
-
module AsyncProxyStrategy
|
3
|
-
# @deprecated Use RubyEventStore::ImmediateAsyncDispatcher instead
|
4
|
-
class Inline
|
5
|
-
def initialize
|
6
|
-
warn <<~EOW
|
7
|
-
RubyEventStore::AsyncProxyStrategy::Inline has been deprecated.
|
8
|
-
|
9
|
-
Use RubyEventStore::ImmediateAsyncDispatcher instead
|
10
|
-
EOW
|
11
|
-
end
|
12
|
-
|
13
|
-
def call(schedule_proc)
|
14
|
-
schedule_proc.call
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|