entangld 2.4.1 → 2.7.0

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.
@@ -0,0 +1,173 @@
1
+ const assert = require("assert");
2
+ const Entangld = require("../lib/Datastore.js");
3
+ const { EntangldError, EntangldTimeoutError } = require("../lib/error.js");
4
+
5
+ const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
6
+
7
+ // Resolve to the error a promise rejects with, or fail if it resolves
8
+ function rejection(promise) {
9
+ return promise.then(
10
+ (val) => assert.fail(`Expected a rejection, got ${val}`),
11
+ (err) => err
12
+ );
13
+ }
14
+
15
+ // Attach store b to store a. Messages from a are delivered only if allow(msg)
16
+ function linked_stores(allow = () => true) {
17
+ const a = new Entangld();
18
+ const b = new Entangld();
19
+
20
+ a.transmit((msg, store) => {
21
+ if (allow(msg)) store.receive(msg, a);
22
+ });
23
+ b.transmit((msg, store) => store.receive(msg, b));
24
+
25
+ a.attach("b", b);
26
+ b.attach("a", a);
27
+
28
+ return { a, b };
29
+ }
30
+
31
+ describe("Timeouts", () => {
32
+
33
+ describe("get", () => {
34
+
35
+ it("rejects if a remote store never replies", async () => {
36
+ const { a } = linked_stores(() => false);
37
+
38
+ const err = await rejection(a.get("b.value", undefined, { timeout_ms: 10 }));
39
+
40
+ assert(err instanceof EntangldTimeoutError);
41
+ assert(err instanceof EntangldError);
42
+ assert.strictEqual(err.name, "EntangldTimeoutError");
43
+ assert.strictEqual(err.path, "b.value");
44
+ assert.strictEqual(err.timeout_ms, 10);
45
+ });
46
+
47
+ it("removes the request after timing out", async () => {
48
+ const { a } = linked_stores(() => false);
49
+
50
+ await rejection(a.get("b.value", undefined, { timeout_ms: 10 }));
51
+
52
+ assert.strictEqual(Object.keys(a._requests).length, 0);
53
+ });
54
+
55
+ it("resolves if the reply beats the timeout", async () => {
56
+ const { a, b } = linked_stores();
57
+ b.set("value", 7);
58
+
59
+ const value = await a.get("b.value", undefined, { timeout_ms: 1000 });
60
+
61
+ assert.strictEqual(value, 7);
62
+ assert.strictEqual(Object.keys(a._requests).length, 0);
63
+ });
64
+
65
+ it("ignores a reply which arrives after the timeout", async () => {
66
+ const { a, b } = linked_stores(() => false);
67
+ const sent = [];
68
+ a.transmit((msg) => sent.push(msg));
69
+
70
+ await rejection(a.get("b.value", undefined, { timeout_ms: 10 }));
71
+
72
+ assert.doesNotThrow(() => {
73
+ a.receive({ type: "value", uuid: sent[0].uuid, value: 1 }, b);
74
+ });
75
+ });
76
+
77
+ it("passes params through and keeps options off the wire", async () => {
78
+ const sent = [];
79
+ const { a, b } = linked_stores((msg) => {
80
+ sent.push(JSON.stringify(msg));
81
+ return true;
82
+ });
83
+ b.set("echo", (params) => params);
84
+
85
+ const value = await a.get("b.echo", ["x"], { timeout_ms: 1000 });
86
+
87
+ assert.deepStrictEqual(value, ["x"]);
88
+ assert(!sent.join("").includes("timeout_ms"));
89
+ });
90
+
91
+ it("rejects if a local function never settles", async () => {
92
+ const a = new Entangld();
93
+ a.set("hang", () => new Promise(() => { }));
94
+
95
+ const err = await rejection(a.get("hang", undefined, { timeout_ms: 10 }));
96
+
97
+ assert(err instanceof EntangldTimeoutError);
98
+ });
99
+
100
+ it("resolves if a local function beats the timeout", async () => {
101
+ const a = new Entangld();
102
+ a.set("slow", () => wait(1).then(() => 8));
103
+
104
+ assert.strictEqual(await a.get("slow", undefined, { timeout_ms: 1000 }), 8);
105
+ });
106
+
107
+ it("keeps the original error if a local function rejects", async () => {
108
+ const a = new Entangld();
109
+ a.set("bad", () => Promise.reject(new Error("boom")));
110
+
111
+ const err = await rejection(a.get("bad", undefined, { timeout_ms: 1000 }));
112
+
113
+ assert.strictEqual(err.message, "boom");
114
+ });
115
+
116
+ it("returns local data", async () => {
117
+ const a = new Entangld();
118
+ a.set("value", 3);
119
+
120
+ assert.strictEqual(await a.get("value", undefined, { timeout_ms: 10 }), 3);
121
+ });
122
+
123
+ it("never settles a lost reply without timeout_ms", async () => {
124
+ const { a } = linked_stores(() => false);
125
+ let settled = false;
126
+
127
+ a.get("b.value").finally(() => {
128
+ settled = true;
129
+ });
130
+ await wait(20);
131
+
132
+ assert.strictEqual(settled, false);
133
+ assert.strictEqual(Object.keys(a._requests).length, 1);
134
+ });
135
+
136
+ it("throws on an invalid timeout_ms", () => {
137
+ const a = new Entangld();
138
+
139
+ for (const timeout_ms of [0, -1, NaN, Infinity, 2147483648, "5", null]) {
140
+ assert.throws(() => a.get("value", undefined, { timeout_ms }), TypeError);
141
+ }
142
+ });
143
+ });
144
+
145
+ describe("call_rpc", () => {
146
+
147
+ it("rejects if a remote store never replies", async () => {
148
+ const { a } = linked_stores(() => false);
149
+
150
+ const err = await rejection(a.call_rpc("b.rpc", [1], { timeout_ms: 10 }));
151
+
152
+ assert(err instanceof EntangldTimeoutError);
153
+ assert.strictEqual(err.path, "b.rpc");
154
+ });
155
+
156
+ it("returns the result if the reply beats the timeout", async () => {
157
+ const { a, b } = linked_stores();
158
+ b.set_rpc("double", (value) => value * 2);
159
+
160
+ const value = await a.call_rpc("b.double", [4], { timeout_ms: 1000 });
161
+
162
+ assert.strictEqual(value, 8);
163
+ });
164
+
165
+ it("rejects on an invalid timeout_ms", async () => {
166
+ const a = new Entangld();
167
+
168
+ const err = await rejection(a.call_rpc("rpc", [], { timeout_ms: 0 }));
169
+
170
+ assert(err instanceof TypeError);
171
+ });
172
+ });
173
+ });
package/.gitmodules DELETED
@@ -1,3 +0,0 @@
1
- [submodule "libraries/unix/extern/json"]
2
- path = libraries/unix/extern/json
3
- url = https://github.com/nlohmann/json.git
package/README.hbs DELETED
@@ -1,190 +0,0 @@
1
- # Entangld
2
-
3
- Synchronized key-value stores with RPCs and pub/sub events. Works over sockets (try it with [Sockhop](https://www.npmjs.com/package/sockhop "Sockhop on NPM")!)
4
-
5
- ## Examples
6
- Basic use:
7
- ```js
8
- let e=new Entangld();
9
-
10
- // Simple set/get
11
- e.set("number.six",6);
12
- e.get("number.six").then((val)=>{}); // val==6
13
-
14
- // Functions as values
15
- e._deref_mode=true; // Or pass to constructor: new Entangld({ deref_mode: true });
16
- e.set("number.seven",()=>{ return 7;});
17
- e.get("number").then((val)=>{}); // val => { six:6, seven, 7}
18
-
19
- // Promises from functions
20
- e.set("number.eight",()=>{ return new Promise((resolve)=>{ resolve(8); }); });
21
- e.get("number.eight").then((val)=>{}); // val==8
22
-
23
- // Even dereference beneath functions
24
- e.set("eenie.meenie",()=>{ return {"miney": "moe"}; });
25
- e.get("eenie.meenie.miney").then((val)=>{}); // val=="moe"
26
-
27
- ```
28
-
29
- Pairing two data stores together:
30
- ```js
31
- let parent=new Entangld();
32
- let child=new Entangld();
33
-
34
- // Attach child namespace
35
- parent.attach("child",child);
36
-
37
- // Configure communications
38
- parent.transmit((msg, store) => store.receive(msg,parent)); // store will always be child
39
- child.transmit((msg, store) => store.receive(msg, child)); // store will always be parent
40
-
41
- // Set something in the child...
42
- child.set("system.voltage",33);
43
-
44
- // Get it back in the parent
45
- parent.get("child.system.voltage"); // == 33
46
- ```
47
- Using getter functions as RPC:
48
- ```js
49
- // Assign a function to a child key
50
- child.set("double.me",(param=0)=>param*2); // Or we could return a Promise instead of a value, if we wanted to!
51
-
52
- // Call the RPC from the parent
53
- parent.get("child.double.me", 2).then((val)=>{
54
-
55
- // val == 4
56
- });
57
-
58
- ```
59
- Note in this example how we set a default value for this getter function (0). This is because when _deref_mode is ```true``` this getter will be called without any arguments.
60
-
61
- Pub/sub (remote events):
62
- ```js
63
- // Assign an event callback
64
- parent.subscribe("child.system.voltage",(path, val)=>{
65
-
66
- // path=="child.system.voltage"
67
- // val==21
68
- });
69
-
70
- // Trigger a callback on the parent
71
- child.set("system.voltage",21);
72
-
73
-
74
- // Listen on the child for when the parent subscribes
75
- child.on("subscription", ( path, uuid ) => console.log("Parent subscribed to :" + path));
76
- parent.subscribe("child.system.voltage"); // Child prints: "Parent subscribed to : system.voltage"
77
-
78
- // Throttle the subscription callbacks, so that the callback is only called every 2 sets
79
- let counter = 0;
80
- parent.subscribe("child.rapid.data", () => counter += 1, 2);
81
- child.set("rapid.data", 1) // triggers callback
82
- child.set("rapid.data", 1) // doesn't trigger callback
83
- child.set("rapid.data", 1) // triggers callback
84
- child.set("rapid.data", 1) // doesn't trigger callback
85
- console.log( counter ); // === 2
86
-
87
- ```
88
- Over sockets:
89
- ```js
90
- const Sockhop=require("sockhop");
91
- const Entangld=require("entangld");
92
-
93
-
94
- /**
95
- * Parent / server setup
96
- */
97
-
98
- let parent=new Entangld();
99
- let server=new Sockhop.server();
100
-
101
- // Connect server to parent store
102
- parent.transmit((msg, store)=>server.send(store, msg));
103
- server
104
- .on("receive",(data, meta)=>parent.receive(data, meta.sock)) // Use the socket as the data store handle
105
- .on('connect',(sock)=>{
106
-
107
- parent.attach("client", sock); // "client" works for one client. Normally use uuid() or something
108
-
109
- parent.get("client.my.name")
110
- .then((val)=>{
111
-
112
- console.log("Client's name is "+val);
113
- server.close();
114
- });
115
- })
116
- .on('disconnect', (sock)=>parent.detach(null, sock))
117
- .on('error', (e)=>console.log("Sockhop error: "+e))
118
- .listen();
119
-
120
-
121
- /**
122
- * Child / client setup
123
- */
124
-
125
- let child=new Entangld();
126
- let client=new Sockhop.client();
127
-
128
- // Connect client to child store
129
- child.transmit((msg)=>client.send(msg));
130
- client
131
- .on("receive", (data, meta)=>child.receive(data))
132
- .on("connect", ()=>{
133
- // attach() to parent is optional, if we plan to get() parent items
134
- })
135
- .on("error", (e)=>console.log("Sockhop error: "+e))
136
- .connect();
137
-
138
- child.set("my.name", "Entangld");
139
- ```
140
-
141
-
142
- ## Raison d'etre
143
- Any object can store values. And a Map can store values keyed to objects. But what if you want to....
144
-
145
- - Have your store synchronized with multiple data sources (other stores)?
146
- - Over a network?
147
- - Subscribe to events within the datastore?
148
- - Support subscription wildcards?
149
-
150
- ## Notes
151
-
152
- - As of version 2.0.0, subscriptions all have uuids (which are the same across a chain of subscription objects, in the case of subscriptions to remote datastores), which supports multiple (remote or local) subscriptions to the same endpoint, but with different callback functions. The uuid of a subscription is available in the subscription object (a list of which is exposed from the datastore via `store.owned_subscriptions()`), and is also returned from the method call `store.subscribe("path.to.data")`. Having access to this uuid also allows the user to cancel specific subscriptions. The method call `store.unsubscribe(...)` will now either accept a path or a uuid. For paths, the method will terminate _all_ subscriptions matching that path, while for uuids, only the specific subscription matching that uuid will be canceled.
153
- - As of version 1.5.0, subscriptions may be created across multiple chained datastores. Subscription removal now acts on all subscriptions matching (but not beneath) a given path. To unsubscribe a tree, use ```unsubscribe_tree()```
154
- - As of version 1.2.0, attached datastores may be located at arbitrary paths, not just in the root:
155
- ```parent.attach("child.goes.here", child);```
156
- - Also as of 1.2.0, attach()ed child stores will appear in the parent as placeholders (empty objects) when .get() is called on paths within the parent. For example:
157
- ```
158
- child.set("",{"child" : "data" });
159
- parent.set("",{"parent" : "data"});
160
- parent.attach("child", child);
161
-
162
- parent.get(""); // Returns { "parent" : "data", "child" : {} }
163
- parent.get("child"); // Returns {"child" : "data"}
164
- ```
165
- This is because we would have to perform recursive child queries to show you a complete tree. This is left for a future version.
166
- - If you ```.set()``` a function, that function may return a value or a Promise. If it returns a promise, that promise will be returned directly to you when you call ```.get()```
167
- - As of version 1.4.0, you may subscribe() to a local event. This should probably be eventually replaced with native events. In other words, instead of ```.subscribe("a.b.c", callback)``` we should use ```.on("path.a.b.c", callback)```
168
-
169
- ## _deref_mode
170
- If you attach a key to a getter function instead of a value, that function would never be called until you request that key directly (i.e. querying the parent of that key would not reveal that that key exists). This changed in 1.2.1, when _deref_mode was introduced. If you set _deref_mode to true, it will iterate all leaves and try to call all functions. Those that return Promise will have their Promise resolved before the result is actually returned.
171
-
172
- This is pretty cool, and after consideration it is probably the way this thing should work all the time. However it also introduces two problems which are not yet resolved (//TODO):
173
-
174
- First, in an effort to not accidentally mutate the original data set, a copy is made. This is somewhat inefficient.
175
- Second, when the copy is made, JSON.parse/JSON.stringify are used. This means that leaves consisting of Map() or the like are just erased.
176
-
177
- If these two issues can be resolved at some point, _deref_mode will probably be turned on permanently. Honestly, for remote stores operating over sockets it's probably not a huge issue. More to the point are local stores where the user might be storing non JSON-compatible items.
178
-
179
- {{>main}}
180
-
181
- ## TODO
182
- - Make sure incoming values request store doesn't build up
183
- - When querying a parent, perhaps there should be an option to also dump child stores located below that level (potentially resource intensive)
184
- - Fix _deref_mode so it doesn't "strip" the returned object by turning everything to JSON and back (inefficient and it's basically mutating the result silently)
185
- - Fix unit tests so they are completely independent (tests often depend on prior test ending with a particular state)
186
- - Detaching a store does not unsubscribe to any subscriptions from or through that store and may therefore leave things in a dirty or unstable state. We could unsubscribe_tree(store_name) but that would not take care of passthrough subscriptions (those that don't belong to us)
187
- - unsubscribe_tree() needs to have a test ensuring errors are thrown if not all subs can be removed
188
-
189
- ## License
190
- MIT
package/tags DELETED
@@ -1,244 +0,0 @@
1
- !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
2
- !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
3
- !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
4
- !_TAG_PROGRAM_NAME Exuberant Ctags //
5
- !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
6
- !_TAG_PROGRAM_VERSION 5.9~svn20110310 //
7
- DEBUG_ERROR libraries/unix/samples/debug.h 27;" d line:27 language:C++
8
- DEBUG_H_ libraries/unix/samples/debug.h 9;" d line:9 language:C++
9
- DEBUG_INFO libraries/unix/samples/debug.h 39;" d line:39 language:C++
10
- DEBUG_LEVEL_ERROR libraries/unix/samples/debug.h 15;" d line:15 language:C++
11
- DEBUG_LEVEL_INFO libraries/unix/samples/debug.h 17;" d line:17 language:C++
12
- DEBUG_LEVEL_VERBOSE libraries/unix/samples/debug.h 18;" d line:18 language:C++
13
- DEBUG_LEVEL_WARN libraries/unix/samples/debug.h 16;" d line:16 language:C++
14
- DEBUG_VERBOSE libraries/unix/samples/debug.h 45;" d line:45 language:C++
15
- DEBUG_WARN libraries/unix/samples/debug.h 33;" d line:33 language:C++
16
- DEFAULT_HOST libraries/unix/samples/client.cpp /^constexpr char DEFAULT_HOST[] = "127.0.0.1"; \/**< Default host address. *\/$/;" v line:17 language:C++
17
- DEFAULT_PORT libraries/unix/samples/client.cpp /^constexpr int DEFAULT_PORT = 50001; \/**< Default host port. *\/$/;" v line:18 language:C++
18
- DEFAULT_PORT libraries/unix/samples/server.cpp /^constexpr int DEFAULT_PORT = 50001;$/;" v line:18 language:C++
19
- DEFAULT_TIMEOUT libraries/unix/samples/client.cpp /^constexpr int DEFAULT_TIMEOUT = 2000; \/**< Default timeout. *\/$/;" v line:19 language:C++
20
- Datastore libraries/unix/include/Datastore.h /^ explicit Datastore(const nlohmann::json &data = nlohmann::json::object())$/;" f line:28 language:C++ class:entangld::Datastore access:public signature:(const nlohmann::json &data = nlohmann::json::object())
21
- Datastore libraries/unix/include/Datastore.h /^ class Datastore {$/;" c line:22 language:C++ namespace:entangld
22
- Entangld index.js /^class Entangld extends EventEmitter {$/;" C line:572 language:JavaScript
23
- EntangldError index.js /^class EntangldError extends Error {$/;" C line:153 language:JavaScript
24
- Entangld_Message index.js /^class Entangld_Message {$/;" C line:33 language:JavaScript
25
- FIXME test/sockets.js /^\/\/ FIXME : comment out for debugging$/;" T line:9 language:JavaScript
26
- Message libraries/unix/include/Message.h /^ class Message {$/;" c line:17 language:C++ namespace:entangld
27
- Subscription index.js /^class Subscription {$/;" C line:166 language:JavaScript
28
- TODO test/tests.js /^ \/\/ TODO: Add a triple multiplexed store test$/;" T line:588 language:JavaScript
29
- VERSION libraries/unix/samples/server.cpp /^constexpr char VERSION[] = "1.0.0";$/;" v line:15 language:C++
30
- _ENTANGLD_DATASTORE_H_ libraries/unix/include/Datastore.h 9;" d line:9 language:C++
31
- _ENTANGLD_MESSAGE_H_ libraries/unix/include/Message.h 9;" d line:9 language:C++
32
- _get_remote_object index.js /^ _get_remote_object(path) {$/;" M line:915 language:JavaScript
33
- _has_cb index.js /^ this._has_cb = (typeof(callback) === "function");$/;" M line:189 language:JavaScript
34
- _is_counting index.js /^ this._is_counting = (this.downstream === null);$/;" M line:190 language:JavaScript
35
- _local_data index.js /^ this._local_data = {};$/;" P line:581 language:JavaScript
36
- _requests index.js /^ this._requests = {};$/;" P line:582 language:JavaScript
37
- _set_local index.js /^ _set_local(path, data, op_type="set", params={}) {$/;" M line:1276 language:JavaScript
38
- _subscribe index.js /^ _subscribe(path, func, upstream = null, uuid = null, every = null) {$/;" M line:1090 language:JavaScript
39
- _transmit index.js /^ this._transmit = () => { };$/;" M line:580 language:JavaScript
40
- _unsubscribe index.js /^ _unsubscribe(subscriptions) {$/;" M line:1240 language:JavaScript
41
- a test/tests.js /^ a: {$/;" P line:13 language:JavaScript
42
- a test/tests.js /^ a: {$/;" P line:243 language:JavaScript
43
- address test/sockets.js /^ address : "localhost",$/;" P line:129 language:JavaScript
44
- address test/sockets.js /^ address : "localhost",$/;" P line:20 language:JavaScript
45
- address test/sockets.js /^ address : "localhost",$/;" P line:25 language:JavaScript
46
- afterEach test/circular.js /^ afterEach(function() {$/;" M line:25 language:JavaScript
47
- afterEach test/sockets.js /^ afterEach(function() {$/;" M line:48 language:JavaScript
48
- afterEach test/subscriptions.js /^ afterEach(function() {$/;" M line:21 language:JavaScript
49
- attach index.js /^ attach(namespace, obj) {$/;" M line:642 language:JavaScript
50
- attach libraries/unix/src/Datastore.cpp /^ void Datastore::attach($/;" f line:232 language:C++ class:entangld::Datastore signature:( std::string name, void (*handler)(const Message &msg, void *ctx), void *ctx)
51
- b test/tests.js /^ b: {$/;" P line:14 language:JavaScript
52
- b test/tests.js /^ b: {$/;" P line:244 language:JavaScript
53
- beforeEach test/circular.js /^ beforeEach(function() {$/;" M line:10 language:JavaScript
54
- beforeEach test/sockets.js /^ beforeEach(function() {$/;" M line:15 language:JavaScript
55
- beforeEach test/subscriptions.js /^ beforeEach(function() {$/;" M line:7 language:JavaScript
56
- c test/tests.js /^ c: 6$/;" P line:15 language:JavaScript
57
- c test/tests.js /^ c: 6$/;" P line:245 language:JavaScript
58
- c test/tests.js /^ c: {},$/;" P line:540 language:JavaScript
59
- call index.js /^ call(...args) {$/;" M line:213 language:JavaScript
60
- callback index.js /^ callback : func,$/;" P line:1109 language:JavaScript
61
- callback libraries/unix/include/Datastore.h /^ void (*callback)(const Message &msg, void *ctx);$/;" m line:128 language:C++ struct:entangld::Datastore::__anon2 access:public
62
- callback_ctx libraries/unix/include/Datastore.h /^ void *callback_ctx;$/;" m line:131 language:C++ struct:entangld::Datastore::__anon2 access:public
63
- constructor index.js /^ constructor() {$/;" M line:574 language:JavaScript
64
- constructor index.js /^ constructor(message) {$/;" M line:154 language:JavaScript
65
- constructor index.js /^ constructor({path, uuid, callback, downstream, upstream, every}) {$/;" M line:183 language:JavaScript
66
- constructor index.js /^ constructor({type, path, value, uuid, params, every}) {$/;" M line:35 language:JavaScript
67
- d test/tests.js /^ d: {$/;" P line:18 language:JavaScript
68
- d test/tests.js /^ d: {$/;" P line:248 language:JavaScript
69
- debug_print libraries/unix/samples/debug.c /^void debug_print(int level, const char *file, int line, const char *format, ...)$/;" f line:27 language:C signature:(int level, const char *file, int line, const char *format, ...)
70
- dereferenced_copy index.js /^function dereferenced_copy(original) {$/;" F line:388 language:JavaScript
71
- describe test/circular.js /^describe("Circular References", function() {$/;" M line:7 language:JavaScript
72
- describe test/sockets.js /^describe("Sockets", function() {$/;" M line:12 language:JavaScript
73
- describe test/subscriptions.js /^describe("Subscription", function() {$/;" M line:4 language:JavaScript
74
- detach index.js /^ detach(namespace, obj) {$/;" M line:687 language:JavaScript
75
- detach libraries/unix/src/Datastore.cpp /^ void Datastore::detach(std::string name)$/;" f line:245 language:C++ class:entangld::Datastore signature:(std::string name)
76
- downstream index.js /^ downstream : (this.downstream === null ? null : true),$/;" M line:366 language:JavaScript
77
- downstream index.js /^ downstream : obj,$/;" P line:1106 language:JavaScript
78
- e test/tests.js /^ e: [$/;" P line:19 language:JavaScript
79
- e test/tests.js /^ e: {$/;" P line:249 language:JavaScript
80
- entangld libraries/unix/include/Datastore.h /^namespace entangld$/;" n line:19 language:C++
81
- entangld libraries/unix/include/Message.h /^namespace entangld$/;" n line:14 language:C++
82
- entangld libraries/unix/src/Datastore.cpp /^namespace entangld$/;" n line:38 language:C++ file:
83
- event index.js /^ static event(path, value, uuid) {$/;" M line:125 language:JavaScript
84
- every index.js /^ every : every$/;" P line:1110 language:JavaScript
85
- every index.js /^ every : every$/;" P line:113 language:JavaScript
86
- extract_from_path index.js /^function extract_from_path(obj, path) {$/;" F line:464 language:JavaScript
87
- eyes test/tests.js /^ eyes: "blue",$/;" P line:538 language:JavaScript
88
- eyes test/tests.js /^ eyes: "blue",$/;" P line:577 language:JavaScript
89
- f test/tests.js /^ f: {$/;" P line:21 language:JavaScript
90
- f test/tests.js /^ f: 7$/;" P line:250 language:JavaScript
91
- from_json libraries/unix/include/Message.h /^ static void from_json(const nlohmann::json &j, Message &msg)$/;" f line:48 language:C++ namespace:entangld signature:(const nlohmann::json &j, Message &msg)
92
- g test/tests.js /^ g: 7$/;" P line:22 language:JavaScript
93
- g_debug_level libraries/unix/samples/debug.c /^static int g_debug_level = 0;$/;" v line:12 language:C file:
94
- g_shutdown_flag libraries/unix/samples/client.cpp /^volatile bool g_shutdown_flag = false;$/;" v line:22 language:C++
95
- g_shutdown_flag libraries/unix/samples/server.cpp /^volatile bool g_shutdown_flag = false;$/;" v line:21 language:C++
96
- get index.js /^ get(path, params) {$/;" M line:955 language:JavaScript
97
- get index.js /^ static get(tree, get_params) {$/;" M line:56 language:JavaScript
98
- get libraries/unix/src/Datastore.cpp /^ void Datastore::get($/;" f line:47 language:C++ class:entangld::Datastore signature:( std::string path, void (*callback)(const Message &msg, void *ctx), void *callback_ctx, std::string uuid)
99
- get_uuidstring libraries/unix/src/Datastore.cpp /^static std::string get_uuidstring()$/;" f line:14 language:C++ file: signature:()
100
- h test/tests.js /^ h: 4$/;" P line:27 language:JavaScript
101
- handler libraries/unix/include/Datastore.h /^ Message::handler_t handler; \/**< Send a Message to this remote. *\/$/;" m line:112 language:C++ struct:entangld::Datastore::__anon1 access:public
102
- handler_ctx libraries/unix/include/Datastore.h /^ void *handler_ctx; \/**< User context passed to handler. *\/$/;" m line:113 language:C++ struct:entangld::Datastore::__anon1 access:public
103
- handler_t libraries/unix/include/Message.h /^ typedef void (*handler_t)(const Message &msg, void *ctx);$/;" t line:20 language:C++ class:entangld::Message access:public
104
- has_downstream index.js /^ get has_downstream() {$/;" M line:263 language:JavaScript
105
- has_upstream index.js /^ get has_upstream() {$/;" M line:275 language:JavaScript
106
- if index.js /^ if(params.limit) {$/;" M line:1316 language:JavaScript
107
- index index.js /^ this.index = (this.index + 1) % this.every;$/;" M line:216 language:JavaScript
108
- is_above index.js /^ is_above(path) {$/;" M line:349 language:JavaScript
109
- is_beneath index.js /^ is_beneath(path) {$/;" M line:339 language:JavaScript
110
- is_beneath index.js /^function is_beneath(a, b) {$/;" F line:545 language:JavaScript
111
- is_head index.js /^ get is_head() {$/;" M line:250 language:JavaScript
112
- is_pass_through index.js /^ get is_pass_through() {$/;" M line:232 language:JavaScript
113
- is_terminal index.js /^ get is_terminal() {$/;" M line:241 language:JavaScript
114
- it test/circular.js /^ it("Circular subscriptions don't break", function(done) {$/;" M line:31 language:JavaScript
115
- it test/sockets.js /^ it("Can get", function(done) {$/;" M line:70 language:JavaScript
116
- it test/sockets.js /^ it("Can remove subs for persistant sockets", function(done) {$/;" M line:82 language:JavaScript
117
- it test/sockets.js /^ it("Can remove subs for reconnected sockets", function(done) {$/;" M line:113 language:JavaScript
118
- it test/sockets.js /^ it("Can subscribe", function(done) {$/;" M line:56 language:JavaScript
119
- it test/sockets.js /^ it("Cannot remove subs for dropped sockets", function(done) {$/;" M line:97 language:JavaScript
120
- it test/subscriptions.js /^ it("Can have parallel subscriptions (locallly)", function(done) {$/;" M line:117 language:JavaScript
121
- it test/subscriptions.js /^ it("Can have parallel subscriptions (locallly)", function(done) {$/;" M line:161 language:JavaScript
122
- it test/subscriptions.js /^ it("Can have parallel subscriptions (remote)", function(done) {$/;" M line:175 language:JavaScript
123
- it test/subscriptions.js /^ it("Emit on each subscription", function(done) {$/;" M line:104 language:JavaScript
124
- it test/subscriptions.js /^ it("Should emit on recieved subscriptions (locally)", function(done) {$/;" M line:37 language:JavaScript
125
- it test/subscriptions.js /^ it("Should emit on recieved subscriptions (remote)", function(done) {$/;" M line:53 language:JavaScript
126
- it test/subscriptions.js /^ it("Should emit on recieved unsubscriptions (locally)", function(done) {$/;" M line:44 language:JavaScript
127
- it test/subscriptions.js /^ it("Should emit on recieved unsubscriptions (remote)", function(done) {$/;" M line:60 language:JavaScript
128
- it test/subscriptions.js /^ it("Should only trigger subscriptions on an exact match", function(done) {$/;" M line:27 language:JavaScript
129
- it test/subscriptions.js /^ it("Shouldn't emit on passthrough subscriptions (remote)", function(done) {$/;" M line:86 language:JavaScript
130
- it test/subscriptions.js /^ it("Shouldn't emit on passthrough unsubscriptions (remote)", function(done) {$/;" M line:94 language:JavaScript
131
- it test/subscriptions.js /^ it("Shouldn't emit on sent subscriptions (remote)", function(done) {$/;" M line:69 language:JavaScript
132
- it test/subscriptions.js /^ it("Shouldn't emit on sent unsubscriptions (remote)", function(done) {$/;" M line:77 language:JavaScript
133
- log test/sockets.js /^console.log = () => {};$/;" M line:10 language:JavaScript
134
- long_shared libraries/unix/samples/client.cpp /^static struct option long_shared[] = {$/;" v line:25 language:C++ typeref:struct:option file:
135
- long_shared libraries/unix/samples/server.cpp /^static struct option long_shared[] = {$/;" v line:24 language:C++ typeref:struct:option file:
136
- m_local_data libraries/unix/include/Datastore.h /^ nlohmann::json m_local_data;$/;" m line:153 language:C++ class:entangld::Datastore access:protected
137
- m_remotes libraries/unix/include/Datastore.h /^ std::unordered_map<std::string, remote_t> m_remotes;$/;" m line:156 language:C++ class:entangld::Datastore access:protected
138
- m_requests libraries/unix/include/Datastore.h /^ std::unordered_map<std::string, request_t> m_requests;$/;" m line:162 language:C++ class:entangld::Datastore access:protected
139
- m_subs libraries/unix/include/Datastore.h /^ std::vector<request_t> m_subs;$/;" m line:168 language:C++ class:entangld::Datastore access:protected
140
- main libraries/unix/samples/client.cpp /^int main(int argc, char *argv[])$/;" f line:58 language:C++ signature:(int argc, char *argv[])
141
- main libraries/unix/samples/server.cpp /^int main(int argc, char *argv[])$/;" f line:52 language:C++ signature:(int argc, char *argv[])
142
- main libraries/unix/test/0.misc/test_init.cpp /^int main()$/;" f line:7 language:C++ signature:()
143
- main libraries/unix/test/1.get/test_get_basic.cpp /^int main()$/;" f line:7 language:C++ signature:()
144
- main libraries/unix/test/1.get/test_get_nested.cpp /^int main()$/;" f line:7 language:C++ signature:()
145
- main libraries/unix/test/1.get/test_get_remote.cpp /^int main()$/;" f line:7 language:C++ signature:()
146
- main libraries/unix/test/2.set/test_set_basic.cpp /^int main()$/;" f line:8 language:C++ signature:()
147
- main libraries/unix/test/2.set/test_set_nested.cpp /^int main()$/;" f line:8 language:C++ signature:()
148
- main libraries/unix/test/2.set/test_set_remote.cpp /^int main()$/;" f line:7 language:C++ signature:()
149
- main libraries/unix/test/3.sub/test_sub_basic.cpp /^int main(int argc, char *argv[])$/;" f line:10 language:C++ signature:(int argc, char *argv[])
150
- main libraries/unix/test/3.sub/test_sub_nested.cpp /^int main(int argc, char *argv[])$/;" f line:10 language:C++ signature:(int argc, char *argv[])
151
- main libraries/unix/test/3.sub/test_sub_remote.cpp /^int main(int argc, char *argv[])$/;" f line:10 language:C++ signature:(int argc, char *argv[])
152
- main libraries/unix/test/4.unsub/test_unsub_basic.cpp /^int main(int argc, char *argv[])$/;" f line:10 language:C++ signature:(int argc, char *argv[])
153
- main libraries/unix/test/4.unsub/test_unsub_remote.cpp /^int main(int argc, char *argv[])$/;" f line:10 language:C++ signature:(int argc, char *argv[])
154
- matches_event_message index.js /^ matches_event_message(msg) {$/;" M line:296 language:JavaScript
155
- matches_path index.js /^ matches_path(path) {$/;" M line:319 language:JavaScript
156
- matches_subscription index.js /^ matches_subscription(sub) {$/;" M line:286 language:JavaScript
157
- matches_unsubscribe_message index.js /^ matches_unsubscribe_message(msg) {$/;" M line:309 language:JavaScript
158
- matches_uuid index.js /^ matches_uuid(uuid) {$/;" M line:329 language:JavaScript
159
- more_stores test/tests.js /^ more_stores: {$/;" P line:539 language:JavaScript
160
- more_stores test/tests.js /^ more_stores: {$/;" P line:578 language:JavaScript
161
- msg libraries/unix/include/Datastore.h /^ Message msg;$/;" m line:119 language:C++ struct:entangld::Datastore::__anon2 access:public
162
- name libraries/unix/include/Datastore.h /^ std::string name; \/**< Namespace the store is mapped to. *\/$/;" m line:111 language:C++ struct:entangld::Datastore::__anon1 access:public
163
- namespace index.js /^ namespace(store) {$/;" M line:627 language:JavaScript
164
- namespaces index.js /^ get namespaces() {$/;" M line:603 language:JavaScript
165
- p index.js /^ let p = (result && result.constructor && result.constructor.name$/;" F line:977 language:JavaScript
166
- params index.js /^ params : params$/;" P line:888 language:JavaScript
167
- params index.js /^ params : params$/;" P line:97 language:JavaScript
168
- parse_namespace libraries/unix/src/Datastore.cpp /^ std::string Datastore::parse_namespace(std::string path)$/;" f line:322 language:C++ class:entangld::Datastore signature:(std::string path)
169
- partial_copy index.js /^function partial_copy(o, max_depth) {$/;" F line:506 language:JavaScript
170
- path index.js /^ path : path,$/;" P line:1105 language:JavaScript
171
- path index.js /^ path : path,$/;" P line:128 language:JavaScript
172
- path index.js /^ path : tree,$/;" P line:111 language:JavaScript
173
- path index.js /^ path : tree,$/;" P line:95 language:JavaScript
174
- path libraries/unix/include/Message.h /^ nlohmann::json path; \/**< Datastore path that the message is referencing. *\/$/;" m line:23 language:C++ class:entangld::Message access:public
175
- port test/sockets.js /^ port : 9876$/;" P line:130 language:JavaScript
176
- port test/sockets.js /^ port : 9876$/;" P line:21 language:JavaScript
177
- port test/sockets.js /^ port : 9876$/;" P line:26 language:JavaScript
178
- print_help libraries/unix/samples/client.cpp /^static void print_help(const char *name)$/;" f line:36 language:C++ file: signature:(const char *name)
179
- print_help libraries/unix/samples/server.cpp /^static void print_help(const char *name)$/;" f line:34 language:C++ file: signature:(const char *name)
180
- ptr libraries/unix/include/Datastore.h /^ nlohmann::json::json_pointer ptr;$/;" m line:125 language:C++ struct:entangld::Datastore::__anon2 access:public
181
- push index.js /^ push(path, data, limit=null) {$/;" M line:828 language:JavaScript
182
- push libraries/unix/include/Datastore.h /^ inline void push(std::string path, nlohmann::json value)$/;" f line:103 language:C++ class:entangld::Datastore access:public signature:(std::string path, nlohmann::json value)
183
- receive index.js /^ receive(msg, obj) {$/;" M line:734 language:JavaScript
184
- receive libraries/unix/src/Datastore.cpp /^ void Datastore::receive(const Message &msg, std::string name)$/;" f line:250 language:C++ class:entangld::Datastore signature:(const Message &msg, std::string name)
185
- recurse index.js /^ function recurse(o, c, parent, key) {$/;" F line:406 language:JavaScript
186
- remote libraries/unix/include/Datastore.h /^ remote_t *remote;$/;" m line:122 language:C++ struct:entangld::Datastore::__anon2 access:public
187
- remote_t libraries/unix/include/Datastore.h /^ } remote_t;$/;" t line:114 language:C++ class:entangld::Datastore typeref:struct:entangld::Datastore::__anon1 access:protected
188
- request_t libraries/unix/include/Datastore.h /^ } request_t;$/;" t line:132 language:C++ class:entangld::Datastore typeref:struct:entangld::Datastore::__anon2 access:protected
189
- reset libraries/unix/src/Datastore.cpp /^ void Datastore::reset()$/;" f line:40 language:C++ class:entangld::Datastore signature:()
190
- set index.js /^ set(path, data, operation_type="set", params={}) {$/;" M line:846 language:JavaScript
191
- set libraries/unix/src/Datastore.cpp /^ void Datastore::set(std::string path, nlohmann::json value, bool push)$/;" f line:89 language:C++ class:entangld::Datastore signature:(std::string path, nlohmann::json value, bool push)
192
- set_debug_level libraries/unix/samples/debug.c /^void set_debug_level(int debug_level)$/;" f line:14 language:C signature:(int debug_level)
193
- setpush index.js /^ static setpush({type = "set", tree, value, params}) {$/;" M line:91 language:JavaScript
194
- static_copy index.js /^ static_copy() {$/;" M line:362 language:JavaScript
195
- subscribe index.js /^ static subscribe(tree, uuid, every = null) {$/;" M line:108 language:JavaScript
196
- subscribe index.js /^ subscribe(path, func, every = null) {$/;" M line:1067 language:JavaScript
197
- subscribe libraries/unix/src/Datastore.cpp /^ void Datastore::subscribe($/;" f line:138 language:C++ class:entangld::Datastore signature:( std::string path, void (*callback)(const Message &msg, void *ctx), void *callback_ctx, std::string uuid)
198
- subscribed_to index.js /^ subscribed_to(path) {$/;" M line:1145 language:JavaScript
199
- subscriptions index.js /^ get subscriptions() {$/;" M line:617 language:JavaScript
200
- test_done libraries/unix/test/3.sub/test_sub_basic.cpp /^volatile bool test_done[3] = {false, false, false};$/;" v line:8 language:C++
201
- test_done libraries/unix/test/3.sub/test_sub_nested.cpp /^volatile bool test_done = false;$/;" v line:8 language:C++
202
- test_done libraries/unix/test/3.sub/test_sub_remote.cpp /^volatile bool test_done[2] = {false, false};$/;" v line:8 language:C++
203
- test_done libraries/unix/test/4.unsub/test_unsub_basic.cpp /^volatile bool test_done[3] = {false, false, false};$/;" v line:8 language:C++
204
- test_done libraries/unix/test/4.unsub/test_unsub_remote.cpp /^volatile bool test_done[2] = {false, false};$/;" v line:8 language:C++
205
- title test/tests.js /^ title: "store C is located at this level"$/;" P line:541 language:JavaScript
206
- title test/tests.js /^ title: "store C is located at this level"$/;" P line:579 language:JavaScript
207
- to_json libraries/unix/include/Message.h /^ static void to_json(nlohmann::json &j, const Message &msg)$/;" f line:33 language:C++ namespace:entangld signature:(nlohmann::json &j, const Message &msg)
208
- transmit index.js /^ transmit(func) {$/;" M line:715 language:JavaScript
209
- transmit libraries/unix/include/Datastore.h /^ static inline void transmit(remote_t *remote, const Message &msg)$/;" f line:147 language:C++ class:entangld::Datastore access:protected signature:(remote_t *remote, const Message &msg)
210
- tree index.js /^ tree : tree,$/;" P line:886 language:JavaScript
211
- type index.js /^ type : operation_type,$/;" P line:885 language:JavaScript
212
- type index.js /^ type : "event",$/;" P line:127 language:JavaScript
213
- type index.js /^ type : "subscribe",$/;" P line:110 language:JavaScript
214
- type index.js /^ type: "get",$/;" P line:58 language:JavaScript
215
- type index.js /^ type: "unsubscribe",$/;" P line:142 language:JavaScript
216
- type index.js /^ type: "value",$/;" P line:74 language:JavaScript
217
- type index.js /^ type: type,$/;" P line:94 language:JavaScript
218
- type libraries/unix/include/Message.h /^ std::string type; \/**< Message type. @see Datastore::receive *\/$/;" m line:22 language:C++ class:entangld::Message access:public
219
- unsubscribe index.js /^ static unsubscribe(uuid) {$/;" M line:140 language:JavaScript
220
- unsubscribe index.js /^ unsubscribe(path_or_uuid) {$/;" M line:1166 language:JavaScript
221
- unsubscribe libraries/unix/src/Datastore.cpp /^ int Datastore::unsubscribe(std::string path, std::string uuid)$/;" f line:183 language:C++ class:entangld::Datastore signature:(std::string path, std::string uuid)
222
- unsubscribe_tree index.js /^ unsubscribe_tree(path) {$/;" M line:1205 language:JavaScript
223
- upstream index.js /^ upstream : (this.upstream === null ? null : true),$/;" M line:367 language:JavaScript
224
- upstream index.js /^ upstream : upstream,$/;" P line:1107 language:JavaScript
225
- uuid index.js /^ uuid : uuid,$/;" P line:1108 language:JavaScript
226
- uuid index.js /^ uuid : uuid$/;" P line:130 language:JavaScript
227
- uuid index.js /^ uuid : uuid$/;" P line:144 language:JavaScript
228
- uuid index.js /^ uuid : uuid,$/;" P line:112 language:JavaScript
229
- uuid libraries/unix/include/Message.h /^ std::string uuid; \/**< Unique identifier for request tracking. *\/$/;" m line:24 language:C++ class:entangld::Message access:public
230
- uuid1 test/subscriptions.js /^ let uuid1 = s.subscribe("path2.B.some_data", () => {count += 1});$/;" F line:251 language:JavaScript
231
- uuid1 test/subscriptions.js /^ let uuid1 = s.subscribe("some_data", () => {count += 1});$/;" F line:220 language:JavaScript
232
- uuid2 test/subscriptions.js /^ let uuid2 = a.subscribe("path3.B.some_data", () => {count += 1})$/;" F line:252 language:JavaScript
233
- uuid2 test/subscriptions.js /^ let uuid2 = s.subscribe("some_data", () => {count += 1});$/;" F line:221 language:JavaScript
234
- uuids index.js /^ const uuids = subscriptions.map(s => s.uuid);$/;" F line:1243 language:JavaScript
235
- value index.js /^ value : data,$/;" P line:887 language:JavaScript
236
- value index.js /^ value : get_params,$/;" P line:60 language:JavaScript
237
- value index.js /^ value : value,$/;" P line:129 language:JavaScript
238
- value index.js /^ value : value,$/;" P line:76 language:JavaScript
239
- value index.js /^ value : value,$/;" P line:96 language:JavaScript
240
- value index.js /^ static value(get_msg, value) {$/;" M line:72 language:JavaScript
241
- value libraries/unix/include/Message.h /^ nlohmann::json value; \/**< Message payload. *\/$/;" m line:25 language:C++ class:entangld::Message access:public
242
- wait test/circular.js /^function wait (ms) {$/;" F line:3 language:JavaScript
243
- wait test/sockets.js /^function wait (ms) {$/;" F line:5 language:JavaScript
244
- while index.js /^ while(A.length && B.length){$/;" M line:557 language:JavaScript