Documentation ¶
Index ¶
- Constants
- Variables
- func CreateConnection() (conn net.Conn, server *url.URL, err error)
- func GraphSONSerializer(req *Request) ([]byte, error)
- func NewCluster(s ...string) (err error)
- func SplitServers(connString string) (servers []*url.URL, err error)
- type AuthInfo
- type Bind
- type Connection
- type FormattedReq
- type OptAuth
- type Pool
- type Request
- type RequestArgs
- type Response
- type ResponseResult
- type ResponseStatus
Constants ¶
const ( StatusSuccess = 200 StatusNoContent = 204 StatusPartialContent = 206 StatusAuthenticate = 407 StatusMalformedRequest = 498 StatusInvalidRequestArguments = 499 StatusServerError = 500 StatusScriptEvaluationError = 597 StatusServerTimeout = 598 StatusServerSerializationError = 599 )
const TheBigestMaxGremlinConnectionsLimit = 5
Variables ¶
var ErrorMsg = map[int]string{ StatusUnauthorized: "Unauthorized", StatusAuthenticate: "Authenticate", StatusMalformedRequest: "Malformed Request", StatusInvalidRequestArguments: "Invalid Request Arguments", StatusServerError: "Server Error", StatusScriptEvaluationError: "Script Evaluation Error", StatusServerTimeout: "Server Timeout", StatusServerSerializationError: "Server Serialization Error", }
Functions ¶
func GraphSONSerializer ¶
func NewCluster ¶
Types ¶
type AuthInfo ¶
AuthInfo includes all info related with SASL authentication with the Gremlin server ChallengeId is the requestID in the 407 status (AUTHENTICATE) response given by the server. We have to send an authentication request with that same RequestID in order to solve the challenge.
func NewAuthInfo ¶
Constructor for different authentication possibilities
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func (*Connection) ReadResponse ¶
func (c *Connection) ReadResponse() (data []byte, err error)
type FormattedReq ¶
type FormattedReq struct { Op string `json:"op"` RequestId interface{} `json:"requestId"` Args *RequestArgs `json:"args"` Processor string `json:"processor"` }
Formats the requests in the appropriate way
func NewFormattedReq ¶
func NewFormattedReq(req *Request) FormattedReq
type OptAuth ¶
func OptAuthEnv ¶
func OptAuthEnv() OptAuth
Sets authentication info from environment variables GREMLIN_USER and GREMLIN_PASS
func OptAuthUserPass ¶
Sets authentication information from username and password
type Pool ¶
type Pool struct { MaxConnections int Auth []OptAuth Connections chan Connection // contains filtered or unexported fields }
Clients include the necessary info to connect to the server and the underlying socket
func (*Pool) Authenticate ¶
Authenticates the connection
func (*Pool) Get ¶
func (p *Pool) Get() Connection
func (*Pool) Put ¶
func (p *Pool) Put(conn Connection)
Put - put used connection back to poll and get positive status if it's gone well
type Request ¶
type Request struct { RequestId string `json:"requestId"` Op string `json:"op"` Processor string `json:"processor"` Args *RequestArgs `json:"args"` }
func (*Request) ManageTransaction ¶
func (*Request) SetProcessor ¶
type RequestArgs ¶
type RequestArgs struct { Gremlin string `json:"gremlin,omitempty"` Session string `json:"session,omitempty"` Bindings Bind `json:"bindings,omitempty"` Language string `json:"language,omitempty"` Rebindings Bind `json:"rebindings,omitempty"` Sasl string `json:"sasl,omitempty"` BatchSize int `json:"batchSize,omitempty"` ManageTransaction bool `json:"manageTransaction,omitempty"` Aliases map[string]string `json:"aliases,omitempty"` }
type Response ¶
type Response struct { RequestId string `json:"requestId"` Status *ResponseStatus `json:"status"` Result *ResponseResult `json:"result"` }
type ResponseResult ¶
type ResponseResult struct { Data json.RawMessage `json:"data"` Meta map[string]interface{} `json:"meta"` }