evt-entity_store 2.0.1.0 → 2.0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b71f1e1c2f093591bb20b5a73c6b8c8517264862fa1b8eb19f940f74b7a3a1f9
4
- data.tar.gz: 85dce3592e317251338e1157c186e4a5257a5354e4b42b23bd003fda54f5bc99
3
+ metadata.gz: c559a78d909c0939bcd13d26ebf7208a4c07696a594bff68c70d8d703a9c828c
4
+ data.tar.gz: 253507419b0fc2eca642860e9167851f9ab50eb39ec7563ce5698ad59e3cd8f0
5
5
  SHA512:
6
- metadata.gz: fcd238f40984ccfb785a137d0d24f142dcab1411f1045ccedcf78ce848b5e9a18e69b817ee4648b20ed4736f66fadf12b51a8a0a7f8827b619829fe7e65a63cd
7
- data.tar.gz: dae749095697644b9e240e87db2d63f68527298f347a74d3c4f35d664cb511ac3537f1dec06b73362b76069618a63be2eb33930d1c1586b0ae9efa88ffc46f87
6
+ metadata.gz: 5a60d729734da76a762471e9c7fb84a8b7b10b208b1eb5179e7e2a23ceeb108c7a2c2fbe5adb4ef93cce52bcd086f61ca10da2b2a355749ee27b8793b65ab35d
7
+ data.tar.gz: 37ed50cbcdb955ca2760f1741043fd0c55d2dd6da8486fcbff38d88929761bf99c83b58e3de777a4f6039aeaff667350d5cb0e1dad2ffae93c67f164b65b62f4
@@ -8,6 +8,7 @@ require 'entity_store/controls/version'
8
8
  require 'entity_store/controls/message'
9
9
  require 'entity_store/controls/entity'
10
10
  require 'entity_store/controls/projection'
11
+ require 'entity_store/controls/specifier'
11
12
  require 'entity_store/controls/snapshot_interval'
12
13
  require 'entity_store/controls/snapshot'
13
14
  require 'entity_store/controls/reader'
@@ -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, reader_batch_size: nil)
5
- if category.nil? && entity_class.nil? && projection_class.nil? && reader_class.nil? && snapshot_class.nil? && snapshot_interval.nil? && reader_batch_size.nil?
4
+ def self.example(category: nil, entity_class: nil, projection_class: nil, reader_class: nil, snapshot_class: nil, snapshot_interval: nil, reader_batch_size: nil, specifier: nil)
5
+ if category.nil? && entity_class.nil? && projection_class.nil? && reader_class.nil? && snapshot_class.nil? && snapshot_interval.nil? && reader_batch_size.nil? && specifier.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, reader_batch_size: reader_batch_size)
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, reader_batch_size: reader_batch_size, specifier: specifier)
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, reader_batch_size: nil)
15
+ def self.example_class(category: nil, entity_class: nil, projection_class: nil, reader_class: nil, snapshot_class: nil, snapshot_interval: nil, reader_batch_size: nil, specifier: nil)
16
16
  if category == :none
17
17
  category = nil
18
18
  else
@@ -43,6 +43,12 @@ module EntityStore
43
43
  reader_batch_size ||= Controls::Reader::BatchSize.example
44
44
  end
45
45
 
46
+ if specifier == :none
47
+ specifier = nil
48
+ else
49
+ specifier ||= Controls::Specifier.example
50
+ end
51
+
46
52
  Class.new do
47
53
  include ::EntityStore
48
54
 
@@ -54,6 +60,10 @@ module EntityStore
54
60
  unless snapshot_class.nil?
55
61
  snapshot snapshot_class, interval: snapshot_interval
56
62
  end
63
+
64
+ unless specifier.nil?
65
+ specifier specifier
66
+ end
57
67
  end
58
68
  end
59
69
 
@@ -64,6 +74,22 @@ module EntityStore
64
74
  :some_category
65
75
  end
66
76
  end
77
+
78
+ module NoCategory
79
+ def self.example(category=nil)
80
+ category ||= Category.example
81
+
82
+ Example.build(category: category)
83
+ end
84
+
85
+ class Example
86
+ include ::EntityStore
87
+
88
+ entity Controls::Entity::Example
89
+ projection Controls::Projection::Example
90
+ reader Controls::Reader::Example
91
+ end
92
+ end
67
93
  end
68
94
  end
69
95
  end
@@ -0,0 +1,5 @@
1
+ module EntityStore
2
+ module Controls
3
+ Specifier = EntityCache::Controls::Specifier
4
+ end
5
+ end
@@ -25,32 +25,42 @@ module EntityStore
25
25
 
26
26
  configure :store
27
27
 
28
- virtual :category
28
+ attr_accessor :category
29
+
29
30
  virtual :reader_class
30
31
  virtual :projection_class
31
32
  virtual :reader_batch_size
32
33
  virtual :snapshot_class
33
34
  virtual :snapshot_interval
35
+ virtual :specifier
36
+
37
+ virtual :configure
34
38
 
35
39
  extend Build
36
40
  extend EntityMacro
37
41
  extend ProjectionMacro
38
42
  extend ReaderMacro
39
43
  extend SnapshotMacro
44
+ extend SpecifierMacro
40
45
  end
41
46
  end
42
47
 
43
48
  module Build
44
- def build(snapshot_interval: nil, session: nil)
49
+ def build(category: nil, specifier: nil, snapshot_interval: nil, session: nil)
45
50
  instance = new
46
51
 
47
- Build.assure(instance)
48
-
52
+ instance.category = category
49
53
  instance.session = session
50
54
 
55
+ instance.configure
56
+
57
+ Build.assure(instance)
58
+
59
+ specifier ||= instance.specifier
51
60
  EntityCache.configure(
52
61
  instance,
53
62
  entity_class,
63
+ specifier,
54
64
  persist_interval: instance.snapshot_interval,
55
65
  external_store: instance.snapshot_class,
56
66
  external_store_session: session,
@@ -249,4 +259,13 @@ module EntityStore
249
259
  end
250
260
  alias_method :snapshot, :snapshot_macro
251
261
  end
262
+
263
+ module SpecifierMacro
264
+ def specifier_macro(specifier)
265
+ define_method :specifier do
266
+ specifier
267
+ end
268
+ end
269
+ alias_method :specifier, :specifier_macro
270
+ end
252
271
  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: 2.0.1.0
4
+ version: 2.0.3.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: 2020-10-23 00:00:00.000000000 Z
11
+ date: 2020-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-entity_projection
@@ -70,6 +70,7 @@ files:
70
70
  - lib/entity_store/controls/record.rb
71
71
  - lib/entity_store/controls/snapshot.rb
72
72
  - lib/entity_store/controls/snapshot_interval.rb
73
+ - lib/entity_store/controls/specifier.rb
73
74
  - lib/entity_store/controls/stream_name.rb
74
75
  - lib/entity_store/controls/version.rb
75
76
  - lib/entity_store/entity_store.rb
@@ -94,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  - !ruby/object:Gem::Version
95
96
  version: '0'
96
97
  requirements: []
97
- rubygems_version: 3.1.2
98
+ rubygems_version: 3.1.4
98
99
  signing_key:
99
100
  specification_version: 4
100
101
  summary: Project and cache entities from event streams, with optional on-disk snapshotting