evt-entity_cache 0.14.0.1 → 0.15.0.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
  SHA1:
3
- metadata.gz: 3014f3bc8543059ba7f26b57e2f8cd0963906a6a
4
- data.tar.gz: 7acbff224fdc2ff7b6e75c6779a7cb4668e7c082
3
+ metadata.gz: 0b5634a6a1309c38882809b0e2e30de97aa97025
4
+ data.tar.gz: f66490edd1a241eb54567dc15dc5b3bf1236f74e
5
5
  SHA512:
6
- metadata.gz: 1e1f097e2c67571aab3ed85e145ac90bf840f59e7f7f0bf68a19e790f7081290ebfe0ef2bee47d1fb3be3d3229edaefeb8ea95d092d7a199b5929821cde55672
7
- data.tar.gz: 78c4aef2dd3281b1e5e1220aae805477a5a899bbc33ef85539701c9675e7291a345415573837eab6c264bdd78700772a412da86ce0ddccc722916ec3016e6149
6
+ metadata.gz: ba632a148922b525980f03f698bd5b4bb7684229fd948838d53ab4a4b711bd40ecaa92f65751ae78cec7d5db696a18b56e45a1ab298f4e7071254df7c8016447
7
+ data.tar.gz: 6c7549ac4a7eff2202a4d4a87d716f2556f0ebd415fb8e43be0545a11b88d4a0080ec1b1aeb9f0868c6b33a531125663690761385b534db5d0163d1bdd393b5e
@@ -1,9 +1,9 @@
1
1
  class EntityCache
2
2
  module Controls
3
- module Storage
4
- module Persistent
3
+ module Store
4
+ module External
5
5
  class Example
6
- include EntityCache::Store::Persistent
6
+ include EntityCache::Store::External
7
7
 
8
8
  attr_accessor :session
9
9
 
@@ -32,7 +32,7 @@ class EntityCache
32
32
  end
33
33
 
34
34
  def path(id)
35
- Persistent.path(subject, id)
35
+ External.path(subject, id)
36
36
  end
37
37
  end
38
38
  end
@@ -1,7 +1,7 @@
1
1
  class EntityCache
2
2
  module Controls
3
- module Storage
4
- module Persistent
3
+ module Store
4
+ module External
5
5
  module NotImplemented
6
6
  def self.example
7
7
  subject = Subject.example
@@ -10,7 +10,7 @@ class EntityCache
10
10
  end
11
11
 
12
12
  class Example
13
- include EntityCache::Store::Persistent
13
+ include EntityCache::Store::External
14
14
  end
15
15
  end
16
16
  end
@@ -1,7 +1,7 @@
1
1
  class EntityCache
2
2
  module Controls
3
- module Storage
4
- module Persistent
3
+ module Store
4
+ module External
5
5
  module Write
6
6
  def self.call
7
7
  subject = Subject.example
@@ -12,7 +12,7 @@ class EntityCache
12
12
  Controls::Record.persisted_time
13
13
  ])
14
14
 
15
- path = Persistent.path(subject)
15
+ path = External.path(subject)
16
16
 
17
17
  File.write(path, text)
18
18
 
@@ -1,7 +1,7 @@
1
1
  class EntityCache
2
2
  module Controls
3
- module Storage
4
- module Persistent
3
+ module Store
4
+ module External
5
5
  def self.example(subject=nil)
6
6
  subject ||= Subject.example
7
7
 
@@ -1,12 +1,12 @@
1
1
  class EntityCache
2
2
  module Controls
3
- module Storage
4
- module Temporary
3
+ module Store
4
+ module Internal
5
5
  def self.example
6
6
  Example.new
7
7
  end
8
8
 
9
- class Example < EntityCache::Store::Temporary
9
+ class Example < EntityCache::Store::Internal
10
10
  def records
11
11
  @records ||= {}
12
12
  end
@@ -13,9 +13,9 @@ require 'entity_cache/controls/version'
13
13
 
14
14
  require 'entity_cache/controls/persist_interval'
15
15
 
16
- require 'entity_cache/controls/storage/persistent'
17
- require 'entity_cache/controls/storage/persistent/example'
18
- require 'entity_cache/controls/storage/persistent/not_implemented'
19
- require 'entity_cache/controls/storage/persistent/write'
16
+ require 'entity_cache/controls/store/external'
17
+ require 'entity_cache/controls/store/external/example'
18
+ require 'entity_cache/controls/store/external/not_implemented'
19
+ require 'entity_cache/controls/store/external/write'
20
20
 
21
- require 'entity_cache/controls/storage/temporary'
21
+ require 'entity_cache/controls/store/internal'
@@ -9,33 +9,33 @@ class EntityCache
9
9
  end
10
10
 
11
11
  dependency :clock, Clock::UTC
12
- dependency :temporary_store, Store::Temporary
13
- dependency :persistent_store, Store::Persistent
12
+ dependency :internal_store, Store::Internal
13
+ dependency :external_store, Store::External
14
14
 
15
- def self.build(subject, scope: nil, persist_interval: nil, persistent_store: nil, persistent_store_session: nil)
15
+ def self.build(subject, scope: nil, persist_interval: nil, external_store: nil, external_store_session: nil)
16
16
  instance = new
17
17
 
18
18
  instance.configure(
19
19
  subject: subject,
20
20
  scope: scope,
21
21
  persist_interval: persist_interval,
22
- persistent_store: persistent_store,
23
- persistent_store_session: persistent_store_session
22
+ external_store: external_store,
23
+ external_store_session: external_store_session
24
24
  )
25
25
 
26
26
  instance
27
27
  end
28
28
 
29
- def configure(subject:, scope: nil, persist_interval: nil, persistent_store: nil, persistent_store_session: nil)
30
- persistent_store ||= Store::Persistent::Null
29
+ def configure(subject:, scope: nil, persist_interval: nil, external_store: nil, external_store_session: nil)
30
+ external_store ||= Store::External::Null
31
31
 
32
32
  unless persist_interval.nil?
33
33
  self.persist_interval = persist_interval
34
34
  end
35
35
 
36
- Store::Temporary.configure(self, subject, scope: scope)
36
+ Store::Internal.configure(self, subject, scope: scope)
37
37
 
38
- persistent_store.configure(self, subject, session: persistent_store_session)
38
+ external_store.configure(self, subject, session: external_store_session)
39
39
 
40
40
  Clock::UTC.configure(self)
41
41
  end
@@ -43,7 +43,7 @@ class EntityCache
43
43
  def get(id)
44
44
  logger.trace { "Get entity (ID: #{id.inspect})" }
45
45
 
46
- record = temporary_store.get(id)
46
+ record = internal_store.get(id)
47
47
 
48
48
  if record.nil?
49
49
  record = restore(id)
@@ -61,26 +61,26 @@ class EntityCache
61
61
  def put(id, entity, version, time: nil, persisted_version: nil, persisted_time: nil)
62
62
  time ||= clock.now
63
63
 
64
- updated_persistent_store = false
64
+ updated_external_store = false
65
65
 
66
66
  record = Record.build(id, entity, version, time)
67
67
 
68
68
  logger.trace { "Put entity (ID: #{id.inspect}, #{Record::LogText.get(record)}, Persist Interval: #{persist_interval.inspect})" }
69
69
 
70
70
  if persist?(version, persisted_version)
71
- persistent_store.put(id, entity, version, time)
71
+ external_store.put(id, entity, version, time)
72
72
 
73
73
  persisted_version = version
74
74
  persisted_time = time
75
- updated_persistent_store = true
75
+ updated_external_store = true
76
76
  end
77
77
 
78
78
  record.persisted_version = persisted_version
79
79
  record.persisted_time = persisted_time
80
80
 
81
- temporary_store.put(record)
81
+ internal_store.put(record)
82
82
 
83
- logger.info { "Put entity done (ID: #{id.inspect}, #{Record::LogText.get(record)}, Persist Interval: #{persist_interval.inspect}, Updated Persistent Store: #{updated_persistent_store})" }
83
+ logger.info { "Put entity done (ID: #{id.inspect}, #{Record::LogText.get(record)}, Persist Interval: #{persist_interval.inspect}, Updated External Store: #{updated_external_store})" }
84
84
 
85
85
  record
86
86
  end
@@ -88,7 +88,7 @@ class EntityCache
88
88
  def restore(id)
89
89
  logger.trace { "Restoring entity (ID: #{id.inspect})" }
90
90
 
91
- entity, version, time = persistent_store.get(id)
91
+ entity, version, time = external_store.get(id)
92
92
 
93
93
  if entity.nil?
94
94
  logger.debug { "Could not restore entity (ID: #{id.inspect})" }
@@ -105,7 +105,7 @@ class EntityCache
105
105
  persisted_time: time
106
106
  )
107
107
 
108
- temporary_store.put(record)
108
+ internal_store.put(record)
109
109
 
110
110
  logger.debug { "Restored entity (ID: #{id.inspect}, #{Record::LogText.get(record)})" }
111
111
 
@@ -1,8 +1,8 @@
1
1
  class EntityCache
2
2
  module Store
3
- module Persistent
3
+ module External
4
4
  class Null
5
- include Store::Persistent
5
+ include Store::External
6
6
 
7
7
  def get(id)
8
8
  end
@@ -1,13 +1,13 @@
1
1
  class EntityCache
2
2
  module Store
3
- module Persistent
3
+ module External
4
4
  module Substitute
5
5
  def self.build
6
- Persistent.build
6
+ External.build
7
7
  end
8
8
 
9
- class Persistent
10
- include Store::Persistent
9
+ class External
10
+ include Store::External
11
11
 
12
12
  attr_accessor :telemetry_sink
13
13
 
@@ -1,6 +1,6 @@
1
1
  class EntityCache
2
2
  module Store
3
- module Persistent
3
+ module External
4
4
  module Telemetry
5
5
  Data = Struct.new(:id, :entity, :version, :time)
6
6
 
@@ -1,6 +1,6 @@
1
1
  class EntityCache
2
2
  module Store
3
- module Persistent
3
+ module External
4
4
  def self.included(cls)
5
5
  cls.class_exec do
6
6
  include Log::Dependency
@@ -8,7 +8,7 @@ class EntityCache
8
8
  extend Build
9
9
  extend RegisterTelemetrySink
10
10
 
11
- configure :persistent_store
11
+ configure :external_store
12
12
 
13
13
  dependency :telemetry, ::Telemetry
14
14
 
@@ -69,9 +69,9 @@ class EntityCache
69
69
  end
70
70
 
71
71
  module RegisterTelemetrySink
72
- def register_telemetry_sink(persistent_store)
72
+ def register_telemetry_sink(external_store)
73
73
  sink = Telemetry::Sink.new
74
- persistent_store.telemetry.register(sink)
74
+ external_store.telemetry.register(sink)
75
75
  sink
76
76
  end
77
77
  end
@@ -1,6 +1,6 @@
1
1
  class EntityCache
2
2
  module Store
3
- class Temporary
3
+ class Internal
4
4
  module Build
5
5
  module Defaults
6
6
  def self.scope
@@ -1,6 +1,6 @@
1
1
  class EntityCache
2
2
  module Store
3
- class Temporary
3
+ class Internal
4
4
  module Build
5
5
  def self.call(subject, scope: nil)
6
6
  scope ||= Defaults.scope
@@ -1,8 +1,8 @@
1
1
  class EntityCache
2
2
  module Store
3
- class Temporary
3
+ class Internal
4
4
  module Scope
5
- class Exclusive < Temporary
5
+ class Exclusive < Internal
6
6
  def records
7
7
  @records ||= {}
8
8
  end
@@ -1,8 +1,8 @@
1
1
  class EntityCache
2
2
  module Store
3
- class Temporary
3
+ class Internal
4
4
  module Scope
5
- class Global < Temporary
5
+ class Global < Internal
6
6
  def records
7
7
  records_by_subject[subject]
8
8
  end
@@ -1,8 +1,8 @@
1
1
  class EntityCache
2
2
  module Store
3
- class Temporary
3
+ class Internal
4
4
  module Scope
5
- class Thread < Temporary
5
+ class Thread < Internal
6
6
  def records
7
7
  records_by_subject[subject]
8
8
  end
@@ -1,12 +1,12 @@
1
1
  class EntityCache
2
2
  module Store
3
- class Temporary
3
+ class Internal
4
4
  module Substitute
5
5
  def self.build
6
- Temporary.new
6
+ Internal.new
7
7
  end
8
8
 
9
- class Temporary < Scope::Exclusive
9
+ class Internal < Scope::Exclusive
10
10
  def add(id, entity, version, time, persisted_version: nil, persisted_time: nil)
11
11
  record = Record.build(
12
12
  id,
@@ -1,6 +1,6 @@
1
1
  class EntityCache
2
2
  module Store
3
- class Temporary
3
+ class Internal
4
4
  include Log::Dependency
5
5
 
6
6
  attr_accessor :subject
@@ -12,7 +12,7 @@ class EntityCache
12
12
  end
13
13
 
14
14
  def self.configure(receiver, subject, scope: nil, attr_name: nil)
15
- attr_name ||= :temporary_store
15
+ attr_name ||= :internal_store
16
16
 
17
17
  instance = Build.(subject, scope: scope)
18
18
  receiver.public_send("#{attr_name}=", instance)
@@ -24,7 +24,7 @@ class EntityCache
24
24
  persisted_time: persisted_time
25
25
  )
26
26
 
27
- temporary_store.put(record)
27
+ internal_store.put(record)
28
28
  end
29
29
 
30
30
  def put(id, entity, version, time: nil, persisted_version: nil, persisted_time: nil)
data/lib/entity_cache.rb CHANGED
@@ -12,18 +12,18 @@ require 'entity_cache/record/destructure'
12
12
  require 'entity_cache/record/log_text'
13
13
  require 'entity_cache/record/transformer'
14
14
 
15
- require 'entity_cache/store/persistent'
16
- require 'entity_cache/store/persistent/null'
17
- require 'entity_cache/store/persistent/substitute'
18
- require 'entity_cache/store/persistent/telemetry'
15
+ require 'entity_cache/store/external'
16
+ require 'entity_cache/store/external/null'
17
+ require 'entity_cache/store/external/substitute'
18
+ require 'entity_cache/store/external/telemetry'
19
19
 
20
- require 'entity_cache/store/temporary'
21
- require 'entity_cache/store/temporary/build'
22
- require 'entity_cache/store/temporary/build/defaults'
23
- require 'entity_cache/store/temporary/scope/exclusive'
24
- require 'entity_cache/store/temporary/scope/global'
25
- require 'entity_cache/store/temporary/scope/thread'
26
- require 'entity_cache/store/temporary/substitute'
20
+ require 'entity_cache/store/internal'
21
+ require 'entity_cache/store/internal/build'
22
+ require 'entity_cache/store/internal/build/defaults'
23
+ require 'entity_cache/store/internal/scope/exclusive'
24
+ require 'entity_cache/store/internal/scope/global'
25
+ require 'entity_cache/store/internal/scope/thread'
26
+ require 'entity_cache/store/internal/substitute'
27
27
 
28
28
  require 'entity_cache/entity_cache'
29
29
  require 'entity_cache/substitute'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-entity_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0.1
4
+ version: 0.15.0.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: 2017-07-07 00:00:00.000000000 Z
11
+ date: 2017-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-configure
@@ -92,11 +92,11 @@ files:
92
92
  - lib/entity_cache/controls/id.rb
93
93
  - lib/entity_cache/controls/persist_interval.rb
94
94
  - lib/entity_cache/controls/record.rb
95
- - lib/entity_cache/controls/storage/persistent.rb
96
- - lib/entity_cache/controls/storage/persistent/example.rb
97
- - lib/entity_cache/controls/storage/persistent/not_implemented.rb
98
- - lib/entity_cache/controls/storage/persistent/write.rb
99
- - lib/entity_cache/controls/storage/temporary.rb
95
+ - lib/entity_cache/controls/store/external.rb
96
+ - lib/entity_cache/controls/store/external/example.rb
97
+ - lib/entity_cache/controls/store/external/not_implemented.rb
98
+ - lib/entity_cache/controls/store/external/write.rb
99
+ - lib/entity_cache/controls/store/internal.rb
100
100
  - lib/entity_cache/controls/subject.rb
101
101
  - lib/entity_cache/controls/time.rb
102
102
  - lib/entity_cache/controls/version.rb
@@ -107,17 +107,17 @@ files:
107
107
  - lib/entity_cache/record/destructure.rb
108
108
  - lib/entity_cache/record/log_text.rb
109
109
  - lib/entity_cache/record/transformer.rb
110
- - lib/entity_cache/store/persistent.rb
111
- - lib/entity_cache/store/persistent/null.rb
112
- - lib/entity_cache/store/persistent/substitute.rb
113
- - lib/entity_cache/store/persistent/telemetry.rb
114
- - lib/entity_cache/store/temporary.rb
115
- - lib/entity_cache/store/temporary/build.rb
116
- - lib/entity_cache/store/temporary/build/defaults.rb
117
- - lib/entity_cache/store/temporary/scope/exclusive.rb
118
- - lib/entity_cache/store/temporary/scope/global.rb
119
- - lib/entity_cache/store/temporary/scope/thread.rb
120
- - lib/entity_cache/store/temporary/substitute.rb
110
+ - lib/entity_cache/store/external.rb
111
+ - lib/entity_cache/store/external/null.rb
112
+ - lib/entity_cache/store/external/substitute.rb
113
+ - lib/entity_cache/store/external/telemetry.rb
114
+ - lib/entity_cache/store/internal.rb
115
+ - lib/entity_cache/store/internal/build.rb
116
+ - lib/entity_cache/store/internal/build/defaults.rb
117
+ - lib/entity_cache/store/internal/scope/exclusive.rb
118
+ - lib/entity_cache/store/internal/scope/global.rb
119
+ - lib/entity_cache/store/internal/scope/thread.rb
120
+ - lib/entity_cache/store/internal/substitute.rb
121
121
  - lib/entity_cache/substitute.rb
122
122
  homepage: https://github.com/eventide-project/entity-cache
123
123
  licenses: