Documentation ¶
Overview ¶
Package rexpro0 implements the RexPro version 0 protocol.
See: https://github.com/tinkerpop/rexster/wiki/RexPro-Messages/46f76da31149b2a3a68fb470d28157e23739a66d
This package is heavily inspired by the package net/rpc.
Index ¶
Constants ¶
const ( ChannelConsole ChannelMsgPack ChannelGraphSON )
const ( ErrFlagMalformedMessage = iota ErrFlagSessionNotFound ErrFlagScriptExecFailed ErrFlagInvalidCredentials ErrFlagGraphNotFound ErrFlagChannelNotFound ErrFlagSerializationFailed ErrFlagUnknown = -1 )
Variables ¶
var EmptySession [16]byte = [16]byte{}
var ErrShutdown = errors.New("connection is shut down")
var ErrUnknownVersion = errors.New("unknown protocol version")
Functions ¶
This section is empty.
Types ¶
type Call ¶
type Call struct { Session [16]byte RequestType MsgType RequestMeta MetaMap RequestArgs []interface{} ResponseType MsgType ResponseMeta MetaMap ResponseArgs []interface{} Error error Done chan *Call }
Call represents an active request.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a RexPro Client. There may be multiple outstanding Calls associated with a single Client, and a Client may be used by multiple goroutines simultaneously.
func NewClient ¶
func NewClient(conn io.ReadWriteCloser) *Client
NewClient returns a new Client to handle requests to the set of services at the other end of the connection. It adds a buffer to both the write and read side of the connection so the header and body are sent and received as a unit.
func (*Client) Call ¶
func (client *Client) Call(session [16]byte, typ MsgType, meta MetaMap, args []interface{}) ([16]byte, MsgType, MetaMap, []interface{}, error)
Call sends the request to the server, waits for it to complete, and returns its results.
func (*Client) Go ¶
func (client *Client) Go(session [16]byte, typ MsgType, meta MetaMap, args []interface{}, done chan *Call) *Call
Go invokes the function asynchronously. It returns the Call structure representing the invocation. The done channel will signal when the call is complete by returning the same Call object. If done is nil, Go will allocate a new channel. If non-nil, done must be buffered or Go will deliberately crash.
type RexsterError ¶
RexsterError represents an Error Response returned by the RexPro server.
func (RexsterError) Error ¶
func (e RexsterError) Error() string