Crate exar_net [−] [src]
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 Events.
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:
EmptyorClosedif the error type isEventStreamError,ParseErrororMissingFieldif the error type isParseError, or a stringified value ofstd::io::ErrorKindif the error type isIoError. - The 4th field is the error message/description.
Structs
| TcpMessageStream |
A bidiectional TCP message stream. |
| TcpMessages |
An iterator over the messages received on a stream. |
Enums
| TcpMessage |
A list specifying categories of TCP message. |
Traits
| TryClone |