common

package
v0.0.0-...-d3db570 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2017 License: Apache-2.0 Imports: 9 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound   = errors.New("Key not found")
	ErrKeyExists     = errors.New("Key exists")
	ErrValTooLarge   = errors.New("Value too large")
	ErrInvalidArgs   = errors.New("Invalid arguments")
	ErrItemNotStored = errors.New("Item not stored")
	ErrIncDecInval   = errors.New("Incr/Decr on non-numeric value.")
	ErrVBucket       = errors.New("The vbucket belongs to another server")
	ErrAuth          = errors.New("Authentication error")
	ErrAuthCont      = errors.New("Authentication continue")
	ErrUnknownCmd    = errors.New("Unknown command")
	ErrNoMem         = errors.New("Out of memory")
	ErrNotSupported  = errors.New("Not supported")
	ErrInternal      = errors.New("Internal error")
	ErrBusy          = errors.New("Busy")
	ErrTemp          = errors.New("Temporary failure")
)

Functions

func Connect

func Connect(host string, port int) (net.Conn, error)

func Exp

func Exp() uint32

get a random expiration

func RandData

func RandData(r *rand.Rand, n int, useCached bool) []byte

func RandSeed

func RandSeed() int64

Types

type Op

type Op int
const (
	Get Op = iota
	Bget
	Gat
	Set
	Add
	Replace
	Append
	Prepend
	Touch
	Delete
)

func (Op) String

func (o Op) String() string

type Prot

type Prot interface {
	// Yes, the abstraction is a little bit leaky, but the code
	// in other places benefits from the consistency.
	Set(rw *bufio.ReadWriter, key []byte, value []byte) error
	Add(rw *bufio.ReadWriter, key []byte, value []byte) error
	Replace(rw *bufio.ReadWriter, key []byte, value []byte) error
	Append(rw *bufio.ReadWriter, key []byte, value []byte) error
	Prepend(rw *bufio.ReadWriter, key []byte, value []byte) error
	Get(rw *bufio.ReadWriter, key []byte) ([]byte, error)
	GetWithOpaque(rw *bufio.ReadWriter, key []byte, opaque int) ([]byte, error)
	GAT(rw *bufio.ReadWriter, key []byte) ([]byte, error)
	BatchGet(rw *bufio.ReadWriter, keys [][]byte) ([][]byte, error)
	Delete(rw *bufio.ReadWriter, key []byte) error
	Touch(rw *bufio.ReadWriter, key []byte) error
}

type Task

type Task struct {
	Cmd   Op
	Key   []byte
	Value []byte
}

Jump to

Keyboard shortcuts

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