flok 0.0.38 → 0.0.39
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 +4 -4
- data/app/drivers/chrome/src/dispatch.js +41 -6
- data/app/drivers/chrome/src/persist.js +1 -10
- data/app/kern/dispatch.js +17 -23
- data/app/kern/gen_id.js +8 -0
- data/app/kern/macro.rb +20 -18
- data/app/kern/pagers/pg_spec0.js +20 -0
- data/app/kern/services/vm.rb +176 -30
- data/docs/client_api.md +3 -1
- data/docs/compilation.md +1 -1
- data/docs/dispatch.md +91 -0
- data/docs/kernel_api.md +3 -2
- data/docs/messaging.md +6 -1
- data/docs/mod/persist.md +4 -3
- data/docs/project_layout.md +2 -2
- data/docs/services/vm.md +116 -41
- data/docs/services/vm/pagers.md +38 -46
- data/lib/flok.rb +1 -0
- data/lib/flok/build.rb +3 -4
- data/lib/flok/macro.rb +27 -0
- data/lib/flok/services_compiler.rb +12 -8
- data/lib/flok/user_compiler.rb +131 -4
- data/lib/flok/version.rb +1 -1
- data/spec/env/kern.rb +71 -0
- data/spec/etc/macro_spec.rb +3 -8
- data/spec/etc/service_compiler/service3.rb +27 -0
- data/spec/etc/services_compiler_spec.rb +35 -27
- data/spec/iface/driver/dispatch_spec.rb +20 -0
- data/spec/iface/driver/persist_spec.rb +9 -24
- data/spec/iface/kern/ping_spec.rb +3 -24
- data/spec/kern/assets/vm/config4.rb +12 -0
- data/spec/kern/assets/vm/controller10.rb +26 -0
- data/spec/kern/assets/vm/controller11.rb +33 -0
- data/spec/kern/assets/vm/controller12.rb +45 -0
- data/spec/kern/assets/vm/controller13.rb +40 -0
- data/spec/kern/assets/vm/controller14.rb +14 -0
- data/spec/kern/assets/vm/controller15.rb +15 -0
- data/spec/kern/assets/vm/controller16.rb +29 -0
- data/spec/kern/assets/vm/controller17.rb +30 -0
- data/spec/kern/assets/vm/controller18.rb +28 -0
- data/spec/kern/assets/vm/controller19.rb +14 -0
- data/spec/kern/assets/vm/controller19b.rb +15 -0
- data/spec/kern/assets/vm/controller20.rb +19 -0
- data/spec/kern/assets/vm/controller21.rb +40 -0
- data/spec/kern/assets/vm/controller7.rb +18 -0
- data/spec/kern/assets/vm/controller8.rb +38 -0
- data/spec/kern/assets/vm/controller8b.rb +18 -0
- data/spec/kern/assets/vm/controller9.rb +20 -0
- data/spec/kern/assets/vm/controller_exc_2watch.rb +15 -0
- data/spec/kern/assets/vm/controller_exc_ewatch.rb +14 -0
- data/spec/kern/assets/vm/macros/copy_page_c.rb +23 -0
- data/spec/kern/assets/vm/macros/entry_del_c.rb +18 -0
- data/spec/kern/assets/vm/macros/entry_insert_c.rb +21 -0
- data/spec/kern/assets/vm/macros/entry_mutable_c.rb +33 -0
- data/spec/kern/assets/vm/macros/new_page_c.rb +7 -0
- data/spec/kern/assets/vm/macros/new_page_c2.rb +7 -0
- data/spec/kern/assets/vm/macros/set_page_head_c.rb +18 -0
- data/spec/kern/assets/vm/macros/set_page_next_c.rb +18 -0
- data/spec/kern/controller_macro_spec.rb +186 -0
- data/spec/kern/dispatch_spec.rb +125 -0
- data/spec/kern/functions_spec.rb +15 -0
- data/spec/kern/vm_service_spec.rb +874 -173
- metadata +70 -5
- data/docs/scheduling.md +0 -46
- data/spec/kern/rest_service_spec.rb +0 -45
@@ -0,0 +1,30 @@
|
|
1
|
+
controller :my_controller do
|
2
|
+
spots "content"
|
3
|
+
services :vm
|
4
|
+
|
5
|
+
action :a do
|
6
|
+
|
7
|
+
on_entry %{
|
8
|
+
Embed("a", "content", {});
|
9
|
+
}
|
10
|
+
|
11
|
+
on "next", %{
|
12
|
+
Goto("b");
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
action :b do
|
17
|
+
on_entry %{
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
controller :a do
|
23
|
+
services :vm
|
24
|
+
action :index do
|
25
|
+
on_entry %{
|
26
|
+
var info = {ns: "spec", id: "test"}
|
27
|
+
Request("vm", "watch", info);
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
controller :my_controller do
|
2
|
+
services :vm
|
3
|
+
|
4
|
+
action :my_action do
|
5
|
+
on_entry %{
|
6
|
+
var entry = {
|
7
|
+
hello: "world"
|
8
|
+
}
|
9
|
+
|
10
|
+
page = NewPage("test");
|
11
|
+
SetPageHead(page, "head");
|
12
|
+
SetPageNext(page, "next");
|
13
|
+
EntryInsert(page, 0, entry);
|
14
|
+
|
15
|
+
var watch_info = {
|
16
|
+
ns: "spec",
|
17
|
+
id: "test"
|
18
|
+
}
|
19
|
+
|
20
|
+
var write_info = {
|
21
|
+
ns: "spec",
|
22
|
+
page: page
|
23
|
+
};
|
24
|
+
|
25
|
+
Request("vm", "write", write_info);
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
controller :my_controller do
|
2
|
+
services :vm
|
3
|
+
|
4
|
+
action :my_action do
|
5
|
+
on_entry %{
|
6
|
+
var watch_info = {
|
7
|
+
ns: "spec",
|
8
|
+
id: "hello"
|
9
|
+
}
|
10
|
+
|
11
|
+
read_res = [];
|
12
|
+
Request("vm", "watch", watch_info);
|
13
|
+
}
|
14
|
+
|
15
|
+
on "read_res", %{
|
16
|
+
read_res.push(params);
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
controller :my_controller do
|
2
|
+
services :vm
|
3
|
+
|
4
|
+
action :my_action do
|
5
|
+
on_entry %{
|
6
|
+
var entry = {
|
7
|
+
hello: "world"
|
8
|
+
}
|
9
|
+
|
10
|
+
page = NewPage("test");
|
11
|
+
|
12
|
+
SetPageHead(page, "head");
|
13
|
+
SetPageNext(page, "next");
|
14
|
+
EntryInsert(page, 0, entry);
|
15
|
+
|
16
|
+
|
17
|
+
var watch_info = {
|
18
|
+
ns: "spec",
|
19
|
+
id: "test"
|
20
|
+
}
|
21
|
+
|
22
|
+
var write_info = {
|
23
|
+
ns: "spec",
|
24
|
+
page: page
|
25
|
+
};
|
26
|
+
|
27
|
+
Request("vm", "write", write_info);
|
28
|
+
}
|
29
|
+
|
30
|
+
on "next", %{
|
31
|
+
page2 = CopyPage(page);
|
32
|
+
SetPageHead(page2, "head2");
|
33
|
+
var write_info = {
|
34
|
+
ns: "spec",
|
35
|
+
page: page2
|
36
|
+
};
|
37
|
+
Request("vm", "write", write_info);
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
controller :my_controller do
|
2
|
+
spots "content"
|
3
|
+
services :vm
|
4
|
+
|
5
|
+
action :my_action do
|
6
|
+
on_entry %{
|
7
|
+
page0 = {
|
8
|
+
ns: "spec",
|
9
|
+
id: "my_key"
|
10
|
+
};
|
11
|
+
|
12
|
+
Request("vm", "watch", page0);
|
13
|
+
}
|
14
|
+
|
15
|
+
on "read_res", %{
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
controller :my_controller_sync do
|
21
|
+
spots "content"
|
22
|
+
services :vm
|
23
|
+
|
24
|
+
action :my_action do
|
25
|
+
on_entry %{
|
26
|
+
page = {
|
27
|
+
ns: "spec",
|
28
|
+
id: "my_key",
|
29
|
+
sync: true
|
30
|
+
};
|
31
|
+
|
32
|
+
Request("vm", "watch", page);
|
33
|
+
}
|
34
|
+
|
35
|
+
on "read_res", %{
|
36
|
+
}
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
controller :my_controller do
|
2
|
+
services :vm
|
3
|
+
|
4
|
+
action :my_action do
|
5
|
+
on_entry %{
|
6
|
+
//Send a request
|
7
|
+
var info = {
|
8
|
+
ns: "spec",
|
9
|
+
id: "my_key"
|
10
|
+
};
|
11
|
+
|
12
|
+
Request("vm", "watch", info);
|
13
|
+
Request("vm", "unwatch", info);
|
14
|
+
Request("vm", "watch", info);
|
15
|
+
}
|
16
|
+
|
17
|
+
on "read_res", %{
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
controller :controller do
|
2
|
+
action :index do
|
3
|
+
on_entry %{
|
4
|
+
original_page = {
|
5
|
+
_head: "head",
|
6
|
+
_next: "next",
|
7
|
+
_id: "id",
|
8
|
+
entries: [
|
9
|
+
{_id: "id", _sig: "sig"},
|
10
|
+
],
|
11
|
+
_hash: "hash",
|
12
|
+
};
|
13
|
+
|
14
|
+
//One page done the right away, another, the wrong way
|
15
|
+
copied_page = CopyPage(original_page);
|
16
|
+
not_copied_page = original_page;
|
17
|
+
|
18
|
+
//The copied page is now modified and does
|
19
|
+
//not contain _hash
|
20
|
+
copied_page._next = "test"
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
controller :controller do
|
2
|
+
action :index do
|
3
|
+
on_entry %{
|
4
|
+
original_page = {
|
5
|
+
_head: "head",
|
6
|
+
_next: "next",
|
7
|
+
_id: "id",
|
8
|
+
entries: [
|
9
|
+
{_id: "id", _sig: "sig"},
|
10
|
+
],
|
11
|
+
_hash: "hash",
|
12
|
+
};
|
13
|
+
|
14
|
+
page = CopyPage(original_page);
|
15
|
+
EntryDel(page, 0);
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
controller :controller do
|
2
|
+
action :index do
|
3
|
+
on_entry %{
|
4
|
+
original_page = {
|
5
|
+
_head: "head",
|
6
|
+
_next: "next",
|
7
|
+
_id: "id",
|
8
|
+
entries: [
|
9
|
+
{_id: "id", _sig: "sig"},
|
10
|
+
],
|
11
|
+
_hash: "hash",
|
12
|
+
};
|
13
|
+
|
14
|
+
page = CopyPage(original_page);
|
15
|
+
var entry0 = {hello: "world"}
|
16
|
+
var entry2 = {hello: "world2"}
|
17
|
+
EntryInsert(page, 0, entry0);
|
18
|
+
EntryInsert(page, 2, entry2);
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
controller :controller do
|
2
|
+
action :index do
|
3
|
+
on_entry %{
|
4
|
+
original_page = {
|
5
|
+
_head: "head",
|
6
|
+
_next: "next",
|
7
|
+
_id: "id",
|
8
|
+
entries: [
|
9
|
+
{_id: "id", _sig: "sig"},
|
10
|
+
{_id: "id2", _sig: "sig2"},
|
11
|
+
{_id: "id3", _sig: "sig3"},
|
12
|
+
],
|
13
|
+
_hash: "hash",
|
14
|
+
};
|
15
|
+
|
16
|
+
page = CopyPage(original_page);
|
17
|
+
EntryMutable(page, 0);
|
18
|
+
EntryMutable(page, 2);
|
19
|
+
|
20
|
+
page.entries[0].hello = "world";
|
21
|
+
page.entries[2].hello = "world";
|
22
|
+
|
23
|
+
//This is a violation of the vm, it will set the original but not copied
|
24
|
+
//This is because the page.entries[1] actually refers to the original_page.entries[1]
|
25
|
+
//the array of original_page.entries belongs to original_page, but the entries inside it
|
26
|
+
//are references. When you call entrymutable, you are making a copy and replacing that
|
27
|
+
//entry in the array so that page.entries[0] is actually owned by page and is no longer apart
|
28
|
+
//of original_page
|
29
|
+
page.entries[1].foo = "bar";
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
controller :controller do
|
2
|
+
action :index do
|
3
|
+
on_entry %{
|
4
|
+
original_page = {
|
5
|
+
_head: "head",
|
6
|
+
_next: "next",
|
7
|
+
_id: "id",
|
8
|
+
entries: [
|
9
|
+
{_id: "id", _sig: "sig"},
|
10
|
+
],
|
11
|
+
_hash: "hash",
|
12
|
+
};
|
13
|
+
|
14
|
+
page = CopyPage(original_page);
|
15
|
+
SetPageHead(page, "test");
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
controller :controller do
|
2
|
+
action :index do
|
3
|
+
on_entry %{
|
4
|
+
original_page = {
|
5
|
+
_head: "head",
|
6
|
+
_next: "next",
|
7
|
+
_id: "id",
|
8
|
+
entries: [
|
9
|
+
{_id: "id", _sig: "sig"},
|
10
|
+
],
|
11
|
+
_hash: "hash",
|
12
|
+
};
|
13
|
+
|
14
|
+
page = CopyPage(original_page);
|
15
|
+
SetPageNext(page, "test");
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|