Documentation ¶
Index ¶
- Constants
- Variables
- func ParseUint(part []byte) (n uint64, i int)
- func RandBytes(src rand.Source, n int) []byte
- func RandString(src rand.Source, n int) string
- type Client
- func (c *Client) BinCorrupt() (opaque uint32, err error)
- func (c *Client) BinFlush() (err error)
- func (c *Client) BinGet(key string) (opaque uint32, err error)
- func (c *Client) BinQuit() (opaque uint32, err error)
- func (c *Client) BinQuitQ() (opaque uint32, err error)
- func (c *Client) BinReceive(item *Item) (opcode uint8, code McCode, err error)
- func (c *Client) BinSet(item *Item) (opaque uint32, err error)
- func (c *Client) BinTouch(item *Item) (opaque uint32, err error)
- func (c *Client) Decr(key string, delta uint64) (result uint64, code McCode, err error)
- func (c *Client) Delete(key string) (code McCode, err error)
- func (c *Client) Get(key string) (flags uint64, value []byte, code McCode, err error)
- func (c *Client) Incr(key string, delta uint64) (result uint64, code McCode, err error)
- func (c *Client) MetaDebug(key string) (err error)
- func (c *Client) MetaDelete(key string, flags string) (err error)
- func (c *Client) MetaFlush() (err error)
- func (c *Client) MetaGet(key string, flags string) (err error)
- func (c *Client) MetaNoop() (err error)
- func (c *Client) MetaReceive() (rflags []byte, value []byte, code McCode, err error)
- func (c *Client) MetaSet(key string, flags string, value []byte) (err error)
- func (c *Client) ParseMetaResponse() (rflags []byte, value []byte, code McCode, err error)
- func (c *Client) Set(key string, flags uint32, expiration uint32, value []byte) (code McCode, err error)
- type Item
- type McCode
Constants ¶
const ( McCHECK_ERROR // bodge. guessing these should all be in err... McVA McOK McEN McME McNS McEX McNF McMN McSE McER McCL McHIT McMISS McSTORED McNOT_STORED McSERVER_ERROR McDELETED McNOT_FOUND McERROR )
const ( McOP_GET = 0x00 McOP_SET = 0x01 McOP_ADD = 0x02 McOP_REPLACE = 0x03 McOP_DELETE = 0x04 McOP_INCREMENT = 0x05 McOP_DECREMENT = 0x06 McOP_QUIT = 0x07 McOP_FLUSH = 0x08 McOP_GETQ = 0x09 McOP_NOOP = 0x0a McOP_VERSION = 0x0b McOP_GETK = 0x0c McOP_GETKQ = 0x0d McOP_APPEND = 0x0e McOP_PREPEND = 0x0f McOP_STAT = 0x10 McOP_SETQ = 0x11 McOP_ADDQ = 0x12 McOP_REPLACEQ = 0x13 McOP_DELETEQ = 0x14 McOP_INCREMENTQ = 0x15 McOP_DECREMENTQ = 0x16 McOP_QUITQ = 0x17 McOP_FLUSHQ = 0x18 McOP_APPENDQ = 0x19 McOP_PREPENDQ = 0x1a McOP_TOUCH = 0x1c )
Variables ¶
var ( ErrCorruptValue = errors.New("corrupt value in response") ErrUnknownStatus = errors.New("unknown status code in response") ErrKeyTooLong = errors.New("key is too long") ErrKeyDoesNotMatch = errors.New("response key does not match request key") ErrUnexpectedResponse = errors.New("unexpected response from server") ErrServerError = errors.New("SERVER_ERROR received") )
Define errors here to allow comparison.
var ( // ErrItemNotFound indicates the item was not found when command is cas/delete/incr/decr ErrItemNotFound = errors.New("item is not found") // ErrItemExists indicates the item has stored where command is cas ErrItemExists = errors.New("item exists") // ErrItemNotStored indicates the data not stored where command is add ErrItemNotStored = errors.New("item is not stored") )
Functions ¶
func ParseUint ¶
no overflow/anything testing. numerics from memcached should make sense unless corrupted.
Types ¶
type Client ¶
type Client struct { ConnectTimeout time.Duration // read or write timeout NetTimeout time.Duration Host string WBufSize int RBufSize int // contains filtered or unexported fields }
func (*Client) BinCorrupt ¶
sends a corrupt/bad/evil packet in some form.
func (*Client) BinFlush ¶
This _could_ just be Flush() and shared, but there might be reasons to hook something protocol specific in here.
func (*Client) BinReceive ¶
don't run this without anything in the queue :P
func (*Client) MetaReceive ¶
Note: User should stop pulling when they know no more responses will happen, else this will wait forever.
func (*Client) ParseMetaResponse ¶
type Item ¶
type Item struct { Key string Value []byte Expiration uint32 Flags uint32 CAS uint64 Opaque uint32 }
Debating if the other interfaces should use these structs... they should be passed in rather than generated internally. Also; should we be using a static byte buffer for key? not much to be done about the garbage generated by value, we can slice into what's generated by receiving data at least.