Skip to content

Specification of Node Commands

Jiri Hnidek edited this page Aug 19, 2014 · 12 revisions

Node Commands

Node commands are commands used for creating/destroying of nodes. This group of commands also includes commands used for changing properties nodes and relations between nodes and users. Keep in mind that sending any of command does not guarantee changing setting required value. You can be sure about changing of node value only in situation, when server send corresponding command back to you.

Node Create

Following command is used for creating new node. Client sends this command, when creating of new node at Verse server is requested. Creating of new node is guaranteed, when resource limit at Verse server are not exceeded. Verse server sends this command in two cases.

  1. New node is created at Verse server
  2. Client was subscribed to node including child nodes

Command for creating new node has following structure:

  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| O | L | S | UsrId |   Parent ID   |    Node ID    |   CT  |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

More detail description of structure:

 0                   1         1         2     2             3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+---------------+
|   OpCode=32   |
+---------------+
|   Length=15   |
+---------------+
|  Share=0/4/6  |
+---------------+---------------+
|           User ID             |*
+---------------+---------------+---------------+---------------+
|                          Parent ID                            |*
+---------------+---------------+---------------+---------------+
|                           Node ID                             |
+---------------+---------------+---------------+---------------+
|         Custom Type           |
+---------------+---------------+

Items of this command has following purpose:

  • OpCode: identifier of this command type.
  • Length: minimal length of this command.
  • Share: the length of address in bytes that is shared between commands with same OpCode.
  • User ID: the unique identifier of owner of this node. When verse client sends this command to the server, then this ID has to be same as ID of client user.
  • Parent ID: the unique identifier of node that is parent of this node. When verse client sends this command to the server, then this ID has to be same as ID of client avatar node.
  • Node ID: the unique identifier of node. When verse client sends this command to the server, then this item has to have value -1 (0xFFFFFFFF).
  • Custom Type: user defined type of this node. Nodes created by client can have Custom Type in range 32-65535. Lower values are reserved for special nodes created by server (User Nodes, Avatar Nodes, etc.).

Node: All items of commands marked with * can be shared, when command compression is used.

Example of Command Compression and Address Sharing

Consider sending two following commands:

  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 32| 15| 0 |  100  |     10000     |     20001     |  101  |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 32| 15| 0 |  100  |     10000     |     20002     |  102  |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

It is a little inefficient, because first 9 bytes in both commands are the same. Thus it would be nice to compress two commands into the one command. It is possible, because each command has item length and command node create has even item share. Item share tells how many bytes of address is shared between commands compressed into one command.

Two node create commands can be then compressed into the one node create command. Item share has value 6 in this case, because two items of address: User ID=100 and Parent ID=1000 are the same between two original commands:

  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 32| 21| 6 |  100  |     10000     |     20001     |  101  |     20002     |  102  |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Node Destroy

Following command is used for destroying existing node. Clients sends this command, when destroying of existing node is requested. Server send this command, when node was destroyed.

Command has following structure:

  0   1   2   3   4   5
+---+---+---+---+---+---+
| O | L |    Node ID    |
+---+---+---+---+---+---+

More detail description of structure:

 0                   1         1         2     2             3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+---------------+
|   OpCode=33   |
+---------------+
|   Length=6    |
+---------------+---------------+---------------+---------------+
|                            Node ID                            |
+---------------+---------------+---------------+---------------+
  • OpCode: identifier of this command type.
  • Length: minimal length of this command.
  • Node ID: the unique identifier of node that will be deleted or was deleted.

Example of Command Compression

Despite this command does not have item share command compression could be used in this case too. Example of two commands node destroy compressed into the one command follows:

  0   1   2   3   4   5   6   7   8   9
+---+---+---+---+---+---+---+---+---+---+
| 33| 9 |     10001     |     10007     |
+---+---+---+---+---+---+---+---+---+---+

Node Subscribe

Only client sends following command, when it wants to subscribe to data stored in node.

  0   1   2   3   4   5   6   7   8   9   10  11  12  13
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| O | L |    Node ID    |    Version    |     CRC32     |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

More detail description of structure:

 0                   1         1         2     2             3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+---------------+
|   OpCode=34   |
+---------------+
|   Length=14   |
+---------------+---------------+---------------+---------------+
|                            Node ID                            |
+---------------+---------------+---------------+---------------+
|                            Version                            |
+---------------+---------------+---------------+---------------+
|                             CRC32                             |
+---------------+---------------+---------------+---------------+
  • OpCode: identifier of this command type.
  • Length: minimal length of this command.
  • Node ID: the unique identifier of node
  • Version: the version of node (not supported yet, should be 0)
  • CRC32: CRC32 sum of data stored in node (not supported yet, should be 0)

Node Unsubscribe

Client sends following code, when client is no more interested in data stored in node.

  0   1   2   3   4   5   6   7   8   9   10  11  12  13
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| O | L |    Node ID    |    Version    |     CRC32     |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

More detail description:

 0                   1         1         2     2             3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+---------------+
|   OpCode=35   |
+---------------+
|   Length=14   |
+---------------+---------------+---------------+---------------+
|                            Node ID                            |
+---------------+---------------+---------------+---------------+
|                            Version                            |
+---------------+---------------+---------------+---------------+
|                             CRC32                             |
+---------------+---------------+---------------+---------------+
  • OpCode: identifier of this command type.
  • Length: minimal length of this command.
  • Node ID: the unique identifier of node
  • Version: the version of node (not supported yet, should be 0)
  • CRC32: CRC32 sum of data stored in node (not supported yet, should be 0)

Node Link

This command is sent, when node changes it's own parent node. This command can be sent by client and server.

  0   1   2   3   4   5   6   7   8   9   10
+---+---+---+---+---+---+---+---+---+---+---+
| O | L | S |   Parent ID   |    Child ID   |
+---+---+---+---+---+---+---+---+---+---+---+

More detail description:

 0                   1         1         2     2             3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+---------------+
|   OpCode=37   |
+---------------+
|   Length=11   |
+---------------+
|   Share=0/4   |
+---------------+---------------+---------------+---------------+
|                         Parent Node ID                        |*
+---------------+---------------+---------------+---------------+
|                          Child Node ID                        |
+---------------+---------------+---------------+---------------+
  • OpCode: identifier of this command type.
  • Length: minimal length of this command.
  • Share: the length of address in bytes that is shared between commands with same OpCode.
  • Parent Node ID: ID of new parent node
  • Child Node ID: ID of node changing it's own node

Node Permissions

This commands is used for setting or changing user permissions for specific node.

  0   1   2   3   4   5   6   7   8   9
+---+---+---+---+---+---+---+---+---+---+
| O | L | S | UsrId | P |    Node ID    |
+---+---+---+---+---+---+---+---+---+---+

More detail description of structure:

 0                   1         1         2     2             3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+---------------+
|   OpCode=38   |
+---------------+
|   Length=10   |
+---------------+
|  Share=0/4/6  |
+---------------+---------------+
|           User ID             |*
+---------------+---------------+
|  Permissions  |*
+---------------+---------------+---------------+---------------+
|                           Node ID                             |
+---------------+---------------+---------------+---------------+
  • OpCode: identifier of this command type.
  • Length: minimal length of this command.
  • Share: the length of address in bytes that is shared between commands with same OpCode.
  • User ID: permissions will be granted to user with this user ID
  • Permissions: new permissions
  • Node ID: ID of node with new permissions

Node Umask

When new node is created, then owner of the node can read and write to the node. Access permission for other users is influenced by access permission of fake user called "Other Users". Default access permissions for "Other Users" is read-only. Following command can be used for setting access permission for "other users" for new node.

  0   1   2
+---+---+---+
| O | L | P |
+---+---+---+

More detail description of structure:

 0 1 2 3 4 5 6 7
+---------------+
|   OpCode=39   |
+---------------+
|   Length=3    |
+---------------+
|  Permissions  |
+---------------+
  • OpCode: identifier of this command type.
  • Length: minimal length of this command.
  • Permissions: new default permissions for other users

Node Owner

Following command can be used for setting new owner of node. Only owner of the node can change owner to other user.

  0   1   2   3   4   5   6   7   8
+---+---+---+---+---+---+---+---+---+
| O | L | S | UsrId |    Node ID    |
+---+---+---+---+---+---+---+---+---+

More detail description of structure:

 0                   1         1         2     2             3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
+---------------+
|   OpCode=40   |
+---------------+
|   Length=9    |
+---------------+
|   Share=0/4   |
+---------------+---------------+
|           User ID             |*
+---------------+---------------+---------------+---------------+
|                           Node ID                             |
+---------------+---------------+---------------+---------------+
  • OpCode: identifier of this command type.
  • Length: minimal length of this command.
  • Share: the length of address in bytes that is shared between commands with same OpCode.
  • User ID: new owner of the node
  • Node ID: ID of node with new owner

Note: Changing of node owner will be changed in the future, because new owner can not decline ownership of the node. Thus new specification of changing node ownership will incorporate some negotiation between clients.

Node Lock

Following command could be used for locking node. Client can lock node, when client has write permissions to node and node is not already locked by other client.

  0   1   2   3   4   5   6   7   8   9   10
+---+---+---+---+---+---+---+---+---+---+---+
| O | L | S |   Avatar ID   |    Node ID    |
+---+---+---+---+---+---+---+---+---+---+---+

More detail description of structure:

 0                   1         1         2     2             3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+---------------+
|   OpCode=41   |
+---------------+
|   Length=11   |
+---------------+
|   Share=0/4   |
+---------------+---------------+---------------+---------------+
|                          Avatar ID                            |*
+---------------+---------------+---------------+---------------+
|                           Node ID                             |
+---------------+---------------+---------------+---------------+
  • OpCode: identifier of this command type.
  • Length: minimal length of this command.
  • Share: the length of address in bytes that is shared between commands with same OpCode.
  • Avatar ID: ID of client locking node. When client sends this command, then this value has to be equal to it's own avatar ID.
  • Node ID: ID of node that will be locked

Node Unlock

Following code could be used for unlocking node. Client can unlock node, which is already locked by this client.

  0   1   2   3   4   5   6   7   8   9   10
+---+---+---+---+---+---+---+---+---+---+---+
| O | L | S |   Avatar ID   |    Node ID    |
+---+---+---+---+---+---+---+---+---+---+---+

More detail description of structure:

 0                   1         1         2     2             3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+---------------+
|   OpCode=42   |
+---------------+
|   Length=11   |
+---------------+
|   Share=0/4   |
+---------------+---------------+---------------+---------------+
|                          Avatar ID                            |*
+---------------+---------------+---------------+---------------+
|                           Node ID                             |
+---------------+---------------+---------------+---------------+
  • OpCode: identifier of this command type.
  • Length: minimal length of this command.
  • Share: the length of address in bytes that is shared between commands with same OpCode.
  • Avatar ID: ID of client unlocking node. When client sends this command, then this value has to be equal to it's own avatar ID.
  • Node ID: ID of node that will be unlocked

Node Priority

When client change priority of node, then this information will be sent to the server by following command. This code is never received from server. Node priority is property that is session specific.

  0   1   2   3   4   5   6   7
+---+---+---+---+---+---+---+---+
| O | L | S | P |    Node ID    |
+---+---+---+---+---+---+---+---+

More detail description of structure:

 0                   1         1         2     2             3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+---------------+
|   OpCode=43   |
+---------------+
|   Length=8    |
+---------------+
|   Share=0/1   |
+---------------+
|   Priority    |*
+---------------+---------------+---------------+---------------+
|                           Node ID                             |
+---------------+---------------+---------------+---------------+
  • OpCode: identifier of this command type.
  • Length: minimal length of this command.
  • Share: the length of address in bytes that is shared between commands with same OpCode.
  • Priority: new priority of the node
  • Node ID: ID of node that will have new priority for this session
Clone this wiki locally