flok 0.0.40 → 0.0.41
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 +7 -2
- data/app/kern/dispatch.js +10 -1
- data/app/kern/mod/event.js +9 -0
- data/app/kern/pagers/pg_mem.js +21 -0
- data/app/kern/pagers/pg_net_sim.js +44 -0
- data/app/kern/pagers/pg_spec.js +23 -0
- data/app/kern/services/vm.rb +60 -64
- data/bin/flok +44 -23
- data/docs/callout.md +1 -1
- data/docs/client_api.md +5 -2
- data/docs/config_yml.md +41 -0
- data/docs/controllers.md +4 -0
- data/docs/datatypes.md +5 -2
- data/docs/debug_server.md +2 -0
- data/docs/dispatch.md +8 -3
- data/docs/known_issues.md +6 -0
- data/docs/mod/event.md +25 -20
- data/docs/mod/persist.md +1 -1
- data/docs/mod/speech.md +12 -0
- data/docs/project.md +2 -2
- data/docs/services/vm.md +46 -17
- data/docs/services/vm/pagers.md +22 -2
- data/lib/flok/build.rb +0 -4
- data/lib/flok/user_compiler.rb +123 -47
- data/lib/flok/user_compiler_templates/ctable.js.erb +39 -1
- data/lib/flok/version.rb +1 -1
- data/spec/env/global.rb +1 -0
- data/spec/env/kern.rb +5 -1
- data/spec/etc/cli_spec.rb +337 -322
- data/spec/etc/service_compiler/config0.rb +1 -1
- data/spec/etc/service_compiler/config0b.rb +1 -0
- data/spec/etc/services_compiler_spec.rb +29 -29
- data/spec/etc/user_compiler/controller0b.rb +9 -0
- data/spec/etc/user_compiler/controller0timer.rb +16 -0
- data/spec/etc/user_compiler_spec.rb +24 -1
- data/spec/iface/driver/dispatch_spec.rb +8 -2
- data/spec/iface/driver/persist_spec.rb +11 -0
- data/spec/kern/assets/controller0defer.rb +18 -0
- data/spec/kern/assets/controller0defer0.rb +13 -0
- data/spec/kern/assets/controller0defer2.rb +17 -0
- data/spec/kern/assets/global_on_entry.rb +8 -0
- data/spec/kern/assets/global_on_entry2.rb +16 -0
- data/spec/kern/assets/global_on_entry3.rb +17 -0
- data/spec/kern/assets/global_on_entry4.rb +12 -0
- data/spec/kern/assets/interval.rb +29 -0
- data/spec/kern/assets/interval2.rb +33 -0
- data/spec/kern/assets/interval3.rb +39 -0
- data/spec/kern/assets/service1.rb +4 -1
- data/spec/kern/assets/service_controller1.rb +11 -0
- data/spec/kern/assets/specimin/controller0.rb +74 -0
- data/spec/kern/assets/vm/config5.rb +20 -0
- data/spec/kern/assets/vm/config6.rb +20 -0
- data/spec/kern/assets/vm/controller10.rb +1 -1
- data/spec/kern/assets/vm/controller11.rb +1 -1
- data/spec/kern/assets/vm/controller12.rb +1 -1
- data/spec/kern/assets/vm/controller13.rb +1 -1
- data/spec/kern/assets/vm/controller16b.rb +28 -0
- data/spec/kern/assets/vm/controller18.rb +1 -1
- data/spec/kern/assets/vm/controller21.rb +1 -1
- data/spec/kern/assets/vm/controller22.rb +8 -0
- data/spec/kern/assets/vm/controller_exc_ewatch.rb +1 -0
- data/spec/kern/assets/vm/controller_exc_ewatch2.rb +30 -0
- data/spec/kern/assets/vm/controller_exc_ewatch3.rb +16 -0
- data/spec/kern/assets/vm/controller_exc_ewatch4.rb +16 -0
- data/spec/kern/assets/vm/macros/copy_page_c.rb +1 -0
- data/spec/kern/assets/vm/macros/copy_page_ch.rb +25 -0
- data/spec/kern/assets/vm/macros/entry_del_c.rb +1 -0
- data/spec/kern/assets/vm/macros/entry_del_ch.rb +20 -0
- data/spec/kern/assets/vm/macros/entry_insert_c.rb +1 -0
- data/spec/kern/assets/vm/macros/entry_insert_ch.rb +23 -0
- data/spec/kern/assets/vm/macros/entry_mutable_c.rb +8 -7
- data/spec/kern/assets/vm/macros/entry_mutable_ch.rb +34 -0
- data/spec/kern/assets/vm/macros/new_page_c.rb +1 -1
- data/spec/kern/assets/vm/macros/new_page_c2.rb +1 -1
- data/spec/kern/assets/vm/macros/new_page_ch.rb +7 -0
- data/spec/kern/assets/vm/pg_mem/config.rb +10 -0
- data/spec/kern/assets/vm/pg_mem/config1.rb +10 -0
- data/spec/kern/assets/vm/pg_mem/config2.rb +10 -0
- data/spec/kern/assets/vm/pg_mem/config3.rb +15 -0
- data/spec/kern/assets/vm/pg_mem/write.rb +23 -0
- data/spec/kern/assets/vm/pg_mem/write2.rb +38 -0
- data/spec/kern/assets/vm/pg_net_sim/config.rb +10 -0
- data/spec/kern/assets/vm/pg_net_sim/nothing.rb +12 -0
- data/spec/kern/assets/vm/pg_net_sim/pages.json +1 -0
- data/spec/kern/assets/vm/pg_net_sim/watch.rb +18 -0
- data/spec/kern/callout_spec.rb +1 -1
- data/spec/kern/controller_macro_spec.rb +153 -20
- data/spec/kern/controller_spec.rb +232 -1
- data/spec/kern/debug_ui_spec.rb +235 -235
- data/spec/kern/event_spec.rb +112 -0
- data/spec/kern/service_controller_spec.rb +14 -2
- data/spec/kern/vm_service_mem_pagers_spec.rb +117 -0
- data/spec/kern/vm_service_net_sim_pager_spec.rb +97 -0
- data/spec/kern/vm_service_spec.rb +304 -17
- data/spec/kern/vm_service_spec2.rb +39 -0
- metadata +88 -6
- data/app/kern/pagers/mem_pager.js +0 -2
- data/app/kern/pagers/pg_spec0.js +0 -20
- data/lib/flok/project_template/Guardfile +0 -7
- data/lib/flok/project_template/config/config.yml +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#Simple service config that uses built-in spec service to create a instance called 'spec'
|
|
2
|
+
service_instance :vm, :vm, {
|
|
3
|
+
:pagers => [
|
|
4
|
+
{
|
|
5
|
+
:name => "pg_spec0",
|
|
6
|
+
:namespace => "spec0",
|
|
7
|
+
:options => {
|
|
8
|
+
"hello" => "world"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
:name => "pg_spec1",
|
|
13
|
+
:namespace => "spec1",
|
|
14
|
+
:options => {
|
|
15
|
+
"foo" => "bar"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#Simple service config that uses built-in spec service to create a instance called 'spec'
|
|
2
|
+
service_instance :vm, :vm, {
|
|
3
|
+
:pagers => [
|
|
4
|
+
{
|
|
5
|
+
:name => "pg_spec0",
|
|
6
|
+
:namespace => "spec",
|
|
7
|
+
:options => {
|
|
8
|
+
"hello" => "world"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
:name => "pg_spec1",
|
|
13
|
+
:namespace => "spec1",
|
|
14
|
+
:options => {
|
|
15
|
+
"foo" => "bar"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
controller :my_controller do
|
|
2
|
+
spots "content"
|
|
3
|
+
|
|
4
|
+
action :a do
|
|
5
|
+
|
|
6
|
+
on_entry %{
|
|
7
|
+
Embed("a", "content", {});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
on "next", %{
|
|
11
|
+
Goto("b");
|
|
12
|
+
}
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
action :b do
|
|
16
|
+
on_entry %{
|
|
17
|
+
}
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
controller :a do
|
|
22
|
+
services :vm
|
|
23
|
+
action :index do
|
|
24
|
+
on_entry %{
|
|
25
|
+
var info = {ns: "spec", id: "test"}
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
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: "test"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
Request("vm", "unwatch", watch_info);
|
|
12
|
+
}
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
controller :my_watch_controller do
|
|
17
|
+
services :vm
|
|
18
|
+
|
|
19
|
+
action :my_action do
|
|
20
|
+
on_entry %{
|
|
21
|
+
var watch_info = {
|
|
22
|
+
ns: "spec",
|
|
23
|
+
id: "test"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Request("vm", "watch", watch_info);
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
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: "test"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
Request("vm", "watch", watch_info);
|
|
12
|
+
Request("vm", "unwatch", watch_info);
|
|
13
|
+
Request("vm", "watch", watch_info);
|
|
14
|
+
}
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
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: "test"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
Request("vm", "unwatch", watch_info);
|
|
12
|
+
Request("vm", "watch", watch_info);
|
|
13
|
+
Request("vm", "unwatch", watch_info);
|
|
14
|
+
}
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
controller :controller do
|
|
2
|
+
action :index do
|
|
3
|
+
on_entry %{
|
|
4
|
+
original_page = {
|
|
5
|
+
_head: "head",
|
|
6
|
+
_next: "next",
|
|
7
|
+
_id: "id",
|
|
8
|
+
_type: "hash",
|
|
9
|
+
entries: {
|
|
10
|
+
"id0": {_sig: "sig1"},
|
|
11
|
+
"id1": {_sig: "sig2"},
|
|
12
|
+
},
|
|
13
|
+
_hash: "hash",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//One page done the right away, another, the wrong way
|
|
17
|
+
copied_page = CopyPage(original_page);
|
|
18
|
+
not_copied_page = original_page;
|
|
19
|
+
|
|
20
|
+
//The copied page is now modified and does
|
|
21
|
+
//not contain _hash
|
|
22
|
+
copied_page._next = "test"
|
|
23
|
+
}
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
"id0": {_sig: "sig"},
|
|
10
|
+
"id1": {_sig: "sig2"},
|
|
11
|
+
},
|
|
12
|
+
_hash: "hash",
|
|
13
|
+
_type: "hash",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
page = CopyPage(original_page);
|
|
17
|
+
EntryDel(page, "id0");
|
|
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
|
+
"id0": {"_sig": "sig0"},
|
|
10
|
+
"id1": {"_sig": "sig1"},
|
|
11
|
+
},
|
|
12
|
+
_hash: "hash",
|
|
13
|
+
_type: "hash",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
page = CopyPage(original_page);
|
|
17
|
+
var entry0 = {hello: "world"}
|
|
18
|
+
var entry2 = {hello: "world2"}
|
|
19
|
+
EntryInsert(page, "id0", entry0);
|
|
20
|
+
EntryInsert(page, "id2", entry2);
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -5,20 +5,21 @@ controller :controller do
|
|
|
5
5
|
_head: "head",
|
|
6
6
|
_next: "next",
|
|
7
7
|
_id: "id",
|
|
8
|
+
_type: "array",
|
|
8
9
|
entries: [
|
|
9
|
-
{_id: "
|
|
10
|
+
{_id: "id1", _sig: "sig1"},
|
|
10
11
|
{_id: "id2", _sig: "sig2"},
|
|
11
|
-
{_id: "id3", _sig: "sig3"},
|
|
12
12
|
],
|
|
13
13
|
_hash: "hash",
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
//Now we make a new copy
|
|
16
17
|
page = CopyPage(original_page);
|
|
17
|
-
EntryMutable(page, 0);
|
|
18
|
-
EntryMutable(page,
|
|
18
|
+
var a = EntryMutable(page, 0);
|
|
19
|
+
var b = EntryMutable(page, 1);
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
a.hello = "world";
|
|
22
|
+
b.hello = "world";
|
|
22
23
|
|
|
23
24
|
//This is a violation of the vm, it will set the original but not copied
|
|
24
25
|
//This is because the page.entries[1] actually refers to the original_page.entries[1]
|
|
@@ -26,7 +27,7 @@ controller :controller do
|
|
|
26
27
|
//are references. When you call entrymutable, you are making a copy and replacing that
|
|
27
28
|
//entry in the array so that page.entries[0] is actually owned by page and is no longer apart
|
|
28
29
|
//of original_page
|
|
29
|
-
|
|
30
|
+
original_page.entries[0].foo = "bar";
|
|
30
31
|
}
|
|
31
32
|
end
|
|
32
33
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
controller :controller do
|
|
2
|
+
action :index do
|
|
3
|
+
on_entry %{
|
|
4
|
+
original_page = {
|
|
5
|
+
_head: "head",
|
|
6
|
+
_next: "next",
|
|
7
|
+
_id: "id",
|
|
8
|
+
_type: "hash",
|
|
9
|
+
entries: {
|
|
10
|
+
"id1": {_sig: "sig1"},
|
|
11
|
+
"id2": {_sig: "sig2"},
|
|
12
|
+
},
|
|
13
|
+
_hash: "hash",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//Now we make a new copy
|
|
17
|
+
page = CopyPage(original_page);
|
|
18
|
+
var a = EntryMutable(page, "id1");
|
|
19
|
+
var b = EntryMutable(page, "id2");
|
|
20
|
+
|
|
21
|
+
a.hello = "world";
|
|
22
|
+
b.hello = "world";
|
|
23
|
+
|
|
24
|
+
//This is a violation of the vm, it will set the original but not copied
|
|
25
|
+
//This is because the page.entries[1] actually refers to the original_page.entries[1]
|
|
26
|
+
//the array of original_page.entries belongs to original_page, but the entries inside it
|
|
27
|
+
//are references. When you call entrymutable, you are making a copy and replacing that
|
|
28
|
+
//entry in the array so that page.entries[0] is actually owned by page and is no longer apart
|
|
29
|
+
//of original_page
|
|
30
|
+
original_page.entries["id1"].foo = "bar";
|
|
31
|
+
}
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|