-
Notifications
You must be signed in to change notification settings - Fork 19
JSON Protocols
Spacetime communicates with the Store through a RESTful API. This page describes the protocols for each service.
P.S.: For sanity, use this webpage to generate tables http://www.tablesgenerator.com/markdown_tables
Registrations takes a single argument: sim_typemap, which is a dictionary with the following arguments:
Argument | Example | Required | Description |
---|---|---|---|
getting | ['Car', 'Pedestrian'] | No | List of pcc types (as string) that the simulation is a getter for |
gettingsetting | ['Car', 'Pedestrian'] | No | List of pcc types (as string) that the simulation is a gettersetter for |
deleting | ['Car', 'Pedestrian'] | No | List of pcc types (as string) that the simulation is a deleter for |
setting | ['Car', 'Pedestrian'] | No | List of pcc types (as string) that the simulation is a setter for |
tracking | ['Car', 'Pedestrian'] | No | List of pcc types (as string) that the simulation is a tracker for |
Example (Nodesim):
{'sim_typemap': {'deleting': ['RouteRequest', 'Route'], 'gettingsetting': ['RouteRequest', 'Route'], 'tracking': ['Waypoint', BusinessNode', 'ResidentialNode', 'Route'], 'producing': ['RouteRequest']} }
Push takes a single dictionary called update_dict that has 3 arguments: new, mod, and deleted. new is a dictionary of object ids to encoded JSON object. mod is a dictionary of object ids to encoded JSON updates (dimension string as keys). deleted is a list of object ids that were deleted.
Argument | Example | Required | Description |
---|---|---|---|
type : { 'new' : { obj_id : objjson }, 'mod' : { obj_id : updatejson }, 'deleted' : [ ids ] } | 'Car' : { 'new' : {}, 'mod' : {}, 'deleted' : [] } | Yes | Lists all objects that were created, modified, and deleted by this simulation on the current tick. |
type: Type of a pcc object as a string.
obj_id: Primary key of a tracked spacetime pcc object.
objjson: Encoded object as JSON: key-value pair of dimension and values.
updatejson: Encoded object updates as JSON. Example: 'mod' : { '1' : { 'Name' : 'YellowCar' } }
ids: List of primary keys of tracked spacetime pcc objects. Example: 'deleted' : [ '1', '2']
Pull takes a dictionary with one argument: get_types. In turn, get_types has two arguments:
Argument | Example | Required | Description |
---|---|---|---|
types_tracked | ['Car', 'Pedestrian'] | Yes | Types the simulation is a tracker for (i.e. new and deleted) |
types_updated | ['Car', 'Pedestrian'] | Yes | Types the simulation is a getter/gettersetter for (i.e. updates) |
Example: { 'get_types' : { 'types_tracked' : ['Car'], 'types_updated' : ['Pedestrian'] } } }