tool

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BeanqLogGroup it's for beanq-logic-log,multiple consumers can consume those data
	BeanqLogGroup = "beanq-log-group"
)

Variables

This section is empty.

Functions

func GetChannelAndTopicFromStreamKey

func GetChannelAndTopicFromStreamKey(streamKey string) (channel, topic string)

GetChannelAndTopicFromStreamKey get channel and topic

func HashKey

func HashKey(id []byte, flake uint64) uint64

func JitterBackoff

func JitterBackoff(min, max time.Duration, attempt int) time.Duration

func JsonDecode

func JsonDecode[T map[string]any | map[string]string](data string, m *T) error

func MakeDynamicKey

func MakeDynamicKey(prefix, channel string) string

MakeDynamicKey create key for dynamic

func MakeLogicKey

func MakeLogicKey(prefix string) string

func MakeStatusKey

func MakeStatusKey(prefix, channel, topic, id string) string

MakeStatusKey create key for type string

func MakeStreamKey

func MakeStreamKey(subType btype.SubscribeType, prefix, channel, topic string) string

MakeStreamKey create key for type stream

func MakeZSetKey

func MakeZSetKey(prefix, channel, topic string) string

MakeZSetKey create redis key for type sorted set

func RetryInfo

func RetryInfo(ctx context.Context, f func() error, retry int) (i int, err error)

RetryInfo retry=0 means no retries, but it will be executed at least once.

Types

type BaseClient

type BaseClient struct {
	// contains filtered or unexported fields
}

func (*BaseClient) ClientList

func (t *BaseClient) ClientList(ctx context.Context) ([]map[string]any, error)

func (*BaseClient) Clients

func (t *BaseClient) Clients(ctx context.Context) (map[string]any, error)

func (*BaseClient) CommandStats

func (t *BaseClient) CommandStats(ctx context.Context) ([]map[string]any, error)

func (*BaseClient) DbSize

func (t *BaseClient) DbSize(ctx context.Context) (int64, error)

func (*BaseClient) Info

func (t *BaseClient) Info(ctx context.Context) (map[string]string, error)

func (*BaseClient) KeySpace

func (t *BaseClient) KeySpace(ctx context.Context) ([]map[string]any, error)

func (*BaseClient) Keys

func (t *BaseClient) Keys(ctx context.Context, key string) ([]string, error)

func (*BaseClient) Memory

func (t *BaseClient) Memory(ctx context.Context) (map[string]any, error)

func (*BaseClient) Monitor

func (t *BaseClient) Monitor(ctx context.Context) (string, error)

func (*BaseClient) NodeId

func (t *BaseClient) NodeId(ctx context.Context) string

func (*BaseClient) Nodes

func (t *BaseClient) Nodes(ctx context.Context) []Node

func (*BaseClient) Object

func (t *BaseClient) Object(ctx context.Context, queueName string) (objstr *ObjectStruct, err error)

func (*BaseClient) Persistence

func (t *BaseClient) Persistence(ctx context.Context) (map[string]any, error)

func (*BaseClient) Server

func (t *BaseClient) Server(ctx context.Context) (map[string]any, error)

func (*BaseClient) Stats

func (t *BaseClient) Stats(ctx context.Context) (map[string]any, error)

func (*BaseClient) ZCard

func (t *BaseClient) ZCard(ctx context.Context, key string) (int64, error)

type Client

type Client struct {
	IClient
	// contains filtered or unexported fields
}

func (*Client) NodeId

func (t *Client) NodeId(ctx context.Context) string

func (*Client) Nodes

func (t *Client) Nodes(ctx context.Context) []Node

type ClusterClient

type ClusterClient struct {
	IClient
	// contains filtered or unexported fields
}

func (*ClusterClient) NodeId

func (t *ClusterClient) NodeId(ctx context.Context) string

func (*ClusterClient) Nodes

func (t *ClusterClient) Nodes(ctx context.Context) []Node

type Commands

type Commands []map[string]any

Commands sort in reverse order based on the `usec_per_call` field

func (Commands) Len

func (t Commands) Len() int

func (Commands) Less

func (t Commands) Less(i, j int) bool

func (Commands) Swap

func (t Commands) Swap(i, j int)

type IClient

type IClient interface {
	INode
	IInfo
	ICommand
}

func ClientFac

func ClientFac(client redis.UniversalClient, prefix, nodeId string) IClient

type ICommand

type ICommand interface {
	Keys(ctx context.Context, key string) ([]string, error)
	Object(ctx context.Context, queueName string) (*ObjectStruct, error)
	ClientList(ctx context.Context) ([]map[string]any, error)
	ZCard(ctx context.Context, key string) (int64, error)
}

ICommand redis commands

type IInfo

type IInfo interface {
	KeySpace(ctx context.Context) ([]map[string]any, error)
	Memory(ctx context.Context) (map[string]any, error)
	CommandStats(ctx context.Context) ([]map[string]any, error)
	Persistence(ctx context.Context) (map[string]any, error)
	Server(ctx context.Context) (map[string]any, error)
	Clients(ctx context.Context) (map[string]any, error)
	Stats(ctx context.Context) (map[string]any, error)
	Monitor(ctx context.Context) (string, error)
	DbSize(ctx context.Context) (int64, error)

	Info(ctx context.Context) (map[string]string, error)
}

IInfo redis info command

type INode

type INode interface {
	Nodes(ctx context.Context) []Node
	NodeId(ctx context.Context) string
}

INode redis cluster node

type Key

type Key struct {
	NodeId string
}

type Node

type Node struct {
	NodeId       string
	Ip           string
	Master       string
	ParentNodeId string
	Ping         string
	Pong         string
	Flag         string
	Slot         string
	LinkState    string
}

type ObjectStruct

type ObjectStruct struct {
	ValueAt          string
	Encoding         string
	RefCount         int
	SerizlizedLength int
	Lru              int
	LruSecondsIdle   int
}

Jump to

Keyboard shortcuts

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