ruby_event_store 0.20.0 → 0.21.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.rb +1 -0
- data/lib/ruby_event_store/client.rb +8 -0
- data/lib/ruby_event_store/in_memory_repository.rb +8 -0
- data/lib/ruby_event_store/projection.rb +5 -2
- data/lib/ruby_event_store/spec/event_repository_lint.rb +22 -0
- data/lib/ruby_event_store/stream.rb +3 -0
- data/lib/ruby_event_store/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfb0772fe901e15fc75b778a04a4dd73192b0407
|
4
|
+
data.tar.gz: '07929227f6b1964589cef0962edce96e47cb4198'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7207f55c941d2e1bcd48cf656ef001750c9a17617507f38438e671ab8e2b288a6b045a5aec2731ff7da28462e872e76628094dbe80a6f8696238e67fa35ee72
|
7
|
+
data.tar.gz: ee9af3042920d3a5fb9fe407eb0b0e47a6f46cb0fdf160f1a26f245ee5e057a433b3a1f35eda6afa72c77ef09a7a2423d3e8b7c3b573aeb835c912be2250ce2d
|
data/lib/ruby_event_store.rb
CHANGED
@@ -6,6 +6,7 @@ require 'ruby_event_store/errors'
|
|
6
6
|
require 'ruby_event_store/constants'
|
7
7
|
require 'ruby_event_store/client'
|
8
8
|
require 'ruby_event_store/event'
|
9
|
+
require 'ruby_event_store/stream'
|
9
10
|
require 'ruby_event_store/deprecations'
|
10
11
|
require 'ruby_event_store/serialized_record'
|
11
12
|
require 'ruby_event_store/mappers/default'
|
@@ -69,6 +69,14 @@ module RubyEventStore
|
|
69
69
|
repository.read_all_streams_backward(page.start, page.count)
|
70
70
|
end
|
71
71
|
|
72
|
+
def read_event(event_id)
|
73
|
+
repository.read_event(event_id)
|
74
|
+
end
|
75
|
+
|
76
|
+
def get_all_streams
|
77
|
+
repository.get_all_streams
|
78
|
+
end
|
79
|
+
|
72
80
|
def subscribe(subscriber, event_types, &proc)
|
73
81
|
event_broker.add_subscriber(subscriber, event_types).tap do |unsub|
|
74
82
|
handle_subscribe(unsub, &proc)
|
@@ -65,6 +65,14 @@ module RubyEventStore
|
|
65
65
|
read_batch(all.reverse, start_event_id, count)
|
66
66
|
end
|
67
67
|
|
68
|
+
def read_event(event_id)
|
69
|
+
all.find { |e| event_id.equal?(e.event_id) } or raise EventNotFound
|
70
|
+
end
|
71
|
+
|
72
|
+
def get_all_streams
|
73
|
+
[Stream.new("all")] + streams.keys.map { |name| Stream.new(name) }
|
74
|
+
end
|
75
|
+
|
68
76
|
private
|
69
77
|
attr_accessor :streams, :all
|
70
78
|
|
@@ -432,4 +432,26 @@ RSpec.shared_examples :event_repository do |repository_class|
|
|
432
432
|
end.to raise_error(RubyEventStore::WrongExpectedEventVersion)
|
433
433
|
expect(repository.has_event?('9bedf448-e4d0-41a3-a8cd-f94aec7aa763')).to be_falsey
|
434
434
|
end
|
435
|
+
|
436
|
+
specify "all stream always present" do
|
437
|
+
expect(repository.get_all_streams).to match_array([RubyEventStore::Stream.new("all")])
|
438
|
+
end
|
439
|
+
|
440
|
+
specify "reading all existing stream names" do
|
441
|
+
repository.append_to_stream(TestDomainEvent.new, "test", -1)
|
442
|
+
repository.append_to_stream(TestDomainEvent.new, "test", 0)
|
443
|
+
expect(repository.get_all_streams).to match_array([RubyEventStore::Stream.new("all"), RubyEventStore::Stream.new("test")])
|
444
|
+
end
|
445
|
+
|
446
|
+
specify 'reading particular event' do
|
447
|
+
test_event = TestDomainEvent.new
|
448
|
+
repository.append_to_stream(TestDomainEvent.new, "test", -1)
|
449
|
+
repository.append_to_stream(test_event, "test", 0)
|
450
|
+
|
451
|
+
expect(repository.read_event(test_event.event_id)).to eq(test_event)
|
452
|
+
end
|
453
|
+
|
454
|
+
specify 'reading non-existent event' do
|
455
|
+
expect{repository.read_event('72922e65-1b32-4e97-8023-03ae81dd3a27')}.to raise_error(RubyEventStore::EventNotFound)
|
456
|
+
end
|
435
457
|
end
|
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.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkency
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/ruby_event_store/spec/dispatcher_lint.rb
|
107
107
|
- lib/ruby_event_store/spec/event_broker_lint.rb
|
108
108
|
- lib/ruby_event_store/spec/event_repository_lint.rb
|
109
|
+
- lib/ruby_event_store/stream.rb
|
109
110
|
- lib/ruby_event_store/version.rb
|
110
111
|
- ruby_event_store.gemspec
|
111
112
|
homepage: https://github.com/RailsEventStore/ruby_event_store
|