plain

package
v0.0.0-...-4bfbf91 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoMarshalerRequestSync

func DoMarshalerRequestSync(fbc *AsyncReqFlatBinaryConn, requestID uint64, req Marshaler, messageType uint64, timeout time.Duration) (msgRep *messaging.Msg, err error)

func ValidateResponse

func ValidateResponse(msgRep *messaging.Msg, hed *Header, requestID uint64) (data []byte, isFailType bool, err error)

ValidateResponse checks whether the returned message is sane and returns a non MsgType_DefaultFail message type.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an asynchronous client using the flatbinary protocol to request iterator data at its target/server.

func NewClient

func NewClient(
	conn net.Conn,
	msgRecvTimeout, msgInnerTimeout, requestTimeoutMs time.Duration,
	rcvBufferSz uint64, tryReconnectMax time.Duration) (self *Client)

NewClient allocates a new Client with the given data.

func NewClientAddr

func NewClientAddr(
	netName, commandAddr, queryAddr string,
	msgRecvTimeout, msgInnerTimeout, requestTimeoutMs time.Duration,
	rcvBufferSz uint64, tryReconnectMax time.Duration) (self *Client, err error)

NewClientAddr allocates a new Client with the given data, initializes it. two connections are established if commandAddr != queryAddr otherwise a single connection is used.

func NewConnectClientDefaultStart

func NewConnectClientDefaultStart(commandAddr, queryAddr string, rcvBufferSz uint64) (self *Client, err error)

NewConnectClientDefaultStart allocates a new Client with the given data, initializes and starts it.

func (*Client) Close

func (self *Client) Close() (err error)

Close closes the underlying socket.

func (*Client) CreateIterator

func (self *Client) CreateIterator(handle IteratorQueryHandle)

CreateIterator creates a new iterator for the handle.

func (*Client) Delete

func (self *Client) Delete(handle DeleteCommandHandle)

func (*Client) DoMarshalerRequestSync

func (self *Client) DoMarshalerRequestSync(
	fbc *AsyncReqFlatBinaryConn,
	req Marshaler,
	messageType uint64,
	timeout time.Duration,
) (requestID uint64, msgRep *messaging.Msg, err error)

func (*Client) Echo

func (self *Client) Echo(handle CommandHandle)

func (*Client) Get

func (self *Client) Get(handle GetQueryHandle)

func (*Client) GetSettings

func (self *Client) GetSettings(handle SettingsQueryHandle)

GetSettings currently returns the settings of the command store.

func (*Client) Iterate

func (self *Client) Iterate(handle IteratorQueryHandle)

func (*Client) IterateBase

func (self *Client) IterateBase(handle IteratorQueryHandle, messageType uint64)

func (*Client) ModifyIterator

func (self *Client) ModifyIterator(handle IteratorQueryHandle)

ModifyIterator modifies the handle iterator if necessary. Not implemented here

func (*Client) Pipelined

func (self *Client) Pipelined(handle PipelineCommandHandle)

Pipelined currently only for command and not for queries.

func (*Client) Put

func (self *Client) Put(handle PutCommandHandle)

func (*Client) Start

func (self *Client) Start() (err error)

func (*Client) WriteBatch

func (self *Client) WriteBatch(handle WriteCommandHandle) WriteBatch

WriteBatch returns allocates and returns a new WriteBatch according to the settings given with the handle.

func (*Client) WriteWriteBatch

func (self *Client) WriteWriteBatch(batch WriteBatch) (err error)

type ClientStore

type ClientStore struct {
	Client
	store.KVStoreToDirectHandle
}

func NewClientStoreInit

func NewClientStoreInit(client *Client) (self *ClientStore, err error)

func NewClientStoreInitDefaultStart

func NewClientStoreInitDefaultStart(commandAddr, queryAddr string, rcvBufferSz uint64) (self *ClientStore, err error)

func (*ClientStore) Close

func (self *ClientStore) Close() (err error)

func (*ClientStore) ColumnFamilyHandleByName

func (self *ClientStore) ColumnFamilyHandleByName(cfName string) (cf CFHandle, index int)

ColumnFamilyHandleByName returns a column family handle by name and index, or nil if not exists.

func (*ClientStore) ColumnFamilyHandles

func (self *ClientStore) ColumnFamilyHandles() (cfs []CFHandle)

ColumnFamilyHandles returns all column family handles.

func (*ClientStore) SetupSettings

func (self *ClientStore) SetupSettings() (err error)

type IteratorHandler

type IteratorHandler struct {
	// contains filtered or unexported fields
}

func IteratorHandlerNew

func IteratorHandlerNew(provider DirectIteratorQueryStore) (self *IteratorHandler)

func (*IteratorHandler) Close

func (self *IteratorHandler) Close() (err error)

func (*IteratorHandler) OnIteratorRequest

func (self *IteratorHandler) OnIteratorRequest(handle IteratorQueryHandle) (data []byte)

OnIteratorRequest handles an IteratorQueryHandle which is the result of a request.

func (*IteratorHandler) Start

func (self *IteratorHandler) Start() (err error)

type PlainServer

type PlainServer struct {
	// contains filtered or unexported fields
}

PlainServer implements a DefaultFlatBinaryPlainServer to be used for iterator requests

func CreatePlainServer

func CreatePlainServer(fbs DefaultFlatBinaryServer, fnOnConnectionError func(err error)) (self PlainServer)

CreatePlainServer returns a PlainServer.

func (*PlainServer) Close

func (self *PlainServer) Close() (err error)

Close closes the underlying listener and handler.

func (*PlainServer) DefaultFlatBinaryServer

func (self *PlainServer) DefaultFlatBinaryServer() *DefaultFlatBinaryServer

DefaultFlatBinaryServer returns the underlying DefaultFlatBinaryServer

func (*PlainServer) OnConnectionError

func (self *PlainServer) OnConnectionError(err error)

OnConnectionError is called when a connection has an error.

func (*PlainServer) SendMsgResponse

func (self *PlainServer) SendMsgResponse(fbc *FlatBinaryConn, chksumHash hash.Hash64, hed Header, rep Marshaler, cerr error, errs []*DefaultError) (err error)

SendMsgResponse is the standard method to send a response. if cerr is nil and len(errs) == 0 MsgType_DefaultSuccess is sent else MsgType_DefaultFail.

func (*PlainServer) SendRep

func (self *PlainServer) SendRep(fbc *FlatBinaryConn, hed *Header, rep Marshaler, chksumHash hash.Hash64) (err error)

type Server

type Server struct {
	PlainServer
	// contains filtered or unexported fields
}

Server implements a DefaultFlatBinaryServer to be used for KV requests.

func NewServer

func NewServer(lis net.Listener,
	sc DirectKVRequestStore,
	writable bool,
	fnOnError func(err error),
	fnOnConnectionError func(err error),
	maxMsgSz, rcvBufSz uint32,
) (self *Server)

NewServerAddr allocates a Server object with the given data.

func NewServerAddr

func NewServerAddr(netName string, addr *string,
	sc DirectKVRequestStore,
	writable bool,
	fnOnError func(err error),
	fnOnConnectionError func(err error),
	maxMsgSz, rcvBufSz uint32,
) (self *Server, err error)

NewServerAddr allocates and initializes a Server object with the given data. Afterwards Run or Start must be called.

func (*Server) Close

func (self *Server) Close() (err error)

Close closes the server but not all receiving goroutines.

func (*Server) Run

func (self *Server) Run()

Run runs the server with the invoking go routine.

func (*Server) Start

func (self *Server) Start() (err error)

Start starts the server = Run in own go routine.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL