flok 0.0.83 → 0.0.84

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: 7bd8fa8fdb50bddf42da16826b0046fb59193ce7
4
- data.tar.gz: f65050b61273c66c424aeae68568cf0eb7272512
3
+ metadata.gz: 45e269cfb7782fb14a1cee271a4e3463469765e8
4
+ data.tar.gz: f75ef3e15dd33ba3c46b001f2d746e2e035c4714
5
5
  SHA512:
6
- metadata.gz: d70b9cdc7e87a2b068b55b255a112838a04bac27dca48d5d05b1d6e5023d71a05930856dfe3a256161f4b557a1fbb13996cd7d561c7b45808882256d39057c34
7
- data.tar.gz: 36c1164fdefca9a1f9a53b9e845d4cdebfd66f1ae8084bfa0f3d4433a8bcf834003694d71453fb81d46a55ffe73b95c919c5799652b0d14de3d2bf01b40a1f58
6
+ metadata.gz: fc8d027a642ebc2958501f1102697dea6a06e2a83feb1f865933e8d246d0a3a3a91c10a24575a4967f9d774e553a0779e1c9f67902231cdc86b36ec14d3e0f5e
7
+ data.tar.gz: 39cd9c82e3f12d2dc6b1479c266e7120e00b5217a568ce65ea12128a4721a288a3bfcd2e8f0a64acd072fe35c6803c75113015528e7c8e4e9ff128b1ecb5806c
@@ -119,14 +119,17 @@ service :vm do
119
119
  function int_per_get_res(s, ns, id, res) {
120
120
  if (ns === "__reserved__") {
121
121
  if (id === "vm_unsynced") {
122
- var old_vm_unsynced = vm_unsynced;
123
- vm_unsynced = res;
122
+ if (res === null) { return; }
123
+ var cached_vm_unsynced = res;
124
124
 
125
125
  <% @options[:pagers].each do |p| %>
126
- var old_vm_unsynced_ns = old_vm_unsynced.<%= p[:namespace] %>;
127
- var ids = Object.keys(old_vm_unsynced_ns);
128
- for (var i = 0; i < ids.length; ++i) {
129
- vm_unsynced.<%= p[:namespace] %>[ids[i]] = old_vm_unsynced_ns[ids[i]];
126
+ //Make sure disk has the old namespace
127
+ if (cached_vm_unsynced.<%= p[:namespace] %> !== undefined) {
128
+ //Get all the ids from the old namespace
129
+ var ids = Object.keys(cached_vm_unsynced.<%= p[:namespace] %>)
130
+ for (var i = 0; i < ids.length; ++i) {
131
+ vm_unsynced.<%= p[:namespace] %>[ids[i]] = cached_vm_unsynced.<%= p[:namespace] %>[ids[i]];
132
+ }
130
133
  }
131
134
  <% end %>
132
135
  }
data/lib/flok/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Flok
2
- VERSION = "0.0.83"
2
+ VERSION = "0.0.84"
3
3
  end
@@ -98,7 +98,8 @@ RSpec.describe "kern:vm_service unsynced (persist)" do
98
98
  })
99
99
  end
100
100
 
101
- it "vm_pg_sync_pagein should write out the read to vm_unsynced and merge if there are any existing elements" do
101
+
102
+ it "vm_pg_sync_pagein should not modify vm_unsynced if the read comes back with nothing" do
102
103
  ctx = flok_new_user File.read('./spec/kern/assets/vm/controller0.rb'), File.read("./spec/kern/assets/vm/config5d.rb")
103
104
  dump = ctx.evald %{
104
105
  //Needed to initialize pagers
@@ -129,6 +130,59 @@ RSpec.describe "kern:vm_service unsynced (persist)" do
129
130
  expect(res[2]).to eq("vm_unsynced")
130
131
 
131
132
  #Return the vm_unsynced
133
+ @driver.int "int_per_get_res", [
134
+ "vm",
135
+ "__reserved__",
136
+ "vm_unsynced",
137
+ nil
138
+ ]
139
+
140
+ #Expect vm_unsynced to have loaded the data
141
+ res = @ctx.dump("vm_unsynced")
142
+ expect(res).to eq({
143
+ "spec" => {
144
+ "foo" => 0,
145
+ },
146
+ "spec1" => {
147
+ "bar" => 1
148
+ }
149
+ })
150
+ end
151
+
152
+ it "vm_pg_sync_pagein should write out the read to vm_unsynced and merge if there are any existing elements" do
153
+ ctx = flok_new_user File.read('./spec/kern/assets/vm/controller0.rb'), File.read("./spec/kern/assets/vm/config5d.rb")
154
+ dump = ctx.evald %{
155
+ //Needed to initialize pagers
156
+ base = _embed("my_controller", 0, {}, null);
157
+
158
+ vm_pg_sync_pagein();
159
+
160
+ vm_unsynced = {
161
+ "spec": {
162
+ "foo": 0
163
+ },
164
+
165
+ "spec1": {
166
+ "bar": 1
167
+ },
168
+ "spec2": {
169
+ "hello": "world"
170
+ }
171
+ }
172
+
173
+ int_dispatch([]);
174
+ }
175
+
176
+ #Should be loaded (manually called)
177
+ expect(ctx.eval("vm_unsynced_paged_in")).to eq(true)
178
+
179
+ #Expect a request for the special page that holds vm_unsynced
180
+ @driver.ignore_up_to "if_per_get", 2
181
+ res = @driver.get "if_per_get", 2
182
+ expect(res[1]).to eq("__reserved__")
183
+ expect(res[2]).to eq("vm_unsynced")
184
+
185
+ #Return the vm_unsynced, spec3 no longer exists
132
186
  @driver.int "int_per_get_res", [
133
187
  "vm",
134
188
  "__reserved__",
@@ -138,6 +192,9 @@ RSpec.describe "kern:vm_service unsynced (persist)" do
138
192
  "holah" => 1,
139
193
  },
140
194
  "spec1" => {
195
+ },
196
+ "spec3" => {
197
+ "foo" => "bar"
141
198
  }
142
199
  }
143
200
  ]
@@ -146,11 +203,14 @@ RSpec.describe "kern:vm_service unsynced (persist)" do
146
203
  res = @ctx.dump("vm_unsynced")
147
204
  expect(res).to eq({
148
205
  "spec" => {
149
- "foo" => 0,
150
206
  "holah" => 1,
207
+ "foo" => 0,
151
208
  },
152
209
  "spec1" => {
153
210
  "bar" => 1
211
+ },
212
+ "spec2" => {
213
+ "hello" => "world"
154
214
  }
155
215
  })
156
216
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flok
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.83
4
+ version: 0.0.84
5
5
  platform: ruby
6
6
  authors:
7
7
  - seo