flok 0.0.96 → 0.0.97
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/kern/services/vm.rb +4 -2
- data/docs/services/vm.md +1 -1
- data/lib/flok/version.rb +1 -1
- data/spec/kern/vm_service_functional_spec.rb +28 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ade07fa602cf88575c37421f1dc72c6e7eef5654
|
4
|
+
data.tar.gz: 0031fbe5dc0571736fa024d894580e9138902ff9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 692911fdab522f9e97e99e880d2078fdcc0ba547c6063fa89641af114b42220d2b23539af9a5f9f91b8a1e6da1194108220fa2150819c131b2256eb66bb61a6c
|
7
|
+
data.tar.gz: 4276ebf5bcc0e1388bda81f2cdb9ed2001642e9907e154caf6d73eec86fba5b04e6d85d0dda5f418602bf654abfb5cf01f9784d879ba59bd3a789992a1be8715
|
data/app/kern/services/vm.rb
CHANGED
@@ -217,7 +217,7 @@ service :vm do
|
|
217
217
|
}
|
218
218
|
|
219
219
|
function vm_copy_page(page) {
|
220
|
-
var
|
220
|
+
var copy = {
|
221
221
|
_id: page._id,
|
222
222
|
_head: page._head,
|
223
223
|
_next: page._next,
|
@@ -225,7 +225,9 @@ service :vm do
|
|
225
225
|
entries: JSON.parse(JSON.stringify(page.entries)),
|
226
226
|
};
|
227
227
|
|
228
|
-
|
228
|
+
vm_reindex_page(copy);
|
229
|
+
|
230
|
+
return copy;
|
229
231
|
}
|
230
232
|
|
231
233
|
function vm_rehash_page(page) {
|
data/docs/services/vm.md
CHANGED
@@ -193,7 +193,7 @@ The pager synchronization daemon is embodied in the function called `vm_pg_sync_
|
|
193
193
|
* **Generic Page**
|
194
194
|
* `vm_create_page(id)` - **this does not write anything to memory. It has no side effects except returning a hash**.
|
195
195
|
* `vm_create_page()` - Same as vm_create_page, but generates an id fore you.
|
196
|
-
* `vm_copy_page(page)` - Creates a copy of the page. Only copies the `_head`, `_next`, `_id`, `entries`, `_hash`
|
196
|
+
* `vm_copy_page(page)` - Creates a copy of the page. Only copies the `_head`, `_next`, `_id`, deep copy of `entries`, `_hash` and recalculates the `__index`
|
197
197
|
* `vm_entry_with_id(page, entry_id)` - Searches a page for an entry with a particular id via the `__index` table. retruns `nil` if the entry is not found or
|
198
198
|
a reference if the entry if it is found. The reference is **not** modifiable unless you call `vm_copy_page` first. Additionally, entries you
|
199
199
|
added recently will not be available by this untli they are written to disk via `vm_cache_write`
|
data/lib/flok/version.rb
CHANGED
@@ -173,9 +173,18 @@ RSpec.describe "kern:vm_service_functional" do
|
|
173
173
|
dump.new_page.entries[0]["value"] = "Circle";
|
174
174
|
dump.head_z_next_triangle_entry_circle = vm_copy_page(dump.new_page);
|
175
175
|
|
176
|
-
//Modify the new_page's entry again in-place
|
176
|
+
//Modify the new_page's entry again in-place to make sure it dosen't affect the copies
|
177
177
|
dump.new_page.entries[0]["_sig"] = "Triangle"
|
178
178
|
dump.new_page.entries[0]["value"] = "Triangle"
|
179
|
+
|
180
|
+
//Force a re-index, copy the page
|
181
|
+
vm_reindex_page(dump.new_page);
|
182
|
+
dump.head_z_next_triangle_entry_triangle_indexed = vm_copy_page(dump.new_page);
|
183
|
+
|
184
|
+
//Adjust the page's index array container and an element itself to make sure nothing
|
185
|
+
//is referenced.
|
186
|
+
dump.new_page.__index["id0"] = -1 //This shouldn't modify our copied pages index at id0
|
187
|
+
dump.new_page.__index["id1"] = 2 //Non-existant, just checking to make sure arrays are not referenced
|
179
188
|
}
|
180
189
|
|
181
190
|
expect(dump["no_head_no_next_no_entry"]).to eq({
|
@@ -184,6 +193,7 @@ RSpec.describe "kern:vm_service_functional" do
|
|
184
193
|
"_id" => "Q",
|
185
194
|
"_hash" => nil,
|
186
195
|
"entries" => [],
|
196
|
+
"__index" => {}
|
187
197
|
})
|
188
198
|
|
189
199
|
expect(dump["head_z_next_triangle_entry_square"]).to eq({
|
@@ -194,6 +204,7 @@ RSpec.describe "kern:vm_service_functional" do
|
|
194
204
|
"entries" => [
|
195
205
|
{"_id" => "id0", "_sig" => "Square", "value" => "Square"},
|
196
206
|
],
|
207
|
+
"__index" => {"id0" => 0}
|
197
208
|
})
|
198
209
|
|
199
210
|
expect(dump["head_z_next_triangle_entry_circle"]).to eq({
|
@@ -204,6 +215,18 @@ RSpec.describe "kern:vm_service_functional" do
|
|
204
215
|
"entries" => [
|
205
216
|
{"_id" => "id0", "_sig" => "Circle", "value" => "Circle"},
|
206
217
|
],
|
218
|
+
"__index" => {"id0" => 0}
|
219
|
+
})
|
220
|
+
|
221
|
+
expect(dump["head_z_next_triangle_entry_triangle_indexed"]).to eq({
|
222
|
+
"_head" => "Z",
|
223
|
+
"_next" => "Triangle",
|
224
|
+
"_id" => "Q",
|
225
|
+
"_hash" => nil,
|
226
|
+
"entries" => [
|
227
|
+
{"_id" => "id0", "_sig" => "Triangle", "value" => "Triangle"},
|
228
|
+
],
|
229
|
+
"__index" => { "id0" => 0, }
|
207
230
|
})
|
208
231
|
|
209
232
|
expect(dump["new_page"]).to eq({
|
@@ -214,7 +237,10 @@ RSpec.describe "kern:vm_service_functional" do
|
|
214
237
|
"entries" => [
|
215
238
|
{"_id" => "id0", "_sig" => "Triangle", "value" => "Triangle"},
|
216
239
|
],
|
217
|
-
"__index" => {
|
240
|
+
"__index" => {
|
241
|
+
"id0" => -1,
|
242
|
+
"id1" => 2
|
243
|
+
}
|
218
244
|
})
|
219
245
|
end
|
220
246
|
|