proto

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSupportCacheType = errs.New("unsupported cache type")
)

errors

Functions

func PutMsgs

func PutMsgs(msgs []*Message)

PutMsgs Release message.

Types

type CacheType

type CacheType string

CacheType memcache or redis

const (
	CacheTypeUnknown        CacheType = "unknown"
	CacheTypeMemcache       CacheType = "memcache"
	CacheTypeMemcacheBinary CacheType = "memcache_binary"
	CacheTypeRedis          CacheType = "redis"
	CacheTypeRedisCluster   CacheType = "redis_cluster"
)

Cache type: memcache or redis.

type Forwarder added in v1.5.0

type Forwarder interface {
	Forward([]*Message) error
	Close() error
}

Forwarder is the interface for backend run and process the messages.

type Message

type Message struct {
	Type CacheType
	// contains filtered or unexported fields
}

Message read from client.

func ErrMessage

func ErrMessage(err error) *Message

ErrMessage return err Msg.

func GetMsgs

func GetMsgs(n int, caps ...int) []*Message

GetMsgs alloc a slice to the message

func NewMessage

func NewMessage() *Message

NewMessage will create new message object. this will be used be sub msg req.

func (*Message) Add added in v1.5.0

func (m *Message) Add()

Add add wait group.

func (*Message) Batch

func (m *Message) Batch() []*Message

Batch returns sub Msg if is batch.

func (*Message) Done added in v1.5.0

func (m *Message) Done()

Done mark handle message done.

func (*Message) Err

func (m *Message) Err() error

Err returns error.

func (*Message) IsBatch

func (m *Message) IsBatch() bool

IsBatch returns whether or not batch.

func (*Message) MarkEnd

func (m *Message) MarkEnd()

MarkEnd will set the end time of the command to now.

func (*Message) MarkRead

func (m *Message) MarkRead()

MarkRead will set the read time of the command to now.

func (*Message) MarkStart

func (m *Message) MarkStart()

MarkStart will set the start time of the command to now.

func (*Message) MarkWrite

func (m *Message) MarkWrite()

MarkWrite will set the write time of the command to now.

func (*Message) NextReq

func (m *Message) NextReq() (req Request)

NextReq will iterator itself until nil.

func (*Message) RemoteDur

func (m *Message) RemoteDur() time.Duration

RemoteDur will return the remote execute time of remote mc node.

func (*Message) Request

func (m *Message) Request() Request

Request returns proto Msg.

func (*Message) Requests

func (m *Message) Requests() []Request

Requests return all request.

func (*Message) Reset

func (m *Message) Reset()

Reset will clean the msg

func (*Message) ResetSubs

func (m *Message) ResetSubs()

ResetSubs will return the Msg data to flush and reset

func (*Message) TotalDur

func (m *Message) TotalDur() time.Duration

TotalDur will return the total duration of a command.

func (*Message) WithError added in v1.3.2

func (m *Message) WithError(err error)

WithError with error.

func (*Message) WithRequest

func (m *Message) WithRequest(req Request)

WithRequest with proto request.

func (*Message) WithWaitGroup added in v1.5.0

func (m *Message) WithWaitGroup(wg *sync.WaitGroup)

WithWaitGroup with wait group.

type NodeConn

type NodeConn interface {
	Write(*Message) error
	Read(*Message) error
	Flush() error
	Close() error
}

NodeConn handle Msg to backend cache server and read response.

type NodeConnPipe added in v1.5.0

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

NodeConnPipe multi MsgPipe for node conns.

func NewNodeConnPipe added in v1.5.0

func NewNodeConnPipe(conns int32, newNc func() NodeConn) (ncp *NodeConnPipe)

NewNodeConnPipe new NodeConnPipe.

func (*NodeConnPipe) Close added in v1.5.0

func (ncp *NodeConnPipe) Close()

Close close pipe.

func (*NodeConnPipe) ErrorEvent added in v1.5.0

func (ncp *NodeConnPipe) ErrorEvent() <-chan error

ErrorEvent return error chan.

func (*NodeConnPipe) Push added in v1.5.0

func (ncp *NodeConnPipe) Push(m *Message)

Push push message into input chan.

type Pinger added in v1.3.2

type Pinger interface {
	Ping() error
	Close() error
}

Pinger for executor ping node.

type ProxyConn

type ProxyConn interface {
	Decode([]*Message) ([]*Message, error)
	Encode(msg *Message) error
	Flush() error
}

ProxyConn decode bytes from client and encode write to conn.

type Request

type Request interface {
	CmdString() string
	Cmd() []byte
	Key() []byte
	Put()
}

Request request interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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