packet

package
v0.0.0-...-96d424b Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const HEADER_LEN = 4
View Source
const PROROCOL_LEN = 4

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(content []byte, num BigcacheProtocol) []byte

func NewResponse

func NewResponse(msg string, errcode errcode.BigcacheError) []byte

Types

type BigcacheProtocol

type BigcacheProtocol int

BigcacheProtocol 传输协议号.

const (
	CONN_AUTH            BigcacheProtocol = 1000 //连接授权.
	READ                 BigcacheProtocol = 1001 //获取一条记录.
	WRITE                BigcacheProtocol = 1002 //写入一条记录.
	DELETE               BigcacheProtocol = 1003 //删除一条记录.
	MSG                  BigcacheProtocol = 1004 //发生一条状态消息.
	ADD_NODE             BigcacheProtocol = 1005 //新增加节点.
	REMOVE_NODE          BigcacheProtocol = 1006 //删除节点.
	GET_CACHE_SERVER_ALL BigcacheProtocol = 1007 //获取所有的cache server 节点.
)

type Request

type Request struct {
	Protocol BigcacheProtocol
	Size     int64
	Body     []byte
}

func ParseRequest

func ParseRequest(conn net.Conn) (pkt Request, err error)

ParseRequest 解析网络请求数据包.

type Response

type Response struct {
	Protocol BigcacheProtocol
	Size     int64
	Body     []byte
	Msg      string
	Err      errcode.BigcacheError
}

func ParseResponse

func ParseResponse(conn net.Conn) (pkt Response, err error)

ParseRequest 解析网络返回数据包.

Jump to

Keyboard shortcuts

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