redisnode

package
v0.0.0-...-a9bd9a2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RedisStartWaitDefault default stop duration (sec)
	RedisStartWaitDefault = 10 * time.Second
	// RedisStartDelayDefault default start delay duration (sec)
	RedisStartDelayDefault = 10 * time.Second
	// HTTPServerAddrDefault default http server address
	HTTPServerAddrDefault = "0.0.0.0:8080"
)

Variables

This section is empty.

Functions

func WrapRedis

func WrapRedis(c *Config, ch chan error)

WrapRedis start a redis server in a sub process

Types

type Config

type Config struct {
	KubeConfigFile  string
	KubeAPIServer   string
	Redis           config.Redis
	Cluster         config.Cluster
	RedisStartWait  time.Duration
	RedisStartDelay time.Duration
	HTTPServerAddr  string
}

Config contains configuration for redis-operator

func NewRedisNodeConfig

func NewRedisNodeConfig() *Config

NewRedisNodeConfig builds and returns a redis-operator Config

func (*Config) AddFlags

func (c *Config) AddFlags(fs *pflag.FlagSet)

AddFlags add cobra flags to populate Config

type Node

type Node struct {
	Addr       string
	RedisAdmin redis.AdminInterface
	// contains filtered or unexported fields
}

Node struct that represent a RedisNodeWrapper

func NewNode

func NewNode(c *Config, admin redis.AdminInterface) *Node

NewNode return an instance of a Node

func (*Node) AttachNodeToCluster

func (n *Node) AttachNodeToCluster(ctx context.Context, addr string) error

AttachNodeToCluster used to attach the current node to a redis cluster

func (*Node) Clear

func (n *Node) Clear()

Clear clear possible initialized resources

func (*Node) ClearDataFolder

func (n *Node) ClearDataFolder() error

ClearDataFolder completely erase all files in the /data folder

func (*Node) ForgetNode

func (n *Node) ForgetNode(ctx context.Context) error

ForgetNode used to remove a node for a cluster

func (*Node) InitRedisCluster

func (n *Node) InitRedisCluster(ctx context.Context, addr string) error

InitRedisCluster used to init a redis cluster with the current node

func (*Node) StartFailover

func (n *Node) StartFailover(ctx context.Context) error

StartFailover start Failover if needed

func (*Node) UpdateNodeConfigFile

func (n *Node) UpdateNodeConfigFile() error

UpdateNodeConfigFile update the redis config file with node information: ip, port

type RedisNode

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

RedisNode contains all info to run the redis-node.

func NewRedisNode

func NewRedisNode(cfg *Config) *RedisNode

NewRedisNode builds and returns new RedisNode instance

func (*RedisNode) Run

func (r *RedisNode) Run(stop <-chan struct{}) error

Run executes the RedisNode

Jump to

Keyboard shortcuts

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