ruby_event_store 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8b3cc2b7c28d1128fc89ff122b9a303c3d41f31
|
4
|
+
data.tar.gz: b41290e98aa40078d9b276e6599049f47d7d051d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3669f850d4a535d51804206e5b362e9fee1723faff25ec9c36a5991990ff8ec1a47bba1011bd2d3107b62c735066c3956a351c9f7b3d79cec84385ce989ba722
|
7
|
+
data.tar.gz: 3158af75dafe4673c3043c82f9b74306f39f9ac1c7fa1899f00f89ce1964dc90a8ba9673957cb5d11a2d0f355300ebb4d5374c13d8f69d30bac25c96c891ec2f
|
data/CHANGELOG.md
CHANGED
@@ -9,13 +9,13 @@ module RubyEventStore
|
|
9
9
|
end
|
10
10
|
attr_reader :repository, :event_broker
|
11
11
|
|
12
|
-
def publish_event(event, stream_name
|
13
|
-
append_to_stream(stream_name, event, expected_version)
|
12
|
+
def publish_event(event, stream_name: GLOBAL_STREAM, expected_version: :any)
|
13
|
+
append_to_stream(stream_name, event, expected_version: expected_version)
|
14
14
|
event_broker.notify_subscribers(event)
|
15
15
|
:ok
|
16
16
|
end
|
17
17
|
|
18
|
-
def append_to_stream(stream_name, event, expected_version
|
18
|
+
def append_to_stream(stream_name, event, expected_version: :any)
|
19
19
|
validate_expected_version(stream_name, expected_version)
|
20
20
|
enriched_event = enrich_event_metadata(event)
|
21
21
|
repository.create(enriched_event, stream_name)
|
@@ -5,14 +5,14 @@ module RubyEventStore
|
|
5
5
|
|
6
6
|
def self.from_stream(*streams)
|
7
7
|
raise(ArgumentError, "At least one stream must be given") if streams.empty?
|
8
|
-
new(streams)
|
8
|
+
new(streams: streams)
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.from_all_streams
|
12
12
|
new
|
13
13
|
end
|
14
14
|
|
15
|
-
def initialize(streams
|
15
|
+
def initialize(streams: [])
|
16
16
|
@streams = streams
|
17
17
|
@handlers = Hash.new { ->(_, _) {} }
|
18
18
|
@init = -> { Hash.new }
|
@@ -46,7 +46,7 @@ module RubyEventStore
|
|
46
46
|
handlers.keys
|
47
47
|
end
|
48
48
|
|
49
|
-
def run(event_store, start
|
49
|
+
def run(event_store, start: :head, count: PAGE_SIZE)
|
50
50
|
if streams.any?
|
51
51
|
reduce_from_streams(event_store, start, count)
|
52
52
|
else
|
@@ -22,7 +22,7 @@ module RubyEventStore
|
|
22
22
|
|
23
23
|
DEFAULT_DISPATCHER = Dispatcher.new
|
24
24
|
|
25
|
-
def initialize(dispatcher
|
25
|
+
def initialize(dispatcher: DEFAULT_DISPATCHER)
|
26
26
|
@subscribers = Hash.new {|hsh, key| hsh[key] = [] }
|
27
27
|
@global_subscribers = []
|
28
28
|
@dispatcher = dispatcher
|
@@ -117,7 +117,7 @@ RSpec.shared_examples :event_broker do |broker_class|
|
|
117
117
|
dispatcher = TestDispatcher.new
|
118
118
|
handler = TestHandler.new
|
119
119
|
event1 = Test1DomainEvent.new
|
120
|
-
broker_with_custom_dispatcher = broker_class.new(dispatcher)
|
120
|
+
broker_with_custom_dispatcher = broker_class.new(dispatcher: dispatcher)
|
121
121
|
broker_with_custom_dispatcher.add_subscriber(handler, [Test1DomainEvent])
|
122
122
|
broker_with_custom_dispatcher.notify_subscribers(event1)
|
123
123
|
expect(dispatcher.dispatched).to eq([{subscriber: handler, event: event1}])
|
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.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkency
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: closed_struct
|