rails_event_store_active_record 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: 59b83027b23ccefa0ac0b2c79c427dca6b854cb0cdc6ea1cd06a9674425f040e
4
- data.tar.gz: 5ffcfd146c106245182cf7ec3bfc69dfc6a38d92c7dc37e210938d163771fa9d
3
+ metadata.gz: be2fa0a40666550f83e60d9cde65afd203adda7ddfe3b2ddfc10f4a40b3d2f7c
4
+ data.tar.gz: 984a66dfcc41eb22f381c31847a00a3c293a7c473a1194a815ad18d2b1f0e02f
5
5
  SHA512:
6
- metadata.gz: 2cd6f0ada45ea797f937331bc5334e61ebce36ad222331266446fae32ba6fec654bf2407c6e82e50716f399b491b180c250ec99c5065e66f05d4e15a856bfc0d
7
- data.tar.gz: adb1e74e60014f1d1cf6b82b142b42cfed6fa402e3c3de0f706fb48b345cdf9b052dbd765adfd899af33bd76d3e5bca1a572102eb1d95ab0e937fcd862999546
6
+ metadata.gz: dc619c9cb1e08eecdc01405e4ccac57dd4eebe9ec5f27dbf361152037b16a20fe3de9d4bba85353f06a26cb7a0fe82e0cbb1d975512293981b0f63727873e5f0
7
+ data.tar.gz: 2299a41ee513892de0f3879564412c2a08f5e0cdbd914c2689d3a44ce6d68c75761a7f6bb1e9ba80b013950f1df97974b15c38868b9f2a0ccd542d71c84cc5e9
@@ -22,6 +22,7 @@ module RailsEventStoreActiveRecord
22
22
  raise RubyEventStore::EventNotFound.new(event_id)
23
23
  end
24
24
 
25
+
25
26
  def read(spec)
26
27
  raise RubyEventStore::ReservedInternalName if spec.stream_name.eql?(EventRepository::SERIALIZED_GLOBAL_STREAM_NAME)
27
28
 
@@ -31,11 +32,20 @@ module RailsEventStoreActiveRecord
31
32
  stream = stream.where(start_condition(spec)) unless spec.head?
32
33
  stream = stream.order(id: order(spec.direction))
33
34
 
34
- stream.map(&method(:build_event_instance)).each
35
+ if spec.batched?
36
+ batch_reader = ->(offset, limit) { stream.offset(offset).limit(limit).map(&method(:build_event_instance)) }
37
+ RubyEventStore::BatchEnumerator.new(spec.batch_size, total_limit(spec), batch_reader).each
38
+ else
39
+ stream.map(&method(:build_event_instance)).each
40
+ end
35
41
  end
36
42
 
37
43
  private
38
44
 
45
+ def total_limit(specification)
46
+ specification.limit? ? specification.count : Float::INFINITY
47
+ end
48
+
39
49
  def normalize_stream_name(specification)
40
50
  specification.global_stream? ? EventRepository::SERIALIZED_GLOBAL_STREAM_NAME : specification.stream_name
41
51
  end
@@ -1,3 +1,3 @@
1
1
  module RailsEventStoreActiveRecord
2
- VERSION = "0.29.0"
2
+ VERSION = "0.30.0"
3
3
  end
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency 'childprocess'
38
38
  spec.add_development_dependency 'google-protobuf', '~> 3.5.1.2'
39
39
 
40
- spec.add_dependency 'ruby_event_store', '= 0.29.0'
40
+ spec.add_dependency 'ruby_event_store', '= 0.30.0'
41
41
  spec.add_dependency 'activesupport', '>= 3.0'
42
42
  spec.add_dependency 'activemodel', '>= 3.0'
43
43
  spec.add_dependency 'activerecord-import', '~> 0.21'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_event_store_active_record
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
  - Arkency
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
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: 0.29.0
173
+ version: 0.30.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - '='
179
179
  - !ruby/object:Gem::Version
180
- version: 0.29.0
180
+ version: 0.30.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: activesupport
183
183
  requirement: !ruby/object:Gem::Requirement