kvtp

package
v0.0.0-...-fbe9487 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Implements a Protocol for rpcmux, that implements a Key-Value-Store API.

Just be warned. Unstable! API and protocol will change without notice.

Index

Constants

View Source
const (
	CMD_Cancel = iota
	CMD_Get
	CMD_GetNoRedirect
	CMD_Put
	CMD_PutNoRedirect

	/*
		Returns a Log of hops.
	*/
	CMD_Trace

	/*
		Returns "ok" if the key is available, "not_found" otherwise.
	*/
	CMD_Touch
)

Commands.

View Source
const (
	RESP_None = iota
	RESP_Error
	RESP_Value
	RESP_NotFound
)

Responses

Variables

This section is empty.

Functions

func NewRequest

func NewRequest() interface{}

func NewResponse

func NewResponse() interface{}

func ReqCancel

func ReqCancel(p *sync.Pool) func() rpcmux.Message

func ReqIsCancel

func ReqIsCancel(m rpcmux.Message) bool

func RespDefault

func RespDefault(p *sync.Pool) func() rpcmux.Message

Types

type Request

type Request struct {
	Cmd       uint8
	ExpiresAt uint64 /* time.Unix(), 0 -> no expiration. */
	Key       []byte
	Val       []byte
	// contains filtered or unexported fields
}

func (*Request) DecodeMsgpack

func (r *Request) DecodeMsgpack(m *msgpack.Decoder) error

func (*Request) EncodeMsgpack

func (r *Request) EncodeMsgpack(m *msgpack.Encoder) error

func (*Request) Seq

func (r *Request) Seq() uint64

func (*Request) SetSeq

func (r *Request) SetSeq(u uint64)

type Response

type Response struct {
	Code      uint8
	ExpiresAt uint64 /* time.Unix(), 0 -> no expiration. */
	Val       []byte
	// contains filtered or unexported fields
}

func (*Response) DecodeMsgpack

func (r *Response) DecodeMsgpack(m *msgpack.Decoder) error

func (*Response) EncodeMsgpack

func (r *Response) EncodeMsgpack(m *msgpack.Encoder) error

func (*Response) Seq

func (r *Response) Seq() uint64

func (*Response) SetSeq

func (r *Response) SetSeq(u uint64)

Jump to

Keyboard shortcuts

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