client

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// NodeAddr is the address of the Redis node (e.g. 127.0.0.1:7070).
	NodeAddr string
	// Client is is a go-redis Client.
	Client *redis.Client
}

Client is a wrapper around an inner go-redis client.

func New

func New(conf config.RedisOpts) (*Client, error)

func (*Client) GetClusterInfo

func (h *Client) GetClusterInfo() (*clusterInfo, error)

func (*Client) GetPrimaryNodes

func (h *Client) GetPrimaryNodes() ([]redisClusterNode, error)

func (*Client) GetPrimaryWithLeastReplicas

func (h *Client) GetPrimaryWithLeastReplicas() (string, string, error)

func (*Client) GetReplicaNodes

func (h *Client) GetReplicaNodes() ([]redisClusterNode, error)

func (*Client) IsNew

func (h *Client) IsNew() (bool, error)

IsNew returns 'true' if the contents of 'CLUSTER INFO' match those expected of a node that has never been joined a cluster. 'cluster_state' will be 'fail' as a minumum of 3 nodes is required. 'cluster_known_nodes' will be '1' (self) since it's never been introduced to other nodes. 'cluster_slots_count' and cluster_size' will both be '0' since slots are only assigned as part of the inital clustering or during cluster rebalancing. If any of these fields holds a different value, 'false' is returned.

Jump to

Keyboard shortcuts

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