|
@@ -1,18 +1,19 @@
|
|
|
EliasDB Event Condition Action Language
|
|
|
=======================================
|
|
|
|
|
|
-EliasDB supports a scripting language called [Event Condition Action Language (ECAL)](https://devt.de/krotik/ecal/) to enable rule based scripting functionality. ECAL provides [database trigger](https://en.wikipedia.org/wiki/Database_trigger) functionality for EliasDB.
|
|
|
+EliasDB supports a scripting language called [Event Condition Action Language (ECAL)](ecal-lang.md) to enable rule based scripting functionality. ECAL provides [database trigger](https://en.wikipedia.org/wiki/Database_trigger) functionality for EliasDB.
|
|
|
|
|
|
ECAL was added for the following use-cases:
|
|
|
- Providing a way to manipulate data in response to events
|
|
|
- Enforce certain aspects of a database schema
|
|
|
- Providing back-end logic for web applications using EliasDB
|
|
|
|
|
|
-The source of EliasDB comes with a game example which demonstrates some aspects of ECAL. See the documentation here: [TODO Link to documentation]
|
|
|
+The source of EliasDB comes with a [game example](examples/game/doc/game.md) which demonstrates a more complex application of ECAL.
|
|
|
|
|
|
ECAL related config values:
|
|
|
--
|
|
|
These ECAL related config options are available in `eliasdb.config.json`:
|
|
|
+
|
|
|
| Configuration Option | Description |
|
|
|
| --- | --- |
|
|
|
| EnableECALScripts | Enable ECAL scripting. |
|
|
@@ -34,35 +35,34 @@ EliasDB specific events which can be handled:
|
|
|
--
|
|
|
The ECAL interpreter in EliasDB receives the following events:
|
|
|
|
|
|
-Web Request | ECAL event kind | Event state contents | Description
|
|
|
--|-|-|-
|
|
|
-/db/api/|`db.web.api`| bodyJSON, bodyString, header, method, path, pathList, query | Any web request to /db/api/... These endpoints are public and never require authentication.
|
|
|
-/db/ecal/|`db.web.ecal`| bodyJSON, bodyString, header, method, path, pathList, query | Any web request to /db/ecal/... These endpoints are considered internal and require authentication if access control is enabled.
|
|
|
-/db/sock/|`db.web.sock`| bodyJSON, bodyString, commID, header, method, path, pathList, query | Any web request to /db/sock/... These endpoints are used to initiate websocket connections.
|
|
|
--|`db.web.sock.data`| commID, data, header, method, path, pathList, query | An existing websocket connection received some JSON object data. If the close attribute of the object is set to true then the websocket connection is closed.
|
|
|
+| Web Request | ECAL event kind | Event state contents | Description |
|
|
|
+| --- | ---| --- | --- |
|
|
|
+| /db/api/|`db.web.api`| bodyJSON, bodyString, header, method, path, pathList, query | Any web request to /db/api/... These endpoints are public and never require authentication. |
|
|
|
+| /db/ecal/|`db.web.ecal`| bodyJSON, bodyString, header, method, path, pathList, query | Any web request to /db/ecal/... These endpoints are considered internal and require authentication if access control is enabled. |
|
|
|
+| /db/sock/|`db.web.sock`| bodyJSON, bodyString, commID, header, method, path, pathList, query | Any web request to /db/sock/... These endpoints are used to initiate websocket connections. |
|
|
|
+| - |`db.web.sock.data`| commID, data, header, method, path, pathList, query | An existing websocket connection received some JSON object data. If the close attribute of the object is set to true then the websocket connection is closed. |
|
|
|
+
|
|
|
+| EliasDB Graph Event | ECAL event kind | Event state contents | Description |
|
|
|
+| --- | --- | --- | --- |
|
|
|
+| graph.EventNodeCreated | `db.node.created` | part, trans, node | A node was created. |
|
|
|
+| graph.EventNodeUpdated | `db.node.updated` | part, trans, node, old_node | A node was updated. |
|
|
|
+| graph.EventNodeDeleted | `db.node.deleted` | part, trans, node | A node was deleted. |
|
|
|
+| graph.EventEdgeCreated | `db.edge.created` | part, trans, edge | An edge was created. |
|
|
|
+| graph.EventEdgeUpdated | `db.edge.updated` | part, trans, edge, old_edge | An edge was updated. |
|
|
|
+| graph.EventEdgeDeleted | `db.edge.deleted` | part, trans, edge | An edge was deleted. |
|
|
|
+| graph.EventNodeStore | `db.node.store` | part, trans, node | A node is about to be stored (always overwriting existing values). |
|
|
|
+| graph.EventNodeUpdate | `db.node.update` | part, trans, node | A node is about to be updated. |
|
|
|
+| graph.EventNodeDelete | `db.node.delete` | part, trans, key, kind | A node is about to be deleted. |
|
|
|
+| graph.EventEdgeStore | `db.edge.store` | part, trans, edge | An edge is about to be stored. |
|
|
|
+| graph.EventEdgeDelete | `db.edge.delete` | part, trans, key, kind | An edge is about to be deleted. |
|
|
|
|
|
|
-EliasDB can receive the following events from the ECAL interpreter:
|
|
|
+Note: EliasDB will wait for the event cascade to be finished before performing the actual operation (e.g. inserting a node). If the event handling requires a time consuming operation then a new parallel event cascade can be started using `addEvent` with a scope:
|
|
|
|
|
|
-ECAL event kind | Event state contents | Description
|
|
|
--|-|-
|
|
|
-db.web.sock.msg | commID, payload, close | The payload is send to a client with an open websocket identified by the commID.
|
|
|
-
|
|
|
-
|
|
|
-EliasDB Graph Event | ECAL event kind | Event state contents | Description
|
|
|
--|-|-|-
|
|
|
-graph.EventNodeCreated | `db.node.created` | part, trans, node | A node was created.
|
|
|
-graph.EventNodeUpdated | `db.node.updated` | part, trans, node, old_node | A node was updated.
|
|
|
-graph.EventNodeDeleted | `db.node.deleted` | part, trans, node | A node was deleted.
|
|
|
-graph.EventEdgeCreated | `db.edge.created` | part, trans, edge | An edge was created.
|
|
|
-graph.EventEdgeUpdated | `db.edge.updated` | part, trans, edge, old_edge | An edge was updated.
|
|
|
-graph.EventEdgeDeleted | `db.edge.deleted` | part, trans, edge | An edge was deleted.
|
|
|
-graph.EventNodeStore | `db.node.store` | part, trans, node | A node is about to be stored (always overwriting existing values).
|
|
|
-graph.EventNodeUpdate | `db.node.update` | part, trans, node | A node is about to be updated.
|
|
|
-graph.EventNodeDelete | `db.node.delete` | part, trans, key, kind | A node is about to be deleted.
|
|
|
-graph.EventEdgeStore | `db.edge.store` | part, trans, edge | An edge is about to be stored.
|
|
|
-graph.EventEdgeDelete | `db.edge.delete` | part, trans, key, kind | An edge is about to be deleted.
|
|
|
+EliasDB can receive the following events from the ECAL interpreter:
|
|
|
|
|
|
-Note: EliasDB will wait for the event cascade to be finished before performing the actual operation (e.g. inserting a node). If the event handling requires a time consuming operation then a new parallel event cascade can be started using `addEvent` with a scope:
|
|
|
+| ECAL event kind | Event state contents | Description |
|
|
|
+| --- | --- | --- |
|
|
|
+| db.web.sock.msg | commID, payload, close | The payload is send to a client with an open websocket identified by the commID. |
|
|
|
```
|
|
|
addEvent("request", "foo.bar.xxx", {
|
|
|
"payload" : 123
|