ruby_event_store-rom 0.29.0 → 0.30.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: 3f662a3c1d64a91f7bfeb654f9a41ae41a204fd9f4f04df206b25679456a8076
4
- data.tar.gz: afe59068d764dd1cce75ba6daa61787d5974ffa3f8766be5c2709c4a4c3bec17
3
+ metadata.gz: 3f2cadf18b1a9e4c39002fd8d23c4d2b44a96f784eb4789d1e3faa972f3353af
4
+ data.tar.gz: 259cdfd63aa4f52aeee63d5d1b0dbfc86f4d669f5a7794743c127d0b5f2b9767
5
5
  SHA512:
6
- metadata.gz: 34a6fd44ec91535584b1fceaac45389fa875901a25284da7304cb82b822677cfb640c5d02818b68b56225481d0281ca7f0acea7264f34ccededdd7d26a75a6ea
7
- data.tar.gz: a1f7c89e778600b8313d566031536ca7f80267d55c9ba8b376d854f15ee518b005a4df6b3845db9a610976ebbbe10739b170631be9e73050a2a9e0b19e1d92dd
6
+ metadata.gz: e42552f06a8d409406f046385e70e4296048396bbe47d126b36d90280d41d50a62293d60e9ffc86bc8f7653a93118a13e615f46f941ba1b7e8a41189ee110c98
7
+ data.tar.gz: 123ec9e8fafb080c5e48300b7f94c87a2c15a99bdf9cf898572767a43ffdd4ada396e87aa7621ed449df176ec0a6791954488f8fc0884dac0d711dd209ba1ab4
@@ -55,12 +55,13 @@ module RubyEventStore
55
55
  end
56
56
 
57
57
  def last_stream_event(stream)
58
- Specification.new(self)
59
- .stream(stream.name)
60
- .limit(1)
61
- .backward
62
- .each
63
- .first
58
+ @events.read(
59
+ :backward,
60
+ stream,
61
+ from: :head,
62
+ limit: 1,
63
+ batch_size: nil
64
+ ).first
64
65
  end
65
66
 
66
67
  def read_event(event_id)
@@ -76,7 +77,8 @@ module RubyEventStore
76
77
  specification.direction,
77
78
  specification.stream,
78
79
  from: specification.start,
79
- limit: (specification.count if specification.limit?)
80
+ limit: (specification.count if specification.limit?),
81
+ batch_size: (specification.batch_size if specification.batched?)
80
82
  )
81
83
  end
82
84
 
@@ -30,22 +30,35 @@ module RubyEventStore
30
30
  def exist?(event_id)
31
31
  events.by_pk(event_id).exist?
32
32
  end
33
-
33
+
34
34
  def by_id(event_id)
35
35
  events.map_with(:event_to_serialized_record).by_pk(event_id).one!
36
36
  end
37
37
 
38
- def read(direction, stream, from:, limit:)
38
+ def read(direction, stream, from:, limit:, batch_size:)
39
39
  unless from.equal?(:head)
40
40
  offset_entry_id = stream_entries.by_stream_and_event_id(stream, from).fetch(:id)
41
41
  end
42
-
43
- stream_entries
44
- .ordered(direction, stream, offset_entry_id)
45
- .take(limit)
46
- .combine(:event)
47
- .map_with(:stream_entry_to_serialized_record) # Add `auto_struct: false` for Memory adapter
48
- .each
42
+
43
+ if batch_size
44
+ reader = ->(offset, limit) do
45
+ stream_entries
46
+ .ordered(direction, stream, offset_entry_id)
47
+ .offset(offset)
48
+ .take(limit)
49
+ .combine(:event)
50
+ .map_with(:stream_entry_to_serialized_record) # Add `auto_struct: false` for Memory adapter
51
+ .to_ary
52
+ end
53
+ BatchEnumerator.new(batch_size, limit || Float::INFINITY, reader).each
54
+ else
55
+ stream_entries
56
+ .ordered(direction, stream, offset_entry_id)
57
+ .take(limit)
58
+ .combine(:event)
59
+ .map_with(:stream_entry_to_serialized_record) # Add `auto_struct: false` for Memory adapter
60
+ .each
61
+ end
49
62
  end
50
63
  end
51
64
  end
@@ -1,5 +1,5 @@
1
1
  module RubyEventStore
2
2
  module ROM
3
- VERSION = "0.29.0"
3
+ VERSION = "0.30.0"
4
4
  end
5
5
  end
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency 'childprocess'
37
37
  spec.add_development_dependency 'google-protobuf', '~> 3.5.1.2'
38
38
 
39
- spec.add_dependency 'ruby_event_store', '= 0.29.0'
39
+ spec.add_dependency 'ruby_event_store', '= 0.30.0'
40
40
  spec.add_dependency 'sequel', '>= 4.49'
41
41
  spec.add_dependency 'rom-sql', '~> 2.4'
42
42
  spec.add_dependency 'rom-repository', '~> 2.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_event_store-rom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.0
4
+ version: 0.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Van Horn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-06 00:00:00.000000000 Z
11
+ date: 2018-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - '='
158
158
  - !ruby/object:Gem::Version
159
- version: 0.29.0
159
+ version: 0.30.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - '='
165
165
  - !ruby/object:Gem::Version
166
- version: 0.29.0
166
+ version: 0.30.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: sequel
169
169
  requirement: !ruby/object:Gem::Requirement