common

package
v0.0.0-...-64ee3fd Latest Latest
Warning

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

Go to latest
Published: May 25, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Get = iota
	Bget
	Gat
	Set
	Add
	Replace
	Touch
	Delete
)

Variables

View Source
var AllOps = []Op{Get, Bget, Gat, Set, Add, Replace, Touch, Delete}

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

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
	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