Documentation ¶
Overview ¶
Package proto provides helper functions for using the SysDB front-end protocol. That's the protocol used for communication between a client and a SysDB server instance.
Index ¶
Constants ¶
const ( // ConnectionOK indicates that a command was successful. ConnectionOK = Status(0) // ConnectionError indicates that a command has failed. ConnectionError = Status(1) // ConnectionLog indicates an (asynchronous) log message. ConnectionLog = Status(2) // ConnectionData indicates a successful query returning data. ConnectionData = Status(100) )
const ( // ConnectionIdle is the internal state for idle connections. ConnectionIdle = Status(0) // ConnectionPing is the state requesting a connection check. ConnectionPing = Status(1) // ConnectionStartup is the state requesting the setup of a client // connection. ConnectionStartup = Status(2) // ConnectionQuery is the state requesting the execution of a query in the // server. ConnectionQuery = Status(3) // ConnectionFetch is the state requesting the execution of the 'FETCH' // command in the server. ConnectionFetch = Status(4) // ConnectionList is the state requesting the execution of the 'LIST' // command in the server. ConnectionList = Status(5) // ConnectionLookup is the state requesting the execution of the 'LOOKUP' // command in the server. ConnectionLookup = Status(6) // ConnectionTimeseries is the state requesting the execution of the // 'TIMESERIES' command in the server. ConnectionTimeseries = Status(7) // ConnectionStore is the state requesting the execution of the 'STORE' // command in the server. ConnectionStore = Status(50) // Object-specific STORE commands. ConnectionStoreHost = Status(51) ConnectionStoreService = Status(52) ConnectionStoreMetric = Status(53) ConnectionStoreAttribute = Status(54) // ConnectionMatcher is the internal state for parsing matchers. ConnectionMatcher = Status(100) // ConnectionExpr is the internal state for parsing expressions. ConnectionExpr = Status(101) // ConnectionServerVersion is the state requesting the server version. ConnectionServerVersion = Status(1000) )
Variables ¶
This section is empty.
Functions ¶
func EscapeString ¶
EscapeString returns the quoted and escaped string s suitable for use in a query.
func Unmarshal ¶
Unmarshal parses the raw body of m and stores the result in the value pointed to by v which has to match the type of the message and its data.
func Write ¶
Write writes a raw message to w. The raw body of m has to be encoded in the SysDB wire format. The function adds the right header to the message.
The writer has to be in blocking mode. Otherwise, the client and server will be out of sync after writing a partial message and cannot recover from that.
Types ¶
type DataType ¶
type DataType int
The DataType describes the type of data in a ConnectionData message.
type Message ¶
A Message represents a raw message of the SysDB front-end protocol.
func Read ¶
Read reads a raw message encoded in the SysDB wire format from r. The function parses the header but the raw body of the message will still be encoded in the wire format.
The reader has to be in blocking mode. Otherwise, the client and server will be out of sync after reading a partial message and cannot recover from that.