1 unstable release
Uses old Rust 2015
0.1.0 | Aug 1, 2016 |
---|
#1 in #exar
Used in 3 crates
(2 directly)
22KB
375 lines
Exar DB's TCP protocol
Defines the TCP protocol used by Exar DB.
lib.rs
:
Exar DB's TCP protocol
This module defines the TCP protocol used by Exar DB.
Protocol messages
The protocol is text-based and uses line-separated messages, each message consists of tab-separated values.
Connect
Message used to initialize a connection to Exar DB.
Connect collection [username] [password]
- The 1st field is the string
Connect
. - The 2nd field is the collection name.
- The 3rd field is the authentication username (optional).
- The 4th field is the authentication password (optional).
Connected
Message used to acknowledge a successful connection.
Connected
- A single field containing the string
Connected
.
Publish
Message used to publish an event into a collection.
It can be used only after a successful connection has been established.
Publish tag1 tag2 timestamp event_data
- The 1st field is the string
Publish
. - The 2nd field is a space-separated list of tags, the event must contain at least one tag.
- The 3rd field is the event timestamp (in ms), if set to 0 the timestamp will be set by the event logger.
- The 4th field is the event data/payload, it can contain tabs (
\t
) but new-lines (\n
) must be escaped.
Published
Message used to acknowledge a successfully published event.
Published event_id
- The 1st field is the string
Published
. - The 2nd field is the
id
(or sequence number) of the event that has been published.
Subscribe
Message used to subscribe to an event stream.
It can be used only after a successful connection has been established.
Subscribe live offset limit [tag1]
- The 1st field is the string
Subscribe
. - The 2nd field is a boolean specifying wether to keep the subscription listening to real-time events.
- The 3rd field is the query offset.
- The 4th field is the maximum number of events to consume, if set to 0 a limit is not set.
- The 5th field is the tag the events must contain (optional).
Subscribed
Message used to acknowledge a successful subscription.
Subscribed
- A single field containing the string
Subscribed
.
Event
Message containing an event.
It is received after a successful subscription.
Event event_id tag1 tag2 timestamp event_data
- The 1st field is the string
Event
. - The 2nd field is the
id
(or sequence number) of the event. - The 3rd field is a space-separated list of event tags.
- The 4th field is the event timestamp (in ms).
- The 5th field is the event data/payload.
EndOfEventStream
Message signaling the end of an event stream.
It is received after a Subscribed
or a list of Event
s.
EndOfEventStream
- A single field containing the string
EndOfEventStream
.
Error
Message containing an error.
It can be received after a Connect
, Publish
, Subscribe
, or during an event stream.
Error type [subtype] description
- The 1st field is the string
Error
. - The 2nd field is the type of the error, possible values are:
AuthenticationError
,ConnectionError
,EventStreamError
,IoError
,ParseError
,SubscriptionError
,ValidationError
. - The 3rd field is the sub-type of the error (optional), possible values are:
Empty
orClosed
if the error type isEventStreamError
,ParseError
orMissingField
if the error type isParseError
, or a stringified value ofstd::io::ErrorKind
if the error type isIoError
. - The 4th field is the error message/description.