Documentation
¶
Index ¶
- Variables
- func Debugf(format string, a ...interface{})
- func ReplyToString(r ReplyWriter) (string, error)
- type BulkReply
- type ChannelWriter
- type CheckerFn
- type Config
- type Database
- type DefaultHandler
- func (h *DefaultHandler) Blpop(key string, keys ...string) (data [][]byte, err error)
- func (h *DefaultHandler) Brpop(key string, keys ...string) (data [][]byte, err error)
- func (h *DefaultHandler) Decr(key string) (int, error)
- func (h *DefaultHandler) Del(key string, keys ...string) (int, error)
- func (h *DefaultHandler) Exists(key string) (int, error)
- func (h *DefaultHandler) Expire(key, after string) (int, error)
- func (h *DefaultHandler) Get(key string) ([]byte, error)
- func (h *DefaultHandler) Hget(key, subkey string) ([]byte, error)
- func (h *DefaultHandler) Hgetall(key string) (HashValue, error)
- func (h *DefaultHandler) Hset(key, subkey string, value []byte) (int, error)
- func (h *DefaultHandler) Incr(key string) (int, error)
- func (h *DefaultHandler) Lindex(key string, index int) ([]byte, error)
- func (h *DefaultHandler) Lpush(key string, value []byte, values ...[]byte) (int, error)
- func (h *DefaultHandler) Lrange(key string, start, stop int) ([][]byte, error)
- func (h *DefaultHandler) Monitor() (*MonitorReply, error)
- func (h *DefaultHandler) Ping() (*StatusReply, error)
- func (h *DefaultHandler) Publish(key string, value []byte) (int, error)
- func (h *DefaultHandler) Rpush(key string, value []byte, values ...[]byte) (int, error)
- func (h *DefaultHandler) Select(key string) error
- func (h *DefaultHandler) Set(key string, value []byte) error
- func (h *DefaultHandler) Subscribe(channels ...[]byte) (*MultiChannelWriter, error)
- func (h *DefaultHandler) Zadd(key string, score int, value []byte, values ...[]byte) (int, error)
- func (h *DefaultHandler) Zrange(key string, min int, max int) ([][]byte, error)
- func (h *DefaultHandler) Zrangebyscore(key string, min int, max int) ([][]byte, error)
- func (h *DefaultHandler) Zrem(key string, value []byte, values ...[]byte) (int, error)
- func (h *DefaultHandler) Zremrangebyscore(key string, min int, max int) (int, error)
- type ErrorReply
- type HandlerFn
- type HashBrStack
- type HashHash
- type HashOrderedSet
- type HashSub
- type HashValue
- type IntegerReply
- type MonitorReply
- type MultiBulkReply
- type MultiChannelWriter
- type OrderedSet
- func (self *OrderedSet) Add(score int, value []byte) int
- func (self *OrderedSet) Range(lowerIndex, upperIndex int) [][]byte
- func (self *OrderedSet) RangeByScore(lowerScore, upperScore int) [][]byte
- func (self *OrderedSet) Rem(value []byte) int
- func (self *OrderedSet) RemRangeByScore(lowerScore, upperScore int) int
- type ReplyWriter
- type Request
- func (r *Request) ExpectArgument(index int) ReplyWriter
- func (r *Request) GetInteger(index int) (int, ReplyWriter)
- func (r *Request) GetMap(index int) (map[string][]byte, ReplyWriter)
- func (r *Request) GetPositiveInteger(index int) (int, ReplyWriter)
- func (r *Request) GetString(index int) (string, ReplyWriter)
- func (r *Request) GetStringSlice(index int) ([]string, ReplyWriter)
- func (r *Request) HasArgument(index int) bool
- type Server
- func (srv *Server) Apply(r *Request) (ReplyWriter, error)
- func (srv *Server) ApplyString(r *Request) (string, error)
- func (srv *Server) Close() error
- func (srv *Server) Register(name string, fn HandlerFn)
- func (srv *Server) RegisterFct(key string, f interface{}) error
- func (srv *Server) Serve(l net.Listener) error
- func (srv *Server) ServeClient(conn net.Conn) (err error)
- func (srv *Server) Start() error
- type Stack
- type StatusReply
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMethodNotSupported = NewError("Method is not supported") ErrNotEnoughArgs = NewError("Not enough arguments for the command") ErrTooMuchArgs = NewError("Too many arguments for the command") ErrWrongArgsNumber = NewError("Wrong number of arguments") ErrExpectInteger = NewError("Expected integer") ErrExpectPositivInteger = NewError("Expected positive integer") ErrExpectMorePair = NewError("Expected at least one key val pair") ErrExpectEvenPair = NewError("Got uneven number of key val pairs") )
View Source
var (
ErrParseTimeout = errors.New("timeout is not an integer or out of range")
)
Functions ¶
func Debugf ¶
func Debugf(format string, a ...interface{})
Debug function, if the debug flag is set, then display. Do nothing otherwise If Docker is in damon mode, also send the debug info on the socket Convenience debug function, courtesy of http://github.com/dotcloud/docker
func ReplyToString ¶
func ReplyToString(r ReplyWriter) (string, error)
Types ¶
type ChannelWriter ¶
type ChannelWriter struct {
FirstReply []interface{}
Channel chan []interface{}
// contains filtered or unexported fields
}
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func DefaultConfig ¶
func DefaultConfig() *Config
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func NewDatabase ¶
type DefaultHandler ¶
type DefaultHandler struct {
*Database
// contains filtered or unexported fields
}
func NewDefaultHandler ¶
func NewDefaultHandler() *DefaultHandler
func (*DefaultHandler) Blpop ¶
func (h *DefaultHandler) Blpop(key string, keys ...string) (data [][]byte, err error)
func (*DefaultHandler) Brpop ¶
func (h *DefaultHandler) Brpop(key string, keys ...string) (data [][]byte, err error)
func (*DefaultHandler) Hset ¶
func (h *DefaultHandler) Hset(key, subkey string, value []byte) (int, error)
func (*DefaultHandler) Lindex ¶
func (h *DefaultHandler) Lindex(key string, index int) ([]byte, error)
func (*DefaultHandler) Lrange ¶
func (h *DefaultHandler) Lrange(key string, start, stop int) ([][]byte, error)
func (*DefaultHandler) Monitor ¶
func (h *DefaultHandler) Monitor() (*MonitorReply, error)
func (*DefaultHandler) Ping ¶
func (h *DefaultHandler) Ping() (*StatusReply, error)
func (*DefaultHandler) Publish ¶
func (h *DefaultHandler) Publish(key string, value []byte) (int, error)
func (*DefaultHandler) Select ¶
func (h *DefaultHandler) Select(key string) error
func (*DefaultHandler) Subscribe ¶
func (h *DefaultHandler) Subscribe(channels ...[]byte) (*MultiChannelWriter, error)
func (*DefaultHandler) Zrangebyscore ¶
func (*DefaultHandler) Zremrangebyscore ¶
type ErrorReply ¶
type ErrorReply struct {
// contains filtered or unexported fields
}
func NewError ¶
func NewError(message string) *ErrorReply
func (*ErrorReply) Error ¶
func (er *ErrorReply) Error() string
type HandlerFn ¶
type HandlerFn func(r *Request) (ReplyWriter, error)
type HashBrStack ¶
type HashOrderedSet ¶
type HashOrderedSet map[string]*OrderedSet
type HashSub ¶
type HashSub map[string][]*ChannelWriter
type IntegerReply ¶
type IntegerReply struct {
// contains filtered or unexported fields
}
type MonitorReply ¶
type MonitorReply struct {
// contains filtered or unexported fields
}
type MultiBulkReply ¶
type MultiBulkReply struct {
// contains filtered or unexported fields
}
for nil reply in multi bulk just set []byte as nil
func MultiBulkFromMap ¶
func MultiBulkFromMap(m map[string]interface{}) *MultiBulkReply
type MultiChannelWriter ¶
type MultiChannelWriter struct {
Chans []*ChannelWriter
}
type OrderedSet ¶
type OrderedSet struct {
// contains filtered or unexported fields
}
func NewOrderedSet ¶
func NewOrderedSet() *OrderedSet
func (*OrderedSet) Range ¶
func (self *OrderedSet) Range(lowerIndex, upperIndex int) [][]byte
func (*OrderedSet) RangeByScore ¶
func (self *OrderedSet) RangeByScore(lowerScore, upperScore int) [][]byte
func (*OrderedSet) Rem ¶
func (self *OrderedSet) Rem(value []byte) int
func (*OrderedSet) RemRangeByScore ¶
func (self *OrderedSet) RemRangeByScore(lowerScore, upperScore int) int
type ReplyWriter ¶
type Request ¶
func (*Request) ExpectArgument ¶
func (r *Request) ExpectArgument(index int) ReplyWriter
func (*Request) GetInteger ¶
func (r *Request) GetInteger(index int) (int, ReplyWriter)
func (*Request) GetPositiveInteger ¶
func (r *Request) GetPositiveInteger(index int) (int, ReplyWriter)
func (*Request) GetStringSlice ¶
func (r *Request) GetStringSlice(index int) ([]string, ReplyWriter)
func (*Request) HasArgument ¶
type Server ¶
type Server struct {
sync.Mutex
Proto string
Addr string // TCP address to listen on, ":6389" if empty
MonitorChans []chan string
// contains filtered or unexported fields
}
func (*Server) RegisterFct ¶
func (*Server) Serve ¶
Serve accepts incoming connections on the Listener l, creating a new service goroutine for each. The service goroutines read requests and then call srv.Handler to reply to them.
func (*Server) ServeClient ¶
Serve starts a new redis session, using `conn` as a transport. It reads commands using the redis protocol, passes them to `handler`, and returns the result.
type Stack ¶
type Stack struct {
sync.Mutex
Key string
Chan chan *Stack
// contains filtered or unexported fields
}
type StatusReply ¶
type StatusReply struct {
Code string
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.
