Skip to content

Module Commands

D G Starkweather edited this page Feb 12, 2020 · 2 revisions

Commands

The Reventis module introduces a data structure to store events, as indicated by longitude, latitude and a timestamp.

These are the commands for interacting with the data structure.

reventis.insert <key>  <longitude> <latitude> <date-start> <time-start> <date-end> <time-end> <description>

This command is for adding events. It returns a long long unique value for the id value assigned to the event. There is also an optional parameter at the end of this to include a custom unique id, but that is mostly for replication to slave servers. Do not use this unless you need to generate your own unique id's, and it is not meant for object tracking, where more than one event can have the same id.

reventis.lookup <key> <id>

Returns a string detailing the event for the given id. For the id returned by the insert command.

reventis.del <key> <id>

Returns "OK" for successful deletion of given id or error message.

reventis.purge <key> <date> <time>

Returns integer value for number of events deleted, or error message. The command deletes all events at or before a given datetime.

reventis.delblk <key> <longitude-range> <latitude-range> <datetime-start> <datetime-end>

Returns integer for the number of events deleted. Deletes a block of events in a given range. Both longitude and latitude ranges include 2 values for lower and upper limits. The time range includes dates and times for both start and end times - e.g. a time range would be something like 05-01-2020 12:00 06-01-2020 13:00 would delete all events in that time period.

reventis.query <key> <longitude-range> <latitude-range> <datetime-start> <datetime-end>

Returns an array of strings for the results of the query. The longitude latitude ranges each include two values for the lower and upper ranges. Both datetimes are a string in the form MM:DD:YYYY HH:MM.

reventis.size <key>

Returns integer value for the number of events stored under this key.

reventis.depth <key>

Returns the height of the tree.

reventis.print <key>

Returns "OK" string. Prints out all events to the redis-server.log file. Useful for debugging with small number of events.

Note: longitude values must be in the range -180.0 to 180.0; latitude values in the range -90.0 to 90.0.
All time stamps are in the form MM-DD-YYYY HH:MM.

reventis.addcategory <key> <event-id> <category-id> ...
reventis.addcategory <key> <event-id> <category-id> ...

Returns a simple "OK" string on success. Add/remove category to individual ids. Specify any number of category ids on the end. Category ids must be between 1 and 64.

reventis.query <key> <longitude-range> <latitude-range> <datetime-range> <category-id> ...

Returns a list of events in the specified range. Any number of category ids can be appended at the end to limit the search to items in specified categories.

Clone this wiki locally