evt-entity_cache 2.0.1.0 → 2.0.1.3

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: bcdf7aa3489308ed84b73822573806208b675aa88a696234b8a883c0eda03cc2
4
- data.tar.gz: 04c895524f043e2092a4853a478ebfb61ba73de99f616fe564e975a0d36d1623
3
+ metadata.gz: 7759181c081a330787ff8a1814fc4c0b4ad3bfb3b38e8999645b9a8ffefda048
4
+ data.tar.gz: 1d78748e6a63819b47ed9e664531dde507aa625c60fe2011c5ce5bcf6f655e42
5
5
  SHA512:
6
- metadata.gz: c54ed18483b733b23872f2237f6d694e6b9e7dc373b602a08b9166f827e48a0b29983f4c5c25aa9c52bd9098798138b3fcca22b32eee2924698727b751fbe541
7
- data.tar.gz: e017489372a170d34d6d616daffa67a736847e537b425730a36c7601fa753dd3117ee3e580efb3d54ae7999efa8b09fc6ccb42aa618cdb8a86398533591cd5fe
6
+ metadata.gz: a383073e76be1168f8c79dc77f96d51aee274f7c4f6f9b105fccd8425edf33a2bdc3bf47b2070ae8d2bc5800361e9a0ba0d2974c0d3db5f735242246faf5df7c
7
+ data.tar.gz: 759685cd2c54a78cd0c9fe3a8083f92cef28f7b9b6bc551b677987fdf289dc71c30f20f07033b17a10130a2d6312df9b064294d7ba0849bff910b9ca6a007230
@@ -18,7 +18,11 @@ class EntityCache
18
18
 
19
19
  text = File.read(path)
20
20
 
21
- entity, version, time = YAML.load(text)
21
+ entity_data, version, time_iso8601 = JSON.parse(text, symbolize_names: true)
22
+
23
+ entity = Entity::Example.new(*entity_data)
24
+
25
+ time = Clock.parse(time_iso8601)
22
26
 
23
27
  return entity, version, time
24
28
  end
@@ -26,7 +30,19 @@ class EntityCache
26
30
  def put(id, entity, version, time)
27
31
  path = path(id)
28
32
 
29
- text = YAML.dump([entity, version, time])
33
+ entity_data = Transform::Write.raw_data(entity)
34
+
35
+ time_iso8601 = Clock.iso8601(time)
36
+
37
+ data = [
38
+ entity_data,
39
+ version,
40
+ time_iso8601
41
+ ]
42
+
43
+ text = JSON.generate(data)
44
+
45
+ FileUtils.mkdir_p(External.file_dump_directory)
30
46
 
31
47
  File.write(path, text)
32
48
  end
@@ -41,11 +57,13 @@ class EntityCache
41
57
 
42
58
  filename = "#{subject.to_s.gsub('/', '-')}-#{id}.yaml"
43
59
 
44
- File.join(tmpdir, filename)
60
+ full_name = File.join(file_dump_directory, filename)
61
+
62
+ full_name
45
63
  end
46
64
 
47
- def self.tmpdir
48
- @tmpdir ||= Dir.tmpdir
65
+ def self.file_dump_directory
66
+ "tmp"
49
67
  end
50
68
  end
51
69
  end
@@ -6,11 +6,18 @@ class EntityCache
6
6
  def self.call
7
7
  subject = Subject.example
8
8
 
9
- text = YAML.dump([
10
- Controls::Entity.example,
9
+ entity = Controls::Entity.example
10
+ entity_data = Transform::Write.raw_data(entity)
11
+
12
+ persisted_time_iso8601 = Controls::Record.persisted_time.iso8601(5)
13
+
14
+ data = [
15
+ entity_data,
11
16
  Controls::Record.persisted_version,
12
- Controls::Record.persisted_time
13
- ])
17
+ persisted_time_iso8601
18
+ ]
19
+
20
+ text = JSON.generate(data)
14
21
 
15
22
  path = External.path(subject)
16
23
 
@@ -1,5 +1,5 @@
1
- require 'yaml'
2
- require 'tmpdir'
1
+ require 'json'
2
+ require 'fileutils'
3
3
 
4
4
  require 'clock/controls'
5
5
  require 'identifier/uuid/controls'
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: 2.0.1.0
4
+ version: 2.0.1.3
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-12-01 00:00:00.000000000 Z
11
+ date: 2022-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-configure
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  requirements: []
144
- rubygems_version: 3.1.2
144
+ rubygems_version: 3.3.3
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Cache of entities retrieved by an entity-store, with in-memory temporary