util

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildClusterKey

func BuildClusterKey(ns, cluster string) string

func CloseRedisClients

func CloseRedisClients()

func ClusterNodesCmd

func ClusterNodesCmd(ctx context.Context, node *metadata.NodeInfo) (string, error)

func DetectClusterNode added in v0.2.0

func DetectClusterNode(ctx context.Context, node *metadata.NodeInfo) error

func GenerateNodeID

func GenerateNodeID() string

func GetRedisClient

func GetRedisClient(ctx context.Context, node *metadata.NodeInfo) (*redis.Client, error)

func IsDomain added in v0.2.0

func IsDomain(domain string) bool

func IsHostPort added in v0.2.0

func IsHostPort(s string) bool

func IsIP

func IsIP(ip string) bool

func IsPort

func IsPort(port string) bool

func IsUniqueSlice added in v0.2.0

func IsUniqueSlice(list interface{}) bool

func PingCmd

func PingCmd(ctx context.Context, node *metadata.NodeInfo) error

func RandString

func RandString(length int) string

func SyncClusterInfo2Node

func SyncClusterInfo2Node(ctx context.Context, node *metadata.NodeInfo, clusterStr string, ver int64) error

Types

type ClientInfo

type ClientInfo struct {
	MaxClients       string
	ConnectedClients string
	MonitorClients   string
}

type ClusterInfo

type ClusterInfo struct {
	ClusterState         bool
	ClusterSlotsAssigned int
	ClusterSlotsOK       int
	ClusterSlotsPFail    int
	ClusterSlotsFail     int
	ClusterKnownNodes    int
	ClusterSize          int
	ClusterCurrentEpoch  int64
	ClusterMyEpoch       int64
	MigratingSlot        int
	ImportingSlot        int
	DestinationNode      string
	MigratingState       string
	ImportingState       string
}

func ClusterInfoCmd

func ClusterInfoCmd(ctx context.Context, node *metadata.NodeInfo) (*ClusterInfo, error)

type KeySpaceInfo

type KeySpaceInfo struct {
	Sequence        string
	UsedDbSize      string
	MaxDbSize       string
	UsedPercent     string
	DiskCapacity    string
	UsedDiskSize    string
	UsedDiskPercent string
}

type MasterReplicationInfo

type MasterReplicationInfo struct {
	Role             string
	ConnectedSlaves  string
	MasterReplOffset string
}

type MemoryInfo

type MemoryInfo struct {
	UsedMemoryRss      string
	UsedMemoryHuman    string
	UsedMemoryLua      string
	UsedMemoryLuaHuman string
}

type NodeInfo

type NodeInfo struct {
	Server            ServerInfo
	Client            ClientInfo
	Mem               MemoryInfo
	States            StatesInfo
	SlaveReplication  SlaveReplicationInfo
	MasterReplication MasterReplicationInfo
	KeySpace          KeySpaceInfo
}

func NodeInfoCmd

func NodeInfoCmd(ctx context.Context, node *metadata.NodeInfo) (*NodeInfo, error)

type ServerInfo

type ServerInfo struct {
	Version    string
	GitSha1    string
	OS         string
	GccVersion string
	ArchBits   string
	ProcessId  string
	TcpPort    string
	UpTime     string
}

type SlaveReplicationInfo

type SlaveReplicationInfo struct {
	Role                         string
	MasterHost                   string
	MasterPort                   string
	MasterLinkStatus             string
	MasterSyncUnrecoverableError string
	MasterSyncInProgress         string
	MasterLastIoSecondsAgo       string
	SlaveReplOffset              string
	SlavePriority                string
}

type StatesInfo

type StatesInfo struct {
	TotalConnectionsReceived string
	TotalCommandsProcessed   string
	InstantaneousOps         string
	TotalNetInputBytes       string
	TotalNetOutputBytes      string
	InstantaneousInputKbps   string
	InstantaneousOutputKbps  string
	SyncFull                 string
	SyncPartialOk            string
	SyncPartialErr           string
	PubsubChannels           string
	PubsubPatterns           string
}

Jump to

Keyboard shortcuts

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