scrivito_sdk 1.4.1 → 1.4.2

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
  SHA1:
3
- metadata.gz: f89019184f21b4bdfa167ae1a20c755a41bd7094
4
- data.tar.gz: e2e24931a530ee482d43383a014fb9aff47fcb32
3
+ metadata.gz: 7d05fe28646563318dacb38147e10bf7643f4797
4
+ data.tar.gz: 1130736dde1f78f4deee7bed4df6f88450093610
5
5
  SHA512:
6
- metadata.gz: 13376090043889af634c6085c5d0751c2cfcb29a4127656001f98b7f573fed3923641097592a832a78701825bf1f30bc8706ff9c2ba5355564738725732ec819
7
- data.tar.gz: cf8f20a0c9ce6b03146acd51870c93b07d51b05233b6132c327de4dfb7bc98bdb1bc0f71e814689b8ccf7a81e948f93c3174de973bcfb7029911e198d0303d52
6
+ metadata.gz: ed8fbee9c8690874f06054054d40a6113af665af9dce485374e7e1e29f50db15cc5032ee27ed6a262270237a75e687f42c0dc9a312b1a845363d231527081a53
7
+ data.tar.gz: 695b9073a9277664139d183f23ba02db241bbdb01150f38f8ce5840aae3aeb92fcfe7534105cefecab4fc4a0718b28079790c401b7825e5430760143f4519541
data/config/ca-bundle.crt CHANGED
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  ## Bundle of CA Root Certificates
3
3
  ##
4
- ## Certificate data from Mozilla as of: Fri Jul 8 12:28:41 2016
4
+ ## Certificate data from Mozilla as of: Fri Jul 8 13:40:02 2016
5
5
  ##
6
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
@@ -64,16 +64,26 @@ class ContentStateNode < Struct.new(:content_state_id)
64
64
 
65
65
  # the most recent nodes are considered unstable,
66
66
  # since they may "disappear" from the tree when nodes are compacted.
67
- # nodes without predecessor are always considered stable, since they
68
- # cannot be compacted.
69
67
  def next_stable_node
70
- predecessor || self
68
+ if compactable?
69
+ predecessor
70
+ else
71
+ self
72
+ end
71
73
  end
72
74
 
73
75
  private
74
76
 
77
+ # nodes without predecessor cannot be compacted, by definition.
78
+ # nodes with changes that can no longer be expanded also aren't compacted de-facto,
79
+ # since it's no longer possible to update outdated query results.
80
+ def compactable?
81
+ predecessor && ObjDataCache.expand_changes_index(changes)
82
+ end
83
+ memoize :compactable?
84
+
75
85
  def write_successor(successor_content_state_id, successor_changes)
76
- if predecessor
86
+ if compactable?
77
87
  # try to built a compacted node,
78
88
  # i.e. create a new node by mering the new changes and the
79
89
  # changes from this node (similar to git "squashing" commits)
@@ -41,6 +41,15 @@ module ObjDataCache
41
41
  Hash[obj_ids.zip(tags)]
42
42
  end
43
43
 
44
+ # accepts a "change index" (id --> tag), looks up each
45
+ # tag in the cache and return an "expanded index" (id --> data).
46
+ # return `nil` if any tag cannot be found in the cache.
47
+ def self.expand_changes_index(change_index)
48
+ # using "merge(self)" to map over a hash
49
+ change_index.merge(change_index) do |id, tag|
50
+ CmsDataCache.read_data_from_tag(tag) or return nil
51
+ end
52
+ end
44
53
 
45
54
  class SimpleCacheView < Struct.new(:cache_id)
46
55
 
@@ -98,7 +107,7 @@ module ObjDataCache
98
107
 
99
108
  return nil unless updated_result
100
109
 
101
- if cached_at != stable_csid
110
+ unless recent?(cached_at)
102
111
  write_cache_updatable(index, key, updated_result)
103
112
  end
104
113
 
@@ -137,7 +146,7 @@ module ObjDataCache
137
146
 
138
147
  return nil unless updated_tag
139
148
 
140
- if cached_at != stable_csid
149
+ unless recent?(cached_at)
141
150
  write_cache_updatable("id", id, updated_tag)
142
151
  end
143
152
 
@@ -155,7 +164,17 @@ module ObjDataCache
155
164
 
156
165
  private
157
166
 
167
+ # is the given csid reachable with at most one ContentStateNode traversal?
168
+ def recent?(csid)
169
+ return true if csid == viewed_state.content_state_id
170
+
171
+ predecessor = viewed_state.predecessor
172
+
173
+ predecessor && csid == predecessor.content_state_id
174
+ end
175
+
158
176
  def write_cache_updatable(index, key, data, **options)
177
+ stable_csid = viewed_state.next_stable_node.content_state_id
159
178
  write_cache(index, key, stable_csid, data, **options)
160
179
  end
161
180
 
@@ -177,28 +196,13 @@ module ObjDataCache
177
196
 
178
197
  return nil if change_index == ContentStateNode::CACHE_MISS
179
198
 
180
- expanded_index = expand_index(change_index)
199
+ expanded_index = ObjDataCache.expand_changes_index(change_index)
181
200
 
182
201
  # if the data of changed objs was evicted, treat as cache-miss
183
202
  return nil if !expanded_index
184
203
 
185
204
  update_function.call(key, cached_result, expanded_index)
186
205
  end
187
-
188
- # accepts a "change index" (id --> tag), looks up each
189
- # tag in the cache and return an "expanded index" (id --> data).
190
- # return `nil` if any tag cannot be found in the cache.
191
- def expand_index(change_index)
192
- # using "merge(self)" to map over a hash
193
- change_index.merge(change_index) do |id, tag|
194
- CmsDataCache.read_data_from_tag(tag) or return nil
195
- end
196
- end
197
-
198
- def stable_csid
199
- viewed_state.next_stable_node.content_state_id
200
- end
201
-
202
206
  end
203
207
 
204
208
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infopark AG