ruby_event_store 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby_event_store/client.rb +29 -2
- data/lib/ruby_event_store/errors.rb +1 -0
- data/lib/ruby_event_store/event.rb +5 -2
- data/lib/ruby_event_store/in_memory_repository.rb +64 -12
- data/lib/ruby_event_store/instrumented_dispatcher.rb +12 -2
- data/lib/ruby_event_store/instrumented_repository.rb +14 -8
- data/lib/ruby_event_store/mappers/encryption_mapper.rb +1 -1
- data/lib/ruby_event_store/mappers/forgotten_data.rb +1 -1
- data/lib/ruby_event_store/mappers/in_memory_encryption_key_repository.rb +1 -1
- data/lib/ruby_event_store/mappers/transformation/domain_event.rb +11 -1
- data/lib/ruby_event_store/metadata.rb +3 -3
- data/lib/ruby_event_store/projection.rb +2 -2
- data/lib/ruby_event_store/spec/broker_lint.rb +11 -11
- data/lib/ruby_event_store/spec/event_lint.rb +9 -9
- data/lib/ruby_event_store/spec/event_repository_lint.rb +273 -235
- data/lib/ruby_event_store/spec/subscriptions_lint.rb +35 -35
- data/lib/ruby_event_store/subscriptions.rb +1 -1
- data/lib/ruby_event_store/version.rb +1 -1
- data/lib/ruby_event_store.rb +43 -43
- metadata +16 -2
@@ -17,7 +17,7 @@ RSpec.shared_examples :subscriptions do |subscriptions_class|
|
|
17
17
|
|
18
18
|
subject(:subscriptions) { subscriptions_class.new }
|
19
19
|
|
20
|
-
it
|
20
|
+
it "returns all subscribed handlers" do
|
21
21
|
handler = TestHandler.new
|
22
22
|
another_handler = TestHandler.new
|
23
23
|
global_handler = TestHandler.new
|
@@ -26,12 +26,12 @@ RSpec.shared_examples :subscriptions do |subscriptions_class|
|
|
26
26
|
subscriptions.add_subscription(another_handler, [Test2DomainEvent])
|
27
27
|
subscriptions.add_global_subscription(global_handler)
|
28
28
|
|
29
|
-
expect(subscriptions.all_for(
|
30
|
-
expect(subscriptions.all_for(
|
31
|
-
expect(subscriptions.all_for(
|
29
|
+
expect(subscriptions.all_for("Test1DomainEvent")).to eq([handler, global_handler])
|
30
|
+
expect(subscriptions.all_for("Test2DomainEvent")).to eq([another_handler, global_handler])
|
31
|
+
expect(subscriptions.all_for("Test3DomainEvent")).to eq([handler, global_handler])
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
34
|
+
it "returns subscribed thread handlers" do
|
35
35
|
handler = TestHandler.new
|
36
36
|
another_handler = TestHandler.new
|
37
37
|
global_handler = TestHandler.new
|
@@ -42,84 +42,84 @@ RSpec.shared_examples :subscriptions do |subscriptions_class|
|
|
42
42
|
t = Thread.new do
|
43
43
|
subscriptions.add_thread_subscription(handler, [Test2DomainEvent])
|
44
44
|
subscriptions.add_thread_global_subscription(another_handler)
|
45
|
-
expect(subscriptions.all_for(
|
45
|
+
expect(subscriptions.all_for("Test2DomainEvent")).to eq([another_handler, handler])
|
46
46
|
end
|
47
47
|
|
48
|
-
expect(subscriptions.all_for(
|
49
|
-
expect(subscriptions.all_for(
|
50
|
-
expect(subscriptions.all_for(
|
48
|
+
expect(subscriptions.all_for("Test1DomainEvent")).to eq([global_handler, handler])
|
49
|
+
expect(subscriptions.all_for("Test2DomainEvent")).to eq([global_handler, another_handler])
|
50
|
+
expect(subscriptions.all_for("Test3DomainEvent")).to eq([global_handler, handler])
|
51
51
|
t.join
|
52
52
|
end
|
53
53
|
|
54
|
-
it
|
54
|
+
it "returns lambda as an output of global subscribe methods" do
|
55
55
|
handler = TestHandler.new
|
56
56
|
result = subscriptions.add_global_subscription(handler)
|
57
57
|
expect(result).to respond_to(:call)
|
58
58
|
end
|
59
59
|
|
60
|
-
it
|
60
|
+
it "returns lambda as an output of subscribe methods" do
|
61
61
|
handler = TestHandler.new
|
62
62
|
result = subscriptions.add_subscription(handler, [Test1DomainEvent, Test2DomainEvent])
|
63
63
|
expect(result).to respond_to(:call)
|
64
64
|
end
|
65
65
|
|
66
|
-
it
|
66
|
+
it "revokes global subscription" do
|
67
67
|
handler = TestHandler.new
|
68
68
|
|
69
69
|
revoke = subscriptions.add_global_subscription(handler)
|
70
|
-
expect(subscriptions.all_for(
|
71
|
-
expect(subscriptions.all_for(
|
70
|
+
expect(subscriptions.all_for("Test1DomainEvent")).to eq([handler])
|
71
|
+
expect(subscriptions.all_for("Test2DomainEvent")).to eq([handler])
|
72
72
|
revoke.()
|
73
|
-
expect(subscriptions.all_for(
|
74
|
-
expect(subscriptions.all_for(
|
73
|
+
expect(subscriptions.all_for("Test1DomainEvent")).to eq([])
|
74
|
+
expect(subscriptions.all_for("Test2DomainEvent")).to eq([])
|
75
75
|
end
|
76
76
|
|
77
|
-
it
|
77
|
+
it "revokes subscription" do
|
78
78
|
handler = TestHandler.new
|
79
79
|
|
80
80
|
revoke = subscriptions.add_subscription(handler, [Test1DomainEvent, Test2DomainEvent])
|
81
|
-
expect(subscriptions.all_for(
|
82
|
-
expect(subscriptions.all_for(
|
81
|
+
expect(subscriptions.all_for("Test1DomainEvent")).to eq([handler])
|
82
|
+
expect(subscriptions.all_for("Test2DomainEvent")).to eq([handler])
|
83
83
|
revoke.()
|
84
|
-
expect(subscriptions.all_for(
|
85
|
-
expect(subscriptions.all_for(
|
84
|
+
expect(subscriptions.all_for("Test1DomainEvent")).to eq([])
|
85
|
+
expect(subscriptions.all_for("Test2DomainEvent")).to eq([])
|
86
86
|
end
|
87
87
|
|
88
|
-
it
|
88
|
+
it "revokes thread global subscription" do
|
89
89
|
handler = TestHandler.new
|
90
90
|
|
91
91
|
revoke = subscriptions.add_thread_global_subscription(handler)
|
92
|
-
expect(subscriptions.all_for(
|
93
|
-
expect(subscriptions.all_for(
|
92
|
+
expect(subscriptions.all_for("Test1DomainEvent")).to eq([handler])
|
93
|
+
expect(subscriptions.all_for("Test2DomainEvent")).to eq([handler])
|
94
94
|
revoke.()
|
95
|
-
expect(subscriptions.all_for(
|
96
|
-
expect(subscriptions.all_for(
|
95
|
+
expect(subscriptions.all_for("Test1DomainEvent")).to eq([])
|
96
|
+
expect(subscriptions.all_for("Test2DomainEvent")).to eq([])
|
97
97
|
end
|
98
98
|
|
99
|
-
it
|
99
|
+
it "revokes thread subscription" do
|
100
100
|
handler = TestHandler.new
|
101
101
|
|
102
102
|
revoke = subscriptions.add_thread_subscription(handler, [Test1DomainEvent, Test2DomainEvent])
|
103
|
-
expect(subscriptions.all_for(
|
104
|
-
expect(subscriptions.all_for(
|
103
|
+
expect(subscriptions.all_for("Test1DomainEvent")).to eq([handler])
|
104
|
+
expect(subscriptions.all_for("Test2DomainEvent")).to eq([handler])
|
105
105
|
revoke.()
|
106
|
-
expect(subscriptions.all_for(
|
107
|
-
expect(subscriptions.all_for(
|
106
|
+
expect(subscriptions.all_for("Test1DomainEvent")).to eq([])
|
107
|
+
expect(subscriptions.all_for("Test2DomainEvent")).to eq([])
|
108
108
|
end
|
109
109
|
|
110
|
-
it
|
110
|
+
it "subscribes by type of event which is a String" do
|
111
111
|
handler = TestHandler.new
|
112
112
|
subscriptions.add_subscription(handler, ["Test1DomainEvent"])
|
113
113
|
subscriptions.add_thread_subscription(handler, ["Test1DomainEvent"])
|
114
114
|
|
115
|
-
expect(subscriptions.all_for(
|
115
|
+
expect(subscriptions.all_for("Test1DomainEvent")).to eq([handler, handler])
|
116
116
|
end
|
117
117
|
|
118
|
-
it
|
118
|
+
it "subscribes by type of event which is a class" do
|
119
119
|
handler = TestHandler.new
|
120
120
|
subscriptions.add_subscription(handler, [Test1DomainEvent])
|
121
121
|
subscriptions.add_thread_subscription(handler, [Test1DomainEvent])
|
122
122
|
|
123
|
-
expect(subscriptions.all_for(
|
123
|
+
expect(subscriptions.all_for("Test1DomainEvent")).to eq([handler, handler])
|
124
124
|
end
|
125
125
|
end
|
data/lib/ruby_event_store.rb
CHANGED
@@ -1,45 +1,45 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative
|
12
|
-
require_relative
|
13
|
-
require_relative
|
14
|
-
require_relative
|
15
|
-
require_relative
|
16
|
-
require_relative
|
17
|
-
require_relative
|
18
|
-
require_relative
|
19
|
-
require_relative
|
20
|
-
require_relative
|
21
|
-
require_relative
|
22
|
-
require_relative
|
23
|
-
require_relative
|
24
|
-
require_relative
|
25
|
-
require_relative
|
26
|
-
require_relative
|
27
|
-
require_relative
|
28
|
-
require_relative
|
29
|
-
require_relative
|
30
|
-
require_relative
|
31
|
-
require_relative
|
32
|
-
require_relative
|
33
|
-
require_relative
|
34
|
-
require_relative
|
35
|
-
require_relative
|
36
|
-
require_relative
|
37
|
-
require_relative
|
38
|
-
require_relative
|
39
|
-
require_relative
|
40
|
-
require_relative
|
41
|
-
require_relative
|
42
|
-
require_relative
|
43
|
-
require_relative
|
44
|
-
require_relative
|
45
|
-
require_relative
|
3
|
+
require_relative "ruby_event_store/dispatcher"
|
4
|
+
require_relative "ruby_event_store/subscriptions"
|
5
|
+
require_relative "ruby_event_store/broker"
|
6
|
+
require_relative "ruby_event_store/in_memory_repository"
|
7
|
+
require_relative "ruby_event_store/projection"
|
8
|
+
require_relative "ruby_event_store/errors"
|
9
|
+
require_relative "ruby_event_store/constants"
|
10
|
+
require_relative "ruby_event_store/client"
|
11
|
+
require_relative "ruby_event_store/metadata"
|
12
|
+
require_relative "ruby_event_store/specification"
|
13
|
+
require_relative "ruby_event_store/specification_result"
|
14
|
+
require_relative "ruby_event_store/specification_reader"
|
15
|
+
require_relative "ruby_event_store/event"
|
16
|
+
require_relative "ruby_event_store/stream"
|
17
|
+
require_relative "ruby_event_store/expected_version"
|
18
|
+
require_relative "ruby_event_store/record"
|
19
|
+
require_relative "ruby_event_store/serialized_record"
|
20
|
+
require_relative "ruby_event_store/null"
|
21
|
+
require_relative "ruby_event_store/transform_keys"
|
22
|
+
require_relative "ruby_event_store/mappers/encryption_key"
|
23
|
+
require_relative "ruby_event_store/mappers/in_memory_encryption_key_repository"
|
24
|
+
require_relative "ruby_event_store/mappers/transformation/domain_event"
|
25
|
+
require_relative "ruby_event_store/mappers/transformation/encryption"
|
26
|
+
require_relative "ruby_event_store/mappers/transformation/event_class_remapper"
|
27
|
+
require_relative "ruby_event_store/mappers/transformation/upcast"
|
28
|
+
require_relative "ruby_event_store/mappers/transformation/stringify_metadata_keys"
|
29
|
+
require_relative "ruby_event_store/mappers/transformation/symbolize_metadata_keys"
|
30
|
+
require_relative "ruby_event_store/mappers/pipeline"
|
31
|
+
require_relative "ruby_event_store/mappers/pipeline_mapper"
|
32
|
+
require_relative "ruby_event_store/mappers/default"
|
33
|
+
require_relative "ruby_event_store/mappers/forgotten_data"
|
34
|
+
require_relative "ruby_event_store/mappers/encryption_mapper"
|
35
|
+
require_relative "ruby_event_store/mappers/instrumented_mapper"
|
36
|
+
require_relative "ruby_event_store/mappers/json_mapper"
|
37
|
+
require_relative "ruby_event_store/mappers/null_mapper"
|
38
|
+
require_relative "ruby_event_store/batch_enumerator"
|
39
|
+
require_relative "ruby_event_store/correlated_commands"
|
40
|
+
require_relative "ruby_event_store/link_by_metadata"
|
41
|
+
require_relative "ruby_event_store/immediate_async_dispatcher"
|
42
|
+
require_relative "ruby_event_store/composed_dispatcher"
|
43
|
+
require_relative "ruby_event_store/version"
|
44
|
+
require_relative "ruby_event_store/instrumented_repository"
|
45
|
+
require_relative "ruby_event_store/instrumented_dispatcher"
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkency
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ruby2_keywords
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: concurrent-ruby
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|