evt-entity_store 2.0.1.2 → 2.0.3.1

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: 57ab18812c931b8da668a0c9a7dd3aaa8db1392a266e9d3a7cecf1e2096d8cea
4
- data.tar.gz: d9d818a63ca6a571ad3ae167a7802123eb78d7c1228f4010e6758acbbfbc88df
3
+ metadata.gz: 491ae82f254dd60d09f42952e9787d8bade2783966e8e57d9d8e89b60ded9f88
4
+ data.tar.gz: ee505308f7395f98cf3d19e7abfa4e4b5adaece43f1592991be0cf8905910588
5
5
  SHA512:
6
- metadata.gz: 4328d135a7c40e942f5d7998f02336d4b137ce30a4bb0b14f28fded1accd0f733847b0ce4c1c32a554c0a20c8a4189ff96761f503133bdf5c690c167d0dc900d
7
- data.tar.gz: 39a8188fa464fc97fff4547333f8014b7b7e63b33df3f1e3647795c5db4df8f909ff58dacea09e80c57c0e1cb6ac27b8c3687d6058c684a4a97b2ddd690a3bec
6
+ metadata.gz: 7c4011da0e663ab309e8ca8ee1f706f62404e5121b7b8d0a44ecb3418e3ce718366bb93dda1ad3ff5ece93d8df62e99b8e60d431a2e0f2d990e6c727416f4dca
7
+ data.tar.gz: 799a8a65e4174d186585fbfb7095f0c2e3397ae72078f12bf0050ca009421f72e7f09ae7ee6b7f20a14d4d9a4af3ffa0684e1659985f75d0a1226a3dc95828b7
@@ -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,7 +25,9 @@ module EntityStore
25
25
 
26
26
  configure :store
27
27
 
28
- virtual :category
28
+ attr_accessor :category
29
+ attr_accessor :specifier
30
+
29
31
  virtual :reader_class
30
32
  virtual :projection_class
31
33
  virtual :reader_batch_size
@@ -39,28 +41,34 @@ module EntityStore
39
41
  extend ProjectionMacro
40
42
  extend ReaderMacro
41
43
  extend SnapshotMacro
44
+ extend SpecifierMacro
42
45
  end
43
46
  end
44
47
 
45
48
  module Build
46
- def build(snapshot_interval: nil, session: nil)
49
+ def build(category: nil, specifier: nil, snapshot_interval: nil, session: nil)
47
50
  instance = new
48
51
 
52
+ instance.category = category
53
+ instance.session = session
54
+
55
+ instance.configure
56
+
49
57
  Build.assure(instance)
50
58
 
51
- instance.session = session
59
+ instance.specifier = specifier unless specifier.nil?
60
+ specifier ||= instance.specifier
52
61
 
53
62
  EntityCache.configure(
54
63
  instance,
55
64
  entity_class,
65
+ specifier,
56
66
  persist_interval: instance.snapshot_interval,
57
67
  external_store: instance.snapshot_class,
58
68
  external_store_session: session,
59
69
  attr_name: :cache
60
70
  )
61
71
 
62
- instance.configure
63
-
64
72
  instance
65
73
  end
66
74
 
@@ -253,4 +261,13 @@ module EntityStore
253
261
  end
254
262
  alias_method :snapshot, :snapshot_macro
255
263
  end
264
+
265
+ module SpecifierMacro
266
+ def specifier_macro(specifier)
267
+ define_method :specifier do
268
+ @specifier ||= specifier
269
+ end
270
+ end
271
+ alias_method :specifier, :specifier_macro
272
+ end
256
273
  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.2
4
+ version: 2.0.3.1
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-11-09 00:00:00.000000000 Z
11
+ date: 2020-12-08 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