Documentation ¶
Index ¶
- Variables
- func RegisterCommand(name string, executor ExecFunc, cExecutor ClusterExecFunc, arity int)
- type ClusterDatabase
- func (cluster *ClusterDatabase) Close()
- func (cluster *ClusterDatabase) Exec(c *server.Conn, cmdLine [][]byte) (result reply.Reply)
- func (cluster *ClusterDatabase) NotifyJoin(n *memberlist.Node)
- func (cluster *ClusterDatabase) NotifyLeave(n *memberlist.Node)
- func (cluster *ClusterDatabase) NotifyUpdate(n *memberlist.Node)
- type ClusterEventHandler
- type ClusterExecFunc
- type CmdLine
- type DataEntity
- type Database
- type ExecFunc
- type KeyType
- type MutilDB
- type SingleDB
- func (db *SingleDB) CheckIsExist(key string) bool
- func (db *SingleDB) Close()
- func (db *SingleDB) Exec(c *server.Conn, cmdLine [][]byte) reply.Reply
- func (db *SingleDB) Flush()
- func (db *SingleDB) GetEntity(key string) (*DataEntity, bool)
- func (db *SingleDB) PutEntity(key string, entity *DataEntity) int
- func (db *SingleDB) PutIfAbsent(key string, entity *DataEntity) int
- func (db *SingleDB) PutIfExists(key string, entity *DataEntity) int
- func (db *SingleDB) Remove(key string)
- func (db *SingleDB) Removes(keys ...string) (deleted int)
Constants ¶
This section is empty.
Variables ¶
var JoinClusterFunc func()
Functions ¶
func RegisterCommand ¶
func RegisterCommand(name string, executor ExecFunc, cExecutor ClusterExecFunc, arity int)
RegisterCommand registers a new command arity means allowed number of cmdArgs, arity < 0 means len(args) >= -arity. for example: the arity of `get` is 2, `mget` is -2
Types ¶
type ClusterDatabase ¶
type ClusterDatabase struct {
// contains filtered or unexported fields
}
ClusterDatabase represents a node of godis cluster it holds part of data and coordinates other nodes to finish transactions
func NewClusterDB ¶
func NewClusterDB(opt options.KuloyOptions) *ClusterDatabase
MakeClusterDatabase creates and starts a node of cluster
func (*ClusterDatabase) Close ¶
func (cluster *ClusterDatabase) Close()
Close stops current node of cluster
func (*ClusterDatabase) NotifyJoin ¶
func (cluster *ClusterDatabase) NotifyJoin(n *memberlist.Node)
func (*ClusterDatabase) NotifyLeave ¶
func (cluster *ClusterDatabase) NotifyLeave(n *memberlist.Node)
func (*ClusterDatabase) NotifyUpdate ¶
func (cluster *ClusterDatabase) NotifyUpdate(n *memberlist.Node)
type ClusterEventHandler ¶
type ClusterEventHandler struct{}
type ClusterExecFunc ¶
type ClusterExecFunc func(cluster *ClusterDatabase, c *server.Conn, cmdAndArgs [][]byte) reply.Reply
ClusterExecFunc represents the handler of a redis command
type DataEntity ¶
DataEntity stores data bound to a key, including a string, list, hash, set and so on
type MutilDB ¶
type MutilDB struct {
// contains filtered or unexported fields
}
MutilDB is a set of multiple database set
func NewMutilDB ¶
NewDatabase creates a redis database,
type SingleDB ¶
type SingleDB struct {
// contains filtered or unexported fields
}
DB stores data and execute user's commands
func NewSingleDB ¶
NewSingleDB create single DB instance
func (*SingleDB) CheckIsExist ¶
CheckIsExist check the given key from db if exist
func (*SingleDB) GetEntity ¶
func (db *SingleDB) GetEntity(key string) (*DataEntity, bool)
GetEntity returns DataEntity bind to given key
func (*SingleDB) PutEntity ¶
func (db *SingleDB) PutEntity(key string, entity *DataEntity) int
PutEntity a DataEntity into DB
func (*SingleDB) PutIfAbsent ¶
func (db *SingleDB) PutIfAbsent(key string, entity *DataEntity) int
PutIfAbsent insert an DataEntity only if the key not exists
func (*SingleDB) PutIfExists ¶
func (db *SingleDB) PutIfExists(key string, entity *DataEntity) int
PutIfExists edit an existing DataEntity