redis

package
v0.0.0-...-0227cab Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MasterRole = "master"
	SlaveRole  = "slave"
)

Variables

View Source
var (
	ErrNil           = redis.ErrNil
	ErrPoolExhausted = redis.ErrPoolExhausted
)

alias

View Source
var (
	Bool       = redis.Bool
	ByteSlices = redis.ByteSlices
	Bytes      = redis.Bytes
	Float64    = redis.Float64
	Float64Map = redis.Float64Map
	Float64s   = redis.Float64s
	Int        = redis.Int
	IntMap     = redis.IntMap
	Ints       = redis.Ints
	Int64      = redis.Int64
	Int64Map   = redis.Int64Map
	Int64s     = redis.Int64s
	Uint64     = redis.Uint64
	Uint64Map  = redis.Uint64Map
	Uint64s    = redis.Uint64s
	Values     = redis.Values
	Positions  = redis.Positions
	Scan       = redis.Scan
	ScanSlice  = redis.ScanSlice
	ScanStruct = redis.ScanStruct
	String     = redis.String
	Strings    = redis.Strings
)

Functions

This section is empty.

Types

type AuthInfo

type AuthInfo struct {
	Username string
	Password string
	TLSConf  *tls.Config
}

type Client

type Client interface {
	Nodes(ctx context.Context) (Nodes, error)
	Do(ctx context.Context, cmd string, args ...interface{}) (interface{}, error)
	Close() error
	Clone(ctx context.Context, addr string) Client
	CheckProxyInfo(ctx context.Context) error
}

func NewClient

func NewClient(addr string, authInfo AuthInfo) Client

NewClient

type Node

type Node struct {
	ID          string
	Addr        string
	Flags       string
	Role        string
	MasterID    string
	PingSend    int64
	PingRecv    int64
	ConfigEpoch int64
	LinkState   string
	// contains filtered or unexported fields
}

func (*Node) IsConnected

func (n *Node) IsConnected() bool

func (*Node) IsFailed

func (n *Node) IsFailed() bool

func (*Node) IsJoined

func (n *Node) IsJoined() bool

func (*Node) IsSelf

func (n *Node) IsSelf() bool

func (*Node) Raw

func (n *Node) Raw() string

func (*Node) Slots

func (n *Node) Slots() *slot.Slots

type Nodes

type Nodes []*Node

func ParseNodes

func ParseNodes(data string) (nodes Nodes)

parseNodes

format:

<id> <ip:port@cport> <flags> <master> <ping-sent> <pong-recv> <config-epoch> <link-state> <slot> <slot> ... <slot>

func (Nodes) Get

func (ns Nodes) Get(id string) *Node

func (Nodes) Marshal

func (ns Nodes) Marshal() ([]byte, error)

func (Nodes) Masters

func (ns Nodes) Masters() (ret []*Node)

func (Nodes) Replicas

func (ns Nodes) Replicas(id string) (ret []*Node)

func (Nodes) Self

func (ns Nodes) Self() *Node

type ProxyInfo

type ProxyInfo struct {
	UnknownRole int
	FailCount   int
}

func ParseProxyInfo

func ParseProxyInfo(data string) ProxyInfo

Jump to

Keyboard shortcuts

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