Documentation ¶
Overview ¶
Package protocol implements Olric Binary Protocol.
Index ¶
- Constants
- Variables
- type AtomicExtra
- type ExpireExtra
- type Header
- type LengthOfPartExtra
- type LocalQueryExtra
- type LockExtra
- type LockWithTimeoutExtra
- type MagicCode
- type Message
- type OpCode
- type PutExExtra
- type PutExtra
- type PutIfExExtra
- type PutIfExtra
- type QueryExtra
- type StatusCode
- type UpdateRoutingExtra
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 OpLengthOfPart OpPipeline OpPing OpStats OpExpire OpExpireReplica OpQuery OpLocalQuery )
ops
const ( StatusOK = StatusCode(iota) StatusInternalServerError StatusBadRequest StatusErrKeyNotFound StatusErrNoSuchLock StatusErrLockNotAcquired StatusErrWriteQuorum StatusErrReadQuorum StatusErrOperationTimeout StatusErrKeyFound StatusErrClusterQuorum StatusErrUnknownOperation StatusErrEndOfQuery )
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 LengthOfPartExtra ¶
LengthOfPartExtra defines extra values for this operation.
type LocalQueryExtra ¶
type LocalQueryExtra struct {
PartID uint64
}
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 QueryExtra ¶
type QueryExtra struct {
PartID uint64
}
type StatusCode ¶
type StatusCode uint8
type UpdateRoutingExtra ¶
type UpdateRoutingExtra struct {
CoordinatorID uint64
}
UpdateRoutingExtra defines extra values for this operation.