Elko: Repository Protocols

The Elko Repository Protocols

The Repository

The Repository is an Elko server that provides persistent storage for objects. Context servers can be configured to use either a local repository that they access directly or to communicate with a Repository server. The protocols described here are for the latter case.

A Repository understands two different JSON message protocols. These correspond to the two kinds of actors who may wish to communicate with a Repository: other servers seeking to retrieve or store persistent objects, and administrators. Each of the ports that a Repository listens for connections on can be configured to support either or both of these protocols.

Each of these protocols is associated with a particular object ref to which messages should be addressed:

Repository Protocol

The repository protocol is used by clients who wish to access the persistent objects that the Repository manages.

get

→ { to:"rep", op:"get", what:[REQUESTDESC], tag:?STR }

This message requests the retrieval of the persistent state of one or more objects.

An object request descriptor takes the form:

{ type:"reqi", ref:STR, contents:?BOOL }

where:

The Repository will reply with a message of the form:

← { to:"rep", op:"get", results:[OBJDESC], tag:?STR }

where:

An object descriptor takes the form:

{ type:"obji", ref:STR, obj:?OBJ, failure:?STR }

where:

put

→ { to:"rep", op:"put", what:[OBJDESC], tag:?STR }

This message requests the Repository to store the new persistent state of one or more objects.

Storage is atomic over the full collection of objects transmitted in the put request. That is, the persistent states of all specified objects are updated or none are.

Note that there is no explicit "create" operation. Simply issue a put for an object not currently stored. The Repository will reply with a message of the form:

← { to:"rep", op:"put", results:[RESULTDESC], tag:?STR }

where:

A result descriptor takes the form:

{ type:"stati", ref:STR, failure:?STR }

where:

remove

→ { to:"rep", op:"remove", refs:[STR], tag:?STR }

This message requests the Repository to delete the persistent state of one or more objects.

The Repository will reply with a message of the form:

← { to:"rep", op:"remove", results:[RESULTDESC], tag:?STR }

where:

Admin Protocol

The Repository admin protocol is used to administer the Repository server.

reinit

→ { to:"admin", op:"reinit" }

This message instructs the Repository to reinitialize itself.

shutdown

→ { to:"admin", op:"shutdown" kill:?BOOL }

This message instructs the Repository to shut itself down.

where: