protocol

package
v0.5.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultScanCount = 10
View Source
const StatusOK = "OK"

Variables

View Source
var Cluster = &ClusterCommands{
	RoutingTable: "cluster.routingtable",
	Members:      "cluster.members",
}
View Source
var DMap = &DMapCommands{
	Get:         "dm.get",
	GetEntry:    "dm.getentry",
	Put:         "dm.put",
	PutEntry:    "dm.putentry",
	Del:         "dm.del",
	DelEntry:    "dm.delentry",
	Expire:      "dm.expire",
	PExpire:     "dm.pexpire",
	Destroy:     "dm.destroy",
	Incr:        "dm.incr",
	Decr:        "dm.decr",
	GetPut:      "dm.getput",
	IncrByFloat: "dm.incrbyfloat",
	Lock:        "dm.lock",
	Unlock:      "dm.unlock",
	LockLease:   "dm.locklease",
	PLockLease:  "dm.plocklease",
	Scan:        "dm.scan",
}
View Source
var ErrInvalidArgument = errors.New("invalid argument")
View Source
var Generic = &GenericCommands{
	Ping:  "ping",
	Stats: "stats",
}
View Source
var GenericError = "ERR"
View Source
var Internal = &InternalCommands{
	MoveFragment:  "internal.node.movefragment",
	UpdateRouting: "internal.node.updaterouting",
	LengthOfPart:  "internal.node.lengthofpart",
}
View Source
var PubSub = &PubSubCommands{
	Publish:         "publish",
	PublishInternal: "publish.internal",
	Subscribe:       "subscribe",
	PSubscribe:      "psubscribe",
	PubSubChannels:  "pubsub channels",
	PubSubNumpat:    "pubsub numpat",
	PubSubNumsub:    "pubsub numsub",
}

Functions

func ConvertError added in v0.5.0

func ConvertError(err error) error

func GetError added in v0.5.0

func GetError(prefix string) error

func GetPrefix added in v0.5.0

func GetPrefix(err error) string

func SetError added in v0.5.0

func SetError(prefix string, err error)

func WriteError added in v0.5.0

func WriteError(conn redcon.Conn, err error)

Types

type ClusterCommands added in v0.5.0

type ClusterCommands struct {
	RoutingTable string
	Members      string
}

type ClusterMembers added in v0.5.0

type ClusterMembers struct{}

func NewClusterMembers added in v0.5.0

func NewClusterMembers() *ClusterMembers

func ParseClusterMembers added in v0.5.0

func ParseClusterMembers(cmd redcon.Command) (*ClusterMembers, error)

func (*ClusterMembers) Command added in v0.5.0

func (c *ClusterMembers) Command(ctx context.Context) *redis.Cmd

type ClusterRoutingTable added in v0.5.0

type ClusterRoutingTable struct{}

func NewClusterRoutingTable added in v0.5.0

func NewClusterRoutingTable() *ClusterRoutingTable

func ParseClusterRoutingTable added in v0.5.0

func ParseClusterRoutingTable(cmd redcon.Command) (*ClusterRoutingTable, error)

func (*ClusterRoutingTable) Command added in v0.5.0

func (c *ClusterRoutingTable) Command(ctx context.Context) *redis.Cmd

type DMapCommands added in v0.5.0

type DMapCommands struct {
	Get         string
	GetEntry    string
	Put         string
	PutEntry    string
	Del         string
	DelEntry    string
	Expire      string
	PExpire     string
	Destroy     string
	Query       string
	Incr        string
	Decr        string
	GetPut      string
	IncrByFloat string
	Lock        string
	Unlock      string
	LockLease   string
	PLockLease  string
	Scan        string
}

type Decr added in v0.5.0

type Decr struct {
	*Incr
}

func NewDecr added in v0.5.0

func NewDecr(dmap, key string, delta int) *Decr

func ParseDecrCommand added in v0.5.0

func ParseDecrCommand(cmd redcon.Command) (*Decr, error)

func (*Decr) Command added in v0.5.0

func (d *Decr) Command(ctx context.Context) *redis.IntCmd

type Del added in v0.5.0

type Del struct {
	DMap string
	Keys []string
}

func NewDel added in v0.5.0

func NewDel(dmap string, keys ...string) *Del

func ParseDelCommand added in v0.5.0

func ParseDelCommand(cmd redcon.Command) (*Del, error)

func (*Del) Command added in v0.5.0

func (d *Del) Command(ctx context.Context) *redis.IntCmd

type DelEntry added in v0.5.0

type DelEntry struct {
	Del     *Del
	Replica bool
}

func NewDelEntry added in v0.5.0

func NewDelEntry(dmap, key string) *DelEntry

func ParseDelEntryCommand added in v0.5.0

func ParseDelEntryCommand(cmd redcon.Command) (*DelEntry, error)

func (*DelEntry) Command added in v0.5.0

func (d *DelEntry) Command(ctx context.Context) *redis.IntCmd

func (*DelEntry) SetReplica added in v0.5.0

func (d *DelEntry) SetReplica() *DelEntry

type Destroy added in v0.5.0

type Destroy struct {
	DMap  string
	Local bool
}

func NewDestroy added in v0.5.0

func NewDestroy(dmap string) *Destroy

func ParseDestroyCommand added in v0.5.0

func ParseDestroyCommand(cmd redcon.Command) (*Destroy, error)

func (*Destroy) Command added in v0.5.0

func (d *Destroy) Command(ctx context.Context) *redis.StatusCmd

func (*Destroy) SetLocal added in v0.5.0

func (d *Destroy) SetLocal() *Destroy

type Expire added in v0.5.0

type Expire struct {
	DMap    string
	Key     string
	Seconds time.Duration
}

func NewExpire added in v0.5.0

func NewExpire(dmap, key string, seconds time.Duration) *Expire

func ParseExpireCommand added in v0.5.0

func ParseExpireCommand(cmd redcon.Command) (*Expire, error)

func (*Expire) Command added in v0.5.0

func (e *Expire) Command(ctx context.Context) *redis.StatusCmd

type GenericCommands added in v0.5.0

type GenericCommands struct {
	Ping  string
	Stats string
}

type Get added in v0.5.0

type Get struct {
	DMap string
	Key  string
	Raw  bool
}

func NewGet added in v0.5.0

func NewGet(dmap, key string) *Get

func ParseGetCommand added in v0.5.0

func ParseGetCommand(cmd redcon.Command) (*Get, error)

func (*Get) Command added in v0.5.0

func (g *Get) Command(ctx context.Context) *redis.StringCmd

func (*Get) SetRaw added in v0.5.0

func (g *Get) SetRaw() *Get

type GetEntry added in v0.5.0

type GetEntry struct {
	DMap    string
	Key     string
	Replica bool
}

func NewGetEntry added in v0.5.0

func NewGetEntry(dmap, key string) *GetEntry

func ParseGetEntryCommand added in v0.5.0

func ParseGetEntryCommand(cmd redcon.Command) (*GetEntry, error)

func (*GetEntry) Command added in v0.5.0

func (g *GetEntry) Command(ctx context.Context) *redis.StringCmd

func (*GetEntry) SetReplica added in v0.5.0

func (g *GetEntry) SetReplica() *GetEntry

type GetPut added in v0.5.0

type GetPut struct {
	DMap  string
	Key   string
	Value []byte
	Raw   bool
}

func NewGetPut added in v0.5.0

func NewGetPut(dmap, key string, value []byte) *GetPut

func ParseGetPutCommand added in v0.5.0

func ParseGetPutCommand(cmd redcon.Command) (*GetPut, error)

func (*GetPut) Command added in v0.5.0

func (g *GetPut) Command(ctx context.Context) *redis.StringCmd

func (*GetPut) SetRaw added in v0.5.0

func (g *GetPut) SetRaw() *GetPut

type Incr added in v0.5.0

type Incr struct {
	DMap  string
	Key   string
	Delta int
}

func NewIncr added in v0.5.0

func NewIncr(dmap, key string, delta int) *Incr

func ParseIncrCommand added in v0.5.0

func ParseIncrCommand(cmd redcon.Command) (*Incr, error)

func (*Incr) Command added in v0.5.0

func (i *Incr) Command(ctx context.Context) *redis.IntCmd

type IncrByFloat added in v0.5.0

type IncrByFloat struct {
	DMap  string
	Key   string
	Delta float64
}

func NewIncrByFloat added in v0.5.0

func NewIncrByFloat(dmap, key string, delta float64) *IncrByFloat

func ParseIncrByFloatCommand added in v0.5.0

func ParseIncrByFloatCommand(cmd redcon.Command) (*IncrByFloat, error)

func (*IncrByFloat) Command added in v0.5.0

func (i *IncrByFloat) Command(ctx context.Context) *redis.FloatCmd

type InternalCommands added in v0.5.0

type InternalCommands struct {
	MoveFragment        string
	UpdateRouting       string
	LengthOfPart        string
	ClusterRoutingTable string
}

type LengthOfPart added in v0.5.0

type LengthOfPart struct {
	PartID  uint64
	Replica bool
}

func NewLengthOfPart added in v0.5.0

func NewLengthOfPart(partID uint64) *LengthOfPart

func ParseLengthOfPartCommand added in v0.5.0

func ParseLengthOfPartCommand(cmd redcon.Command) (*LengthOfPart, error)

func (*LengthOfPart) Command added in v0.5.0

func (l *LengthOfPart) Command(ctx context.Context) *redis.IntCmd

func (*LengthOfPart) SetReplica added in v0.5.0

func (l *LengthOfPart) SetReplica() *LengthOfPart

type Lock added in v0.5.0

type Lock struct {
	DMap     string
	Key      string
	Deadline float64
	EX       float64
	PX       int64
}

func NewLock added in v0.5.0

func NewLock(dmap, key string, deadline float64) *Lock

func ParseLockCommand added in v0.5.0

func ParseLockCommand(cmd redcon.Command) (*Lock, error)

func (*Lock) Command added in v0.5.0

func (l *Lock) Command(ctx context.Context) *redis.StringCmd

func (*Lock) SetEX added in v0.5.0

func (l *Lock) SetEX(ex float64) *Lock

func (*Lock) SetPX added in v0.5.0

func (l *Lock) SetPX(px int64) *Lock

type LockLease added in v0.5.0

type LockLease struct {
	DMap    string
	Key     string
	Token   string
	Timeout float64
}

func NewLockLease added in v0.5.0

func NewLockLease(dmap, key, token string, timeout float64) *LockLease

func ParseLockLeaseCommand added in v0.5.0

func ParseLockLeaseCommand(cmd redcon.Command) (*LockLease, error)

func (*LockLease) Command added in v0.5.0

func (l *LockLease) Command(ctx context.Context) *redis.StatusCmd

type MoveFragment added in v0.5.0

type MoveFragment struct {
	Payload []byte
}

func NewMoveFragment added in v0.5.0

func NewMoveFragment(payload []byte) *MoveFragment

func ParseMoveFragmentCommand added in v0.5.0

func ParseMoveFragmentCommand(cmd redcon.Command) (*MoveFragment, error)

func (*MoveFragment) Command added in v0.5.0

func (m *MoveFragment) Command(ctx context.Context) *redis.StatusCmd

type PExpire added in v0.5.0

type PExpire struct {
	DMap         string
	Key          string
	Milliseconds time.Duration
}

func NewPExpire added in v0.5.0

func NewPExpire(dmap, key string, milliseconds time.Duration) *PExpire

func ParsePExpireCommand added in v0.5.0

func ParsePExpireCommand(cmd redcon.Command) (*PExpire, error)

func (*PExpire) Command added in v0.5.0

func (p *PExpire) Command(ctx context.Context) *redis.StatusCmd

type PLockLease added in v0.5.0

type PLockLease struct {
	DMap    string
	Key     string
	Token   string
	Timeout int64
}

func NewPLockLease added in v0.5.0

func NewPLockLease(dmap, key, token string, timeout int64) *PLockLease

func ParsePLockLeaseCommand added in v0.5.0

func ParsePLockLeaseCommand(cmd redcon.Command) (*PLockLease, error)

func (*PLockLease) Command added in v0.5.0

func (p *PLockLease) Command(ctx context.Context) *redis.StatusCmd

type PSubscribe added in v0.5.0

type PSubscribe struct {
	Patterns []string
}

func NewPSubscribe added in v0.5.0

func NewPSubscribe(patterns ...string) *PSubscribe

func ParsePSubscribeCommand added in v0.5.0

func ParsePSubscribeCommand(cmd redcon.Command) (*PSubscribe, error)

func (*PSubscribe) Command added in v0.5.0

func (s *PSubscribe) Command(ctx context.Context) *redis.SliceCmd

type Ping added in v0.5.0

type Ping struct {
	Message string
}

func NewPing added in v0.5.0

func NewPing() *Ping

func ParsePingCommand added in v0.5.0

func ParsePingCommand(cmd redcon.Command) (*Ping, error)

func (*Ping) Command added in v0.5.0

func (p *Ping) Command(ctx context.Context) *redis.StringCmd

func (*Ping) SetMessage added in v0.5.0

func (p *Ping) SetMessage(m string) *Ping

type PubSubChannels added in v0.5.0

type PubSubChannels struct {
	Pattern string
}

func NewPubSubChannels added in v0.5.0

func NewPubSubChannels() *PubSubChannels

func ParsePubSubChannelsCommand added in v0.5.0

func ParsePubSubChannelsCommand(cmd redcon.Command) (*PubSubChannels, error)

func (*PubSubChannels) Command added in v0.5.0

func (ps *PubSubChannels) Command(ctx context.Context) *redis.SliceCmd

func (*PubSubChannels) SetPattern added in v0.5.0

func (ps *PubSubChannels) SetPattern(pattern string) *PubSubChannels

type PubSubCommands added in v0.5.0

type PubSubCommands struct {
	Publish         string
	PublishInternal string
	Subscribe       string
	PSubscribe      string
	PubSubChannels  string
	PubSubNumpat    string
	PubSubNumsub    string
}

type PubSubNumpat added in v0.5.0

type PubSubNumpat struct{}

func NewPubSubNumpat added in v0.5.0

func NewPubSubNumpat() *PubSubNumpat

func ParsePubSubNumpatCommand added in v0.5.0

func ParsePubSubNumpatCommand(cmd redcon.Command) (*PubSubNumpat, error)

func (*PubSubNumpat) Command added in v0.5.0

func (ps *PubSubNumpat) Command(ctx context.Context) *redis.IntCmd

type PubSubNumsub added in v0.5.0

type PubSubNumsub struct {
	Channels []string
}

func NewPubSubNumsub added in v0.5.0

func NewPubSubNumsub(channels ...string) *PubSubNumsub

func ParsePubSubNumsubCommand added in v0.5.0

func ParsePubSubNumsubCommand(cmd redcon.Command) (*PubSubNumsub, error)

func (*PubSubNumsub) Command added in v0.5.0

func (ps *PubSubNumsub) Command(ctx context.Context) *redis.SliceCmd

type Publish added in v0.5.0

type Publish struct {
	Channel string
	Message string
}

func NewPublish added in v0.5.0

func NewPublish(channel, message string) *Publish

func ParsePublishCommand added in v0.5.0

func ParsePublishCommand(cmd redcon.Command) (*Publish, error)

func (*Publish) Command added in v0.5.0

func (p *Publish) Command(ctx context.Context) *redis.IntCmd

type PublishInternal added in v0.5.0

type PublishInternal struct {
	Channel string
	Message string
}

func NewPublishInternal added in v0.5.0

func NewPublishInternal(channel, message string) *PublishInternal

func ParsePublishInternalCommand added in v0.5.0

func ParsePublishInternalCommand(cmd redcon.Command) (*PublishInternal, error)

func (*PublishInternal) Command added in v0.5.0

func (p *PublishInternal) Command(ctx context.Context) *redis.IntCmd

type Put added in v0.5.0

type Put struct {
	DMap  string
	Key   string
	Value []byte
	EX    float64
	PX    int64
	EXAT  float64
	PXAT  int64
	NX    bool
	XX    bool
}

func NewPut added in v0.5.0

func NewPut(dmap, key string, value []byte) *Put

func ParsePutCommand added in v0.5.0

func ParsePutCommand(cmd redcon.Command) (*Put, error)

func (*Put) Command added in v0.5.0

func (p *Put) Command(ctx context.Context) *redis.StatusCmd

func (*Put) SetEX added in v0.5.0

func (p *Put) SetEX(ex float64) *Put

func (*Put) SetEXAT added in v0.5.0

func (p *Put) SetEXAT(exat float64) *Put

func (*Put) SetNX added in v0.5.0

func (p *Put) SetNX() *Put

func (*Put) SetPX added in v0.5.0

func (p *Put) SetPX(px int64) *Put

func (*Put) SetPXAT added in v0.5.0

func (p *Put) SetPXAT(pxat int64) *Put

func (*Put) SetXX added in v0.5.0

func (p *Put) SetXX() *Put

type PutEntry added in v0.5.0

type PutEntry struct {
	DMap  string
	Key   string
	Value []byte
}

func NewPutEntry added in v0.5.0

func NewPutEntry(dmap, key string, value []byte) *PutEntry

func ParsePutEntryCommand added in v0.5.0

func ParsePutEntryCommand(cmd redcon.Command) (*PutEntry, error)

func (*PutEntry) Command added in v0.5.0

func (p *PutEntry) Command(ctx context.Context) *redis.StatusCmd

type Scan added in v0.5.0

type Scan struct {
	PartID  uint64
	DMap    string
	Cursor  uint64
	Count   int
	Match   string
	Replica bool
}

func NewScan added in v0.5.0

func NewScan(partID uint64, dmap string, cursor uint64) *Scan

func ParseScanCommand added in v0.5.0

func ParseScanCommand(cmd redcon.Command) (*Scan, error)

func (*Scan) Command added in v0.5.0

func (s *Scan) Command(ctx context.Context) *redis.ScanCmd

func (*Scan) SetCount added in v0.5.0

func (s *Scan) SetCount(count int) *Scan

func (*Scan) SetMatch added in v0.5.0

func (s *Scan) SetMatch(match string) *Scan

func (*Scan) SetReplica added in v0.5.0

func (s *Scan) SetReplica() *Scan

type Stats added in v0.5.0

type Stats struct {
	CollectRuntime bool
}

func NewStats added in v0.5.0

func NewStats() *Stats

func ParseStatsCommand added in v0.5.0

func ParseStatsCommand(cmd redcon.Command) (*Stats, error)

func (*Stats) Command added in v0.5.0

func (s *Stats) Command(ctx context.Context) *redis.StringCmd

func (*Stats) SetCollectRuntime added in v0.5.0

func (s *Stats) SetCollectRuntime() *Stats

type Subscribe added in v0.5.0

type Subscribe struct {
	Channels []string
}

func NewSubscribe added in v0.5.0

func NewSubscribe(channels ...string) *Subscribe

func ParseSubscribeCommand added in v0.5.0

func ParseSubscribeCommand(cmd redcon.Command) (*Subscribe, error)

func (*Subscribe) Command added in v0.5.0

func (s *Subscribe) Command(ctx context.Context) *redis.SliceCmd

type Unlock added in v0.5.0

type Unlock struct {
	DMap  string
	Key   string
	Token string
}

func NewUnlock added in v0.5.0

func NewUnlock(dmap, key, token string) *Unlock

func ParseUnlockCommand added in v0.5.0

func ParseUnlockCommand(cmd redcon.Command) (*Unlock, error)

func (*Unlock) Command added in v0.5.0

func (u *Unlock) Command(ctx context.Context) *redis.StatusCmd

type UpdateRouting added in v0.5.0

type UpdateRouting struct {
	Payload       []byte
	CoordinatorID uint64
}

func NewUpdateRouting added in v0.5.0

func NewUpdateRouting(payload []byte, coordinatorID uint64) *UpdateRouting

func ParseUpdateRoutingCommand added in v0.5.0

func ParseUpdateRoutingCommand(cmd redcon.Command) (*UpdateRouting, error)

func (*UpdateRouting) Command added in v0.5.0

func (u *UpdateRouting) Command(ctx context.Context) *redis.StringCmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL