evt-entity_store 0.5.1.2 → 0.5.2.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: 0edc80801e0f92582d85c0d5b81cdf90bd31988374d84cc5f576d7db9577369e
4
- data.tar.gz: a8375ce490f2045e9d4a590c3d65af2355a0394197af02e41f8c68e65a37fc8c
3
+ metadata.gz: 3359fa5dd052a74428407f308b618ec2945a38bc2cca349d696a35fd8a6e25c0
4
+ data.tar.gz: 4263259ead64037127322e482606405ae9b538c6da60e0bf67e933660cdaec5b
5
5
  SHA512:
6
- metadata.gz: 7a887bb44958d53113ff4151896b150f26773f5269a95dbeab5d2d675845a64ffee6776b0c577bb6aa45426d01bcac87aad5433c4e22b496362a7a66eda9f978
7
- data.tar.gz: 9ef18707eda811d90025ac7ce50895f9622d06d404fa48c8e2c68d7bfdec67fe1b5f35fbc419b2cf6abd7a0121a9312fc6ebfa2f1b3991e3a32d8b8a2aeda575
6
+ metadata.gz: b5125e5bd2bb5fd2b680ae48612cf884932ae93871e1062b6274a27b583584770180b80d73abd5b9359ce218c46e6bcf6427de63de4267ad979228066f9aa2f6
7
+ data.tar.gz: bb1beec625b1e412c5d68bf09caa03b47babb02078aaebb5c85da86b8d106bcea7de32f821384cb46ce451fb1e81d9d50876dedf43934fe350a03e0db2fbb850
@@ -1,18 +1,18 @@
1
1
  module EntityStore
2
2
  module Controls
3
3
  module EntityStore
4
- def self.example(category: nil, entity_class: nil, projection_class: nil, reader_class: nil, snapshot_class: nil, snapshot_interval: nil, snapshot_interval_keyword: nil)
5
- if category.nil? && entity_class.nil? && projection_class.nil? && reader_class.nil? && snapshot_class.nil? && snapshot_interval.nil? && snapshot_interval_keyword.nil?
4
+ def self.example(category: nil, entity_class: nil, projection_class: nil, reader_class: nil, snapshot_class: nil, snapshot_interval: nil, snapshot_interval_keyword: nil, reader_batch_size: nil)
5
+ if category.nil? && entity_class.nil? && projection_class.nil? && reader_class.nil? && snapshot_class.nil? && snapshot_interval.nil? && snapshot_interval_keyword.nil? && reader_batch_size.nil?
6
6
  store_class = Example
7
7
  else
8
- store_class = example_class(category: category, entity_class: entity_class, projection_class: projection_class, reader_class: reader_class, snapshot_class: snapshot_class, snapshot_interval: snapshot_interval, snapshot_interval_keyword: snapshot_interval_keyword)
8
+ store_class = example_class(category: category, entity_class: entity_class, projection_class: projection_class, reader_class: reader_class, snapshot_class: snapshot_class, snapshot_interval: snapshot_interval, snapshot_interval_keyword: snapshot_interval_keyword, reader_batch_size: reader_batch_size)
9
9
  end
10
10
 
11
11
  instance = store_class.build
12
12
  instance
13
13
  end
14
14
 
15
- def self.example_class(category: nil, entity_class: nil, projection_class: nil, reader_class: nil, snapshot_class: nil, snapshot_interval: nil, snapshot_interval_keyword: nil)
15
+ def self.example_class(category: nil, entity_class: nil, projection_class: nil, reader_class: nil, snapshot_class: nil, snapshot_interval: nil, snapshot_interval_keyword: nil, reader_batch_size: nil)
16
16
  if category == :none
17
17
  category = nil
18
18
  else
@@ -37,13 +37,19 @@ module EntityStore
37
37
  reader_class ||= Controls::Reader::Example
38
38
  end
39
39
 
40
+ if reader_batch_size == :none
41
+ reader_batch_size = nil
42
+ else
43
+ reader_batch_size ||= Controls::Reader::BatchSize.example
44
+ end
45
+
40
46
  Class.new do
41
47
  include ::EntityStore
42
48
 
43
49
  category category
44
50
  entity entity_class
45
51
  projection projection_class
46
- reader reader_class
52
+ reader reader_class, batch_size: reader_batch_size
47
53
 
48
54
  unless snapshot_class.nil?
49
55
  if snapshot_interval_keyword.nil?
@@ -8,6 +8,12 @@ module EntityStore
8
8
  class Example
9
9
  include MessageStore::Read
10
10
  end
11
+
12
+ module BatchSize
13
+ def self.example
14
+ 11
15
+ end
16
+ end
11
17
  end
12
18
  end
13
19
  end
@@ -28,6 +28,7 @@ module EntityStore
28
28
  virtual :category
29
29
  virtual :reader_class
30
30
  virtual :projection_class
31
+ virtual :reader_batch_size
31
32
  virtual :snapshot_class
32
33
  virtual :snapshot_interval
33
34
 
@@ -121,7 +122,7 @@ module EntityStore
121
122
  project = projection_class.build(entity)
122
123
 
123
124
  logger.trace(tag: :store) { "Reading (Stream Name: #{stream_name}, Position: #{current_position}" }
124
- reader_class.(stream_name, position: start_position, session: session) do |event_data|
125
+ reader_class.(stream_name, position: start_position, batch_size: reader_batch_size, session: session) do |event_data|
125
126
  project.(event_data)
126
127
  current_position = event_data.position
127
128
 
@@ -206,10 +207,14 @@ module EntityStore
206
207
  end
207
208
 
208
209
  module ReaderMacro
209
- def reader_macro(cls)
210
+ def reader_macro(cls, batch_size: nil)
210
211
  define_method :reader_class do
211
212
  cls
212
213
  end
214
+
215
+ define_method :reader_batch_size do
216
+ batch_size
217
+ end
213
218
  end
214
219
  alias_method :reader, :reader_macro
215
220
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-entity_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1.2
4
+ version: 0.5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-09 00:00:00.000000000 Z
11
+ date: 2018-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-entity_projection