binary

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResponseStatusNoErr         = 0x0000
	ResponseStatusKeyNotFound   = 0x0001
	ResponseStatusKeyExists     = 0x0002
	ResponseStatusValueTooLarge = 0x0003
	ResponseStatusInvalidArg    = 0x0004
	ResponseStatusItemNotStored = 0x0005
	ResponseStatusNonNumeric    = 0x0006
	ResponseStatusUnknownCmd    = 0x0081
	ResponseStatusOutOfMem      = 0x0082
	ResponseStatusNotSupported  = 0x0083
	ResponseStatusInternalErr   = 0x0084
	ResponseStatusBusy          = 0x0085
	ResponseStatusTemporary     = 0x0086
)

all memcache response status

Variables

View Source
var (
	// ERROR means the client sent a nonexistent command name.
	ErrError = errs.New("ERROR")

	// CLIENT_ERROR
	// means some sort of client error in the input line, i.e. the input
	// doesn't conform to the protocol in some way. <error> is a
	// human-readable error string.
	ErrBadRequest = errs.New("CLIENT_ERROR bad request")
	ErrBadLength  = errs.New("CLIENT_ERROR length is not a valid integer")

	// SERVER_ERROR
	// means some sort of server error prevents the server from carrying
	// out the command. <error> is a human-readable error string. In cases
	// of severe server errors, which make it impossible to continue
	// serving the client (this shouldn't normally happen), the server will
	// close the connection after sending the error line. This is the only
	// case in which the server closes a connection to a client.
	ErrClosed      = errs.New("SERVER_ERROR connection closed")
	ErrPingerPong  = errs.New("SERVER_ERROR Pinger pong unexpected")
	ErrAssertReq   = errs.New("SERVER_ERROR assert request not ok")
	ErrBadResponse = errs.New("SERVER_ERROR bad response")
)

errors

Functions

func NewNodeConn

func NewNodeConn(cluster, addr string, dialTimeout, readTimeout, writeTimeout time.Duration) (nc proto.NodeConn)

NewNodeConn returns node conn.

func NewPinger added in v1.3.2

func NewPinger(nc *libnet.Conn) proto.Pinger

NewPinger new pinger.

func NewProxyConn

func NewProxyConn(rw *libnet.Conn) proto.ProxyConn

NewProxyConn new a memcache decoder and encode.

Types

type MCRequest

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

MCRequest is the mc client Msg type and data.

func GetReq

func GetReq() *MCRequest

GetReq get the msg from pool

func NewReq

func NewReq() *MCRequest

NewReq return new mc req.

func (*MCRequest) Cmd

func (r *MCRequest) Cmd() []byte

Cmd get Msg cmd.

func (*MCRequest) CmdString

func (r *MCRequest) CmdString() string

CmdString get cmd.

func (*MCRequest) Key

func (r *MCRequest) Key() []byte

Key get Msg key.

func (*MCRequest) Put

func (r *MCRequest) Put()

Put put req back to pool.

func (*MCRequest) String

func (r *MCRequest) String() string

type RequestType

type RequestType byte

RequestType is the protocol-agnostic identifier for the command

const (
	RequestTypeGet     RequestType = 0x00
	RequestTypeSet     RequestType = 0x01
	RequestTypeAdd     RequestType = 0x02
	RequestTypeReplace RequestType = 0x03
	RequestTypeDelete  RequestType = 0x04
	RequestTypeIncr    RequestType = 0x05
	RequestTypeDecr    RequestType = 0x06
	RequestTypeGetQ    RequestType = 0x09
	RequestTypeNoop    RequestType = 0x0a
	RequestTypeGetK    RequestType = 0x0c
	RequestTypeGetKQ   RequestType = 0x0d
	RequestTypeAppend  RequestType = 0x0e
	RequestTypePrepend RequestType = 0x0f
	// RequestTypeSetQ     = 0x11
	// RequestTypeAddQ     = 0x12
	// RequestTypeReplaceQ = 0x13
	// RequestTypeIncrQ    = 0x15
	// RequestTypeDecrQ    = 0x16
	// RequestTypeAppendQ  = 0x19
	// RequestTypePrependQ = 0x1a
	RequestTypeTouch RequestType = 0x1c
	RequestTypeGat   RequestType = 0x1d
	// RequestTypeGatQ    = 0x1e
	RequestTypeUnknown RequestType = 0xff
)

all memcache request type

func (RequestType) Bytes

func (rt RequestType) Bytes() []byte

Bytes get reqtype bytes.

func (RequestType) String

func (rt RequestType) String() string

String get reqtype string.

type ResponseStatus added in v1.3.2

type ResponseStatus byte

ResponseStatus is the protocol-agnostic identifier for the response status

Jump to

Keyboard shortcuts

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