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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2e4768baf6a615d130234f71b2eeeeea911baafcab466651e42e4f5873430a3
4
- data.tar.gz: 587f48214166735f91685638143133723cb7c3e2e46a3ec657490ce7c13cda00
3
+ metadata.gz: 74ce24e16b83c5ce7158f1b2ca79e56ca2ea6b389957198b3f8478e20de1ca75
4
+ data.tar.gz: 7a3e066734b62828598475d528ef7d50c2b5420604f8d2746b8b769a45be4cff
5
5
  SHA512:
6
- metadata.gz: 2115d731ca0d1f6e6b9eb26d4a8cf8e8ea41c634bb521de9cfc2b181c3fec7f98d4b0a33667befeb16343247fdae1315cf543ac77ab4808bf6cb23740f91233f
7
- data.tar.gz: 71473199da981d2832cc60fac2887a4222b4a6606f15f0bf7356414ea11bdb3abd80ca38baf3f07cb377c6afe4e69662db0c97d3bdf5fbe364253d2d713b9fcd
6
+ metadata.gz: '0158753e75e020c5a6e3b2699dc96049cbd1aef1cb87c11754e12f7397fca770b46b4871b92764bb7599370270eeb75e0417e7f4fc77495b2d05cc9031dc86c6'
7
+ data.tar.gz: c4fcf49f6a4ba43487a105b53836360db48b442ff6b805a9364ba9e751b28bd8d671454d977455387dd71cfdeb717f6ce7d8ac8617df6a09ae979351202e27c8
data/Gemfile CHANGED
@@ -7,5 +7,5 @@ gem 'protobuf_nested_struct'
7
7
  gem 'parser'
8
8
  gem 'unparser'
9
9
  gem 'astrolabe'
10
- gem 'google-protobuf', '~> 3.5.1.2'
11
- gem 'activesupport', '~> 5.0'
10
+ gem 'google-protobuf', '= 3.6.1', source: 'https://gem.fury.io/pawelpacana/'
11
+ gem 'activesupport', '~> 5.0'
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
@@ -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)
@@ -63,7 +63,7 @@ module RubyEventStore
63
63
  def streams_of(event_id)
64
64
  streams.select do |_, stream_events|
65
65
  stream_events.any? { |event| event.event_id.eql?(event_id) }
66
- end.map { |name, _| Stream.new(name) }
66
+ end.map { |name, | Stream.new(name) }
67
67
  end
68
68
 
69
69
  private
@@ -27,7 +27,7 @@ module RubyEventStore
27
27
 
28
28
  def when(events, handler)
29
29
  Array(events).each do |event|
30
- @handlers[event] = handler
30
+ handlers[event] = handler
31
31
  end
32
32
 
33
33
  self
@@ -3,9 +3,9 @@ module RubyEventStore
3
3
  class SRecord
4
4
  def self.new(
5
5
  event_id: SecureRandom.uuid,
6
- data: SecureRandom.uuid,
7
- metadata: SecureRandom.uuid,
8
- event_type: SecureRandom.uuid
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: "{ order_id: 3 }")
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("{ order_id: 3 }")
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: "{ request_id: 3 }")
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("{ request_id: 3 }")
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: "{ order_id: 3 }",
663
- metadata: "{ request_id: 4 }",
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("{ request_id: 4 }")
670
- expect(retrieved_event.data).to eq("{ order_id: 3 }")
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, data: "data1", 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: "metadata2", event_type: events[2].event_type),
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, data: "data4", metadata: "metadata4", event_type: "event_type4"),
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
 
@@ -1,3 +1,3 @@
1
1
  module RubyEventStore
2
- VERSION = "0.35.0"
2
+ VERSION = "0.36.0"
3
3
  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.35.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: 2018-12-07 00:00:00.000000000 Z
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
- rubyforge_project:
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