Documentation
¶
Index ¶
- Constants
- Variables
- type ArrayEntDecoder
- type DictEntDecoder
- type Ent
- type EntEncoder
- func (c *EntEncoder) BeginDict(length int)
- func (c *EntEncoder) BeginEnt(version uint64)
- func (c *EntEncoder) BeginHSET(key []byte, nfields int)
- func (c *EntEncoder) BeginList(length int)
- func (c *EntEncoder) Blob(v []byte)
- func (c *EntEncoder) Bool(v bool)
- func (c *EntEncoder) Buffer() []byte
- func (c *EntEncoder) EndDict()
- func (c *EntEncoder) EndEnt()
- func (c *EntEncoder) EndList()
- func (c *EntEncoder) Err() error
- func (c *EntEncoder) Float(v float64, bitsize int)
- func (c *EntEncoder) Int(v int64, bitsize int)
- func (c *EntEncoder) Key(k string)
- func (c *EntEncoder) Str(v string)
- func (c *EntEncoder) Uint(v uint64, bitsize int)
- type EntStorage
- func (s *EntStorage) Close() error
- func (s *EntStorage) CreateEnt(e ent.Ent, fieldmap uint64) (id uint64, err error)
- func (s *EntStorage) DeleteEnt(e ent.Ent) error
- func (s *EntStorage) FindEntIdsByIndex(entType string, x *ent.EntIndex, key []byte, limit int) (ids []uint64, err error)
- func (s *EntStorage) LoadEntById(e Ent, id uint64) (version uint64, err error)
- func (s *EntStorage) LoadEntsByIndex(e Ent, x *ent.EntIndex, key []byte, limit int) ([]Ent, error)
- func (s *EntStorage) SaveEnt(e Ent, fieldmap uint64) (nextVersion uint64, err error)
- type RCmd
- type RESPType
- type RIOWriter
- type RReader
- func (r *RReader) AnyData(buf []byte) []byte
- func (r *RReader) AppendBlob(buf []byte) []byte
- func (r *RReader) Blob() []byte
- func (r *RReader) Bool() bool
- func (r *RReader) BytesArray() [][]byte
- func (r *RReader) DictHeader() int
- func (r *RReader) Discard()
- func (r *RReader) Err() error
- func (r *RReader) Float(bitsize int) float64
- func (r *RReader) HexUint(bitsize int) uint64
- func (r *RReader) Int(bitsize int) int64
- func (r *RReader) IntArray(bitsize int) []int64
- func (r *RReader) ListHeader() int
- func (r *RReader) Next(buf []byte) (typ RESPType, data []byte)
- func (r *RReader) Scalar() (typ RESPType, data []byte)
- func (r *RReader) SetErr(err error)
- func (r *RReader) Str() string
- func (r *RReader) StrArray() []string
- func (r *RReader) Uint(bitsize int) uint64
- type RWriter
- func (w *RWriter) ArrayHeader(length int)
- func (w *RWriter) Blob(data []byte)
- func (w *RWriter) Bool(v bool)
- func (w *RWriter) Err() error
- func (w *RWriter) Float(v float64, bitsize int)
- func (w *RWriter) Int(v int64, bitsize int)
- func (w *RWriter) Str(s string)
- func (w *RWriter) StringArray(sv ...string)
- func (w *RWriter) Uint(v uint64, bitsize int)
- type RawCmd
- type RawCmdHexUint
- type Redis
- func (r *Redis) Batch(f func(c radix.Conn) error) error
- func (r *Redis) BatchOnRClient(f func(c radix.Conn) error) error
- func (r *Redis) Close() error
- func (r *Redis) Del(key string) error
- func (r *Redis) GetBytes(key string) (value []byte, err error)
- func (r *Redis) GetString(key string) (value string, err error)
- func (r *Redis) HGet(key, field string, value_out interface{}) error
- func (r *Redis) Open(rwaddr, roaddr string, connPoolSize int) error
- func (r *Redis) OpenRetry(rwaddr, roaddr string, connPoolSize int)
- func (r *Redis) RClient() *radix.Pool
- func (r *Redis) Set(key string, value interface{}) error
- func (r *Redis) SetConnections(rwc, roc *radix.Pool) error
- func (r *Redis) SetExpiring(key string, ttl time.Duration, value interface{}) error
- func (r *Redis) UpdateExpire(key string, ttl time.Duration) error
- func (r *Redis) WClient() *radix.Pool
- type ZRangeEntIdsCmd
Constants ¶
Variables ¶
var ( CmdDISCARD = RawCmd{[]byte("*1\r\n$7\r\nDISCARD\r\n")} CmdEXEC = RawCmd{[]byte("*1\r\n$4\r\nEXEC\r\n")} CmdMULTI = RawCmd{[]byte("*1\r\n$5\r\nMULTI\r\n")} CmdUNWATCH = RawCmd{[]byte("*1\r\n$7\r\nUNWATCH\r\n")} )
constant commands without results
Functions ¶
This section is empty.
Types ¶
type ArrayEntDecoder ¶
type ArrayEntDecoder struct { *RReader // contains filtered or unexported fields }
ArrayEntDecoder is an implementation of ent.Decoder that decodes values in a known order. E.g. with keys=["key1", "key2", "key3"], reads "value1" "value2" "value3".
func (*ArrayEntDecoder) Key ¶
func (r *ArrayEntDecoder) Key() string
func (*ArrayEntDecoder) More ¶
func (r *ArrayEntDecoder) More() bool
type DictEntDecoder ¶
type DictEntDecoder struct { *RReader // contains filtered or unexported fields }
DictEntDecoder is an implementation of ent.Decoder which reads keys and values interleaved. E.g. "key1" "value1" "key2" "value2" ...
func (*DictEntDecoder) Key ¶
func (r *DictEntDecoder) Key() string
func (*DictEntDecoder) More ¶
func (r *DictEntDecoder) More() bool
type EntEncoder ¶
type EntEncoder struct {
// contains filtered or unexported fields
}
EntEncoder is an implementation of ent.Encoder Since we store ents in Redis hashes (HSET, HGET, et al) values must all be strings, which is why this is not really using RWriter.
func (*EntEncoder) BeginDict ¶
func (c *EntEncoder) BeginDict(length int)
func (*EntEncoder) BeginEnt ¶
func (c *EntEncoder) BeginEnt(version uint64)
func (*EntEncoder) BeginHSET ¶
func (c *EntEncoder) BeginHSET(key []byte, nfields int)
func (*EntEncoder) BeginList ¶
func (c *EntEncoder) BeginList(length int)
func (*EntEncoder) Blob ¶
func (c *EntEncoder) Blob(v []byte)
func (*EntEncoder) Bool ¶
func (c *EntEncoder) Bool(v bool)
func (*EntEncoder) Buffer ¶
func (c *EntEncoder) Buffer() []byte
func (*EntEncoder) EndDict ¶
func (c *EntEncoder) EndDict()
func (*EntEncoder) EndEnt ¶
func (c *EntEncoder) EndEnt()
func (*EntEncoder) EndList ¶
func (c *EntEncoder) EndList()
func (*EntEncoder) Err ¶
func (c *EntEncoder) Err() error
func (*EntEncoder) Float ¶
func (c *EntEncoder) Float(v float64, bitsize int)
func (*EntEncoder) Int ¶
func (c *EntEncoder) Int(v int64, bitsize int)
func (*EntEncoder) Key ¶
func (c *EntEncoder) Key(k string)
func (*EntEncoder) Str ¶
func (c *EntEncoder) Str(v string)
func (*EntEncoder) Uint ¶
func (c *EntEncoder) Uint(v uint64, bitsize int)
type EntStorage ¶
type EntStorage struct {
// contains filtered or unexported fields
}
func NewEntStorage ¶
func NewEntStorage(r *Redis) *EntStorage
func (*EntStorage) Close ¶
func (s *EntStorage) Close() error
func (*EntStorage) CreateEnt ¶
CreateEnt is part of the ent.Storage interface, used by TYPE.Create()
func (*EntStorage) DeleteEnt ¶
func (s *EntStorage) DeleteEnt(e ent.Ent) error
DeleteEnt is part of the ent.Storage interface, used by TYPE.PermanentlyDelete()
func (*EntStorage) FindEntIdsByIndex ¶
func (s *EntStorage) FindEntIdsByIndex( entType string, x *ent.EntIndex, key []byte, limit int, ) (ids []uint64, err error)
FindEntIdsByIndex is part of the ent.Storage interface, used by FindTYPEByINDEX
func (*EntStorage) LoadEntById ¶
func (s *EntStorage) LoadEntById(e Ent, id uint64) (version uint64, err error)
LoadEntById is part of the ent.Storage interface, used by LoadTYPEById()
func (*EntStorage) LoadEntsByIndex ¶
func (s *EntStorage) LoadEntsByIndex( e Ent, x *ent.EntIndex, key []byte, limit int, ) ([]Ent, error)
LoadEntsByIndex is part of the ent.Storage interface, used by LoadTYPEByINDEX
type RIOWriter ¶
type RIOWriter struct { RWriter // contains filtered or unexported fields }
RIOWriter is an extension of RWriter with buffered IO, writing to a io.Writer
type RReader ¶
type RReader struct {
// contains filtered or unexported fields
}
func (*RReader) AnyData ¶
AnyData reads the next message uninterpreted. If buf is not nil, it is used for reading the data and a slice of it is returned. If buf is nil or its cap is less than needed, a new byte array is allocated.
func (*RReader) AppendBlob ¶
AppendBlob reads the next message (uninterpreted) and appends it to buf
func (*RReader) BytesArray ¶
BytesArray reads an array of raw byte arrays
func (*RReader) DictHeader ¶
func (*RReader) Discard ¶
func (r *RReader) Discard()
Discard reads & discards the next message, including entire arrays
func (*RReader) ListHeader ¶
ListHeader reads an array header, returning the number of elements that follows. Returns -1 to signal "nil array" and 0 signals "empty array" since the RESP protocol makes that distinction (though Go does not.)
func (*RReader) Next ¶
Next is a low-level read function which reads whatever RESP message comes next, without and interpretation. Note that in the case typ is RESPTypeArray the caller is responsible for reading ParseInt(data) more messages (array elements) to uphold the read stream integrity. When typ==RESPTypeError, r.Err() is set to reflect the error message. buf is optional. If nil new buffers are allocated for the response (data), else buf is used for data if it's large enough.
func (*RReader) Scalar ¶
Scalar reads any scalar value. Compound types like arrays are skipped & discarded.
type RWriter ¶
type RWriter struct {
// contains filtered or unexported fields
}
func (*RWriter) ArrayHeader ¶
func (*RWriter) StringArray ¶
type RawCmd ¶
type RawCmd struct {
Data []byte // never mutated
}
RawCmd sends verbatim bytes over a redis connection and discards any replies
type RawCmdHexUint ¶
func (*RawCmdHexUint) Run ¶
func (c *RawCmdHexUint) Run(conn radix.Conn) error
func (*RawCmdHexUint) UnmarshalRESP ¶
func (c *RawCmdHexUint) UnmarshalRESP(r *bufio.Reader) error
type Redis ¶
type Redis struct { Logger *log.Logger // contains filtered or unexported fields }
func (*Redis) BatchOnRClient ¶
func (*Redis) RClient ¶
func (r *Redis) RClient() *radix.Pool
RClient returns a redis connection for reading
func (*Redis) SetConnections ¶
func (*Redis) SetExpiring ¶
type ZRangeEntIdsCmd ¶
func (*ZRangeEntIdsCmd) Run ¶
func (c *ZRangeEntIdsCmd) Run(conn radix.Conn) error
func (*ZRangeEntIdsCmd) UnmarshalRESP ¶
func (c *ZRangeEntIdsCmd) UnmarshalRESP(r *bufio.Reader) error