Documentation
¶
Overview ¶
Package protocol implements Olric Binary Protocol.
Index ¶
Constants ¶
const ( OpPut = OpCode(iota) + 1 OpPutEx OpPutIf OpPutIfEx OpGet OpDelete OpDestroy OpLock OpLockWithTimeout OpUnlock OpIncr OpDecr OpGetPut OpUpdateRouting OpPutReplica OpPutIfReplica OpPutExReplica OpPutIfExReplica OpDeletePrev OpGetPrev OpGetBackup OpDeleteBackup OpDestroyDMap OpMoveDMap OpKeyCountOnPart OpPipeline OpPing OpStats OpExpire OpExpireReplica )
ops
const ( StatusOK = StatusCode(iota) StatusInternalServerError StatusBadRequest StatusErrKeyNotFound StatusErrNoSuchLock StatusErrLockNotAcquired StatusErrWriteQuorum StatusErrReadQuorum StatusErrOperationTimeout StatusErrKeyFound StatusErrClusterQuorum StatusErrUnknownOperation )
status codes
Variables ¶
var ErrConnClosed = errors.New("connection closed")
ErrConnClosed means that the underlying TCP connection has been closed by the client or operating system.
Functions ¶
This section is empty.
Types ¶
type AtomicExtra ¶
type AtomicExtra struct {
Timestamp int64
}
AtomicExtra defines extra values for this operation.
type ExpireExtra ¶
ExpireExtrrea defines extra values for this operation.
type Header ¶
type Header struct { Magic MagicCode // 1 Op OpCode // 1 DMapLen uint16 // 2 KeyLen uint16 // 2 ExtraLen uint8 // 1 Status StatusCode // 1 BodyLen uint32 // 4 }
Header defines a message header for both request and response.
type KeyCountOnPartExtra ¶
KeyCountOnPartExtra defines extra values for this operation.
type LockExtra ¶
type LockExtra struct {
Deadline int64
}
LockExtra defines extra values for this operation.
type LockWithTimeoutExtra ¶
LockWithTimeoutExtra defines extra values for this operation.
type MagicCode ¶
type MagicCode uint8
MagicCode defines an unique code to distinguish a request message from a response message in Olric Binary Protocol.
type Message ¶
type Message struct { Header // [0..10] Extra interface{} // [11..(m-1)] Command specific extras (In) DMap string // [m..(n-1)] DMap (as needed, length in Header) Key string // [n..(x-1)] Key (as needed, length in Header) Value []byte // [x..y] Value (as needed, length in Header) }
Message defines a protocol message in Olric Binary Protocol.
func (*Message) Error ¶
func (m *Message) Error(status StatusCode, err interface{}) *Message
Error generates an error message for the request.
func (*Message) Read ¶
Read reads a whole protocol message(including the value) from given connection by decoding it.
type PutExExtra ¶
PutExExtra defines extra values for this operation.
type PutExtra ¶
type PutExtra struct {
Timestamp int64
}
PutExtra defines extra values for this operation.
type PutIfExExtra ¶
PutIfExExtra defines extra values for this operation.
type PutIfExtra ¶
PutIfExtra defines extra values for this operation.
type UpdateRoutingExtra ¶
type UpdateRoutingExtra struct {
CoordinatorId uint64
}
UpdateRoutingExtra defines extra values for this operation.