message

package
v0.0.0-...-48715d7 Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAGIC_REQUEST  = 0x80
	MAGIC_RESPONSE = 0x81
	HEADER_LENGTH  = 24
)
View Source
const (
	GET = CommandOpCode(0x00)
	SET = CommandOpCode(0x01)
)
View Source
const (
	SUCCESS           = ResponseStatus(0x00)
	KEY_NOT_FOUND     = ResponseStatus(0x01)
	KEY_EXISTS        = ResponseStatus(0x02)
	VALUE_TOO_LARGE   = ResponseStatus(0x03)
	INVALID_ARGUMENTS = ResponseStatus(0x04)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandOpCode

type CommandOpCode uint8

type Request

type Request struct {
	OpCode     CommandOpCode
	Cas        uint64
	Opaque     uint32
	Key        []byte
	Body       []byte
	Flags      uint32
	Expiration uint32
	VBucket    uint16
}

func (*Request) GetBytes

func (req *Request) GetBytes() []byte

type Response

type Response struct {
	Test            string
	OpCode          CommandOpCode
	Cas             uint64
	Opaque          uint32
	KeyLength       uint16
	ExtraLength     byte
	DataType        byte
	Status          ResponseStatus
	Flags           uint32
	TotalBodyLength uint32
	Body            []byte
}

func (*Response) TryParseBody

func (response *Response) TryParseBody(data []byte) bool

func (*Response) TryParseHeader

func (response *Response) TryParseHeader(data []byte) bool

type ResponseStatus

type ResponseStatus uint16

Jump to

Keyboard shortcuts

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