Documentation
¶
Overview ¶
communicate with peers within cluster
Index ¶
- Constants
- func Commit(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func CommitDel(cluster *Cluster, c redis.Connection, tx *Transaction) redis.Reply
- func CommitMSet(cluster *Cluster, c redis.Connection, tx *Transaction) redis.Reply
- func Del(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func FlushAll(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func FlushDB(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func MGet(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func MSet(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func MSetNX(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func MakeRouter() map[string]CmdFunc
- func OnRelayedPublish(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func Ping(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func PrepareDel(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func PrepareMSet(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func Publish(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func Rename(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func RenameNx(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func RequestCommit(cluster *Cluster, c redis.Connection, txId int64, peers map[string][]string) ([]redis.Reply, reply.ErrorReply)
- func RequestRollback(cluster *Cluster, c redis.Connection, txId int64, peers map[string][]string)
- func Rollback(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func Subscribe(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func UnSubscribe(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- type Cluster
- func (cluster *Cluster) AfterClientClose(c redis.Connection)
- func (cluster *Cluster) Broadcast(c redis.Connection, args [][]byte) map[string]redis.Reply
- func (cluster *Cluster) Close()
- func (cluster *Cluster) Exec(c redis.Connection, args [][]byte) (result redis.Reply)
- func (cluster *Cluster) Relay(peer string, c redis.Connection, args [][]byte) redis.Reply
- type CmdFunc
- type ConnectionFactory
- func (f *ConnectionFactory) ActivateObject(ctx context.Context, object *pool.PooledObject) error
- func (f *ConnectionFactory) DestroyObject(ctx context.Context, object *pool.PooledObject) error
- func (f *ConnectionFactory) MakeObject(ctx context.Context) (*pool.PooledObject, error)
- func (f *ConnectionFactory) PassivateObject(ctx context.Context, object *pool.PooledObject) error
- func (f *ConnectionFactory) ValidateObject(ctx context.Context, object *pool.PooledObject) bool
- type Transaction
Constants ¶
View Source
const ( CreatedStatus = 0 PreparedStatus = 1 CommittedStatus = 2 RolledBackStatus = 3 )
Variables ¶
This section is empty.
Functions ¶
func CommitDel ¶
func CommitDel(cluster *Cluster, c redis.Connection, tx *Transaction) redis.Reply
invoker should provide lock
func CommitMSet ¶
func CommitMSet(cluster *Cluster, c redis.Connection, tx *Transaction) redis.Reply
invoker should provide lock
func MakeRouter ¶
func OnRelayedPublish ¶
receive publish command from peer, just publish to local subscribing clients, do not relay to peers
func PrepareDel ¶
args: PrepareDel id keys...
func PrepareMSet ¶
args: PrepareMSet id keys...
func RequestCommit ¶
func RequestCommit(cluster *Cluster, c redis.Connection, txId int64, peers map[string][]string) ([]redis.Reply, reply.ErrorReply)
request all node commit transaction as leader
func RequestRollback ¶
request all node rollback transaction as leader
func UnSubscribe ¶
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func (*Cluster) AfterClientClose ¶
func (cluster *Cluster) AfterClientClose(c redis.Connection)
type ConnectionFactory ¶
type ConnectionFactory struct {
Peer string
}
func (*ConnectionFactory) ActivateObject ¶
func (f *ConnectionFactory) ActivateObject(ctx context.Context, object *pool.PooledObject) error
func (*ConnectionFactory) DestroyObject ¶
func (f *ConnectionFactory) DestroyObject(ctx context.Context, object *pool.PooledObject) error
func (*ConnectionFactory) MakeObject ¶
func (f *ConnectionFactory) MakeObject(ctx context.Context) (*pool.PooledObject, error)
func (*ConnectionFactory) PassivateObject ¶
func (f *ConnectionFactory) PassivateObject(ctx context.Context, object *pool.PooledObject) error
func (*ConnectionFactory) ValidateObject ¶
func (f *ConnectionFactory) ValidateObject(ctx context.Context, object *pool.PooledObject) bool
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func NewTransaction ¶
func NewTransaction(cluster *Cluster, c redis.Connection, id string, args [][]byte, keys []string) *Transaction
Click to show internal directories.
Click to hide internal directories.