Documentation
¶
Index ¶
Constants ¶
View Source
const ( MasterRole = "master" SlaveRole = "slave" )
View Source
const ( ClusterStateOk string = "ok" ClusterStateFail string = "fail" )
Variables ¶
View Source
var ( ErrNil = redis.ErrNil Int = redis.Int Ints = redis.Ints IntMap = redis.IntMap Int64 = redis.Int64 Int64s = redis.Int64s Int64Map = redis.Int64Map Uint64 = redis.Uint64 Uint64s = redis.Uint64s Uint64Map = redis.Uint64Map Float64 = redis.Float64 Float64s = redis.Float64s Float64Map = redis.Float64Map String = redis.String Strings = redis.Strings StringMap = redis.StringMap Bytes = redis.Bytes ByteSlices = redis.ByteSlices Bool = redis.Bool Values = redis.Values Positions = redis.Positions )
Functions ¶
This section is empty.
Types ¶
type AuthInfo ¶
type AuthInfo = AuthConfig
type ClusterNode ¶
type ClusterNode struct {
Id string
Addr string
RawFlag string
BusPort string
AuxFields ClusterNodeAuxFields
Role string
MasterId string
PingSend int64
PongRecv int64
Epoch int64
LinkState string
// contains filtered or unexported fields
}
func ParseNodeFromClusterNode ¶
func ParseNodeFromClusterNode(line string) (*ClusterNode, error)
ParseNodeFromClusterNode format:
<id> <ip:port@cport> <flags> <master> <ping-sent> <pong-recv> <config-epoch> <link-state> <slot> <slot> ... <slot>
func (*ClusterNode) IsConnected ¶
func (n *ClusterNode) IsConnected() bool
func (*ClusterNode) IsFailed ¶
func (n *ClusterNode) IsFailed() bool
func (*ClusterNode) IsJoined ¶
func (n *ClusterNode) IsJoined() bool
func (*ClusterNode) IsSelf ¶
func (n *ClusterNode) IsSelf() bool
func (*ClusterNode) Raw ¶
func (n *ClusterNode) Raw() string
func (*ClusterNode) Slots ¶
func (n *ClusterNode) Slots() *slot.Slots
type ClusterNodeAuxFields ¶
type ClusterNodeAuxFields struct {
ShardID string `json:"shard-id"`
NodeName string `json:"nodename"`
TCPPort int64 `json:"tcp-port"`
TLSPort int64 `json:"tls-port"`
// contains filtered or unexported fields
}
func (*ClusterNodeAuxFields) Raw ¶
func (c *ClusterNodeAuxFields) Raw() string
type ClusterNodeInfo ¶
type ClusterNodeInfo struct {
ClusterState string `json:"cluster_state"`
ClusterSlotsAssigned int `json:"cluster_slots_assigned"`
ClusterSlotsOk int `json:"cluster_slots_ok"`
ClusterSlotsPfail int `json:"cluster_slots_pfail"`
ClusterSlotsFail int `json:"cluster_slots_fail"`
ClusterKnownNodes int `json:"cluster_known_nodes"`
ClusterSize int `json:"cluster_size"`
ClusterCurrentEpoch int `json:"cluster_current_epoch"`
ClusterMyEpoch int `json:"cluster_my_epoch"`
}
type ClusterNodes ¶
type ClusterNodes []*ClusterNode
func (ClusterNodes) Get ¶
func (ns ClusterNodes) Get(id string) *ClusterNode
func (ClusterNodes) Marshal ¶
func (ns ClusterNodes) Marshal() ([]byte, error)
func (ClusterNodes) Masters ¶
func (ns ClusterNodes) Masters() (ret []*ClusterNode)
func (ClusterNodes) Replicas ¶
func (ns ClusterNodes) Replicas(id string) (ret []*ClusterNode)
func (ClusterNodes) Self ¶
func (ns ClusterNodes) Self() *ClusterNode
type NodeInfo ¶
type NodeInfo struct {
Version string `json:"valkey_version"`
ServerMode string `json:"server_mode"`
RunId string `json:"run_id"`
UptimeInSeconds int64 `json:"uptime_in_seconds"`
AOFEnabled string `json:"aof_enabled"`
Role string `json:"role"`
ConnectedReplicas int64 `json:"connected_slaves"`
MasterHost string `json:"master_host"`
MasterPort string `json:"master_port"`
ClusterEnabled string `json:"cluster_enabled"`
MasterLinkStatus string `json:"master_link_status"`
MasterReplId string `json:"master_replid"`
MasterReplOffset int64 `json:"master_repl_offset"`
MasterReplId2 string `json:"master_replid2"`
SecondReplOffset int64 `json:"second_repl_offset"`
UsedMemory int64 `json:"used_memory"`
UsedMemoryDataset int64 `json:"used_memory_dataset"`
SentinelMasters int64 `json:"sentinel_masters"`
SentinelTiLt int64 `json:"sentinel_tilt"`
SentinelRunningScript int64 `json:"sentinel_running_scripts"`
Dbsize int64 `json:"dbsize"`
SentinelMaster0 SentinelMaster `json:"master0"`
}
NodeInfo
type PipelineResult ¶
type SentinelMaster ¶
type SentinelMonitorNode ¶
type SentinelMonitorNode struct {
Name string `json:"name"`
IP string `json:"ip"`
Port string `json:"port"`
RunId string `json:"run_id"`
Flags string `json:"flags"`
LinkPendingCommands int32 `json:"link_pending_commands"`
LinkRefcount int32 `json:"link_refcount"`
FailoverState string `json:"failover_state"`
LastPingSent int64 `json:"last_ping_sent"`
LastOkPingReply int64 `json:"last_ok_ping_reply"`
LastPingReply int64 `json:"last_ping_reply"`
SDownTime int64 `json:"s_down_time"`
ODownTime int64 `json:"o_down_time"`
DownAfterMilliseconds int64 `json:"down_after_milliseconds"`
InfoRefresh int64 `json:"info_refresh"`
RoleReported string `json:"role_reported"`
RoleReportedTime int64 `json:"role_reported_time"`
ConfigEpoch int64 `json:"config_epoch"`
NumSlaves int32 `json:"num_slaves"`
NumOtherSentinels int32 `json:"num_other_sentinels"`
Quorum int32 `json:"quorum"`
FailoverTimeout int64 `json:"failover_timeout"`
ParallelSyncs int32 `json:"parallel_syncs"`
// replica fields
MasterLinkDownTime int64 `json:"master_link_down_time"`
MasterLinkStatus string `json:"master_link_status"`
MasterHost string `json:"master_host"`
MasterPort string `json:"master_port"`
SlavePriority int32 `json:"slave_priority"`
SlaveReplOffset int64 `json:"slave_repl_offset"`
// sentinel node specific fields
LastHelloMessage string `json:"last_hello_message"`
VotedLeader string `json:"voted_leader"`
VotedLeaderEpoch int64 `json:"voted_leader_epoch"`
}
func ParseSentinelMonitorNode ¶
func ParseSentinelMonitorNode(val any) *SentinelMonitorNode
func (*SentinelMonitorNode) Address ¶
func (s *SentinelMonitorNode) Address() string
func (*SentinelMonitorNode) IsFailovering ¶
func (s *SentinelMonitorNode) IsFailovering() bool
func (*SentinelMonitorNode) IsMaster ¶
func (s *SentinelMonitorNode) IsMaster() bool
type ValkeyClient ¶
type ValkeyClient interface {
Do(ctx context.Context, cmd string, args ...any) (any, error)
DoWithTimeout(ctx context.Context, timeout time.Duration, cmd string, args ...any) (any, error)
Tx(ctx context.Context, cmds []string, args [][]any) (any, error)
Pipeline(ctx context.Context, args [][]any) ([]PipelineResult, error)
Close() error
Clone(ctx context.Context, addr string) ValkeyClient
Ping(ctx context.Context) error
Info(ctx context.Context, sections ...any) (*NodeInfo, error)
ClusterInfo(ctx context.Context) (*ClusterNodeInfo, error)
ConfigGet(ctx context.Context, cate string) (map[string]string, error)
ConfigSet(ctx context.Context, params map[string]string) error
Nodes(ctx context.Context) (ClusterNodes, error)
}
ValkeyClient
func NewValkeyClient ¶
func NewValkeyClient(addr string, authInfo AuthConfig) ValkeyClient
NewValkeyClient
Click to show internal directories.
Click to hide internal directories.