client

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeClient

type FakeClient struct {
	Responses []FakeResponse
}

func (*FakeClient) Close added in v0.14.0

func (fc *FakeClient) Close() error

func (*FakeClient) RedisConfigGet

func (fc *FakeClient) RedisConfigGet(ctx context.Context, parameter string) ([]interface{}, error)

func (*FakeClient) RedisConfigSet added in v0.16.1

func (fc *FakeClient) RedisConfigSet(ctx context.Context, parameter, value string) error

func (*FakeClient) RedisDebugSleep added in v0.16.1

func (fc *FakeClient) RedisDebugSleep(ctx context.Context, duration time.Duration) error

WARNING: this command blocks for the duration

func (*FakeClient) RedisRole

func (fc *FakeClient) RedisRole(ctx context.Context) (interface{}, error)

func (*FakeClient) RedisSlaveOf

func (fc *FakeClient) RedisSlaveOf(ctx context.Context, host, port string) error

func (*FakeClient) SentinelInfoCache added in v0.13.0

func (fc *FakeClient) SentinelInfoCache(ctx context.Context) (interface{}, error)

func (*FakeClient) SentinelMaster

func (fc *FakeClient) SentinelMaster(ctx context.Context, shard string) (*SentinelMasterCmdResult, error)

func (*FakeClient) SentinelMasters

func (fc *FakeClient) SentinelMasters(ctx context.Context) ([]interface{}, error)

func (*FakeClient) SentinelMonitor

func (fc *FakeClient) SentinelMonitor(ctx context.Context, name, host string, port string, quorum int) error

func (*FakeClient) SentinelPSubscribe

func (fc *FakeClient) SentinelPSubscribe(ctx context.Context, events ...string) (<-chan *redis.Message, func() error)

func (*FakeClient) SentinelSet

func (fc *FakeClient) SentinelSet(ctx context.Context, shard, parameter, value string) error

func (*FakeClient) SentinelSlaves

func (fc *FakeClient) SentinelSlaves(ctx context.Context, shard string) ([]interface{}, error)

type FakeResponse

type FakeResponse struct {
	InjectResponse func() interface{}
	InjectError    func() error
}

type GoRedisClient

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

func NewFromConnectionString

func NewFromConnectionString(connectionString string) (*GoRedisClient, error)

func NewFromOptions

func NewFromOptions(opt *redis.Options) *GoRedisClient

func (*GoRedisClient) Close added in v0.14.0

func (c *GoRedisClient) Close() error

func (*GoRedisClient) CloseRedis added in v0.14.0

func (c *GoRedisClient) CloseRedis() error

func (*GoRedisClient) CloseSentinel added in v0.14.0

func (c *GoRedisClient) CloseSentinel() error

func (*GoRedisClient) RedisConfigGet

func (c *GoRedisClient) RedisConfigGet(ctx context.Context, parameter string) ([]interface{}, error)

func (*GoRedisClient) RedisConfigSet added in v0.16.1

func (c *GoRedisClient) RedisConfigSet(ctx context.Context, parameter, value string) error

func (*GoRedisClient) RedisDebugSleep added in v0.16.1

func (c *GoRedisClient) RedisDebugSleep(ctx context.Context, duration time.Duration) error

WARNING: this command blocks for the duration

func (*GoRedisClient) RedisRole

func (c *GoRedisClient) RedisRole(ctx context.Context) (interface{}, error)

func (*GoRedisClient) RedisSlaveOf

func (c *GoRedisClient) RedisSlaveOf(ctx context.Context, host, port string) error

func (*GoRedisClient) SentinelInfoCache added in v0.13.0

func (c *GoRedisClient) SentinelInfoCache(ctx context.Context) (interface{}, error)

func (*GoRedisClient) SentinelMaster

func (c *GoRedisClient) SentinelMaster(ctx context.Context, shard string) (*SentinelMasterCmdResult, error)

func (*GoRedisClient) SentinelMasters

func (c *GoRedisClient) SentinelMasters(ctx context.Context) ([]interface{}, error)

func (*GoRedisClient) SentinelMonitor

func (c *GoRedisClient) SentinelMonitor(ctx context.Context, name, host string, port string, quorum int) error

func (*GoRedisClient) SentinelPSubscribe

func (c *GoRedisClient) SentinelPSubscribe(ctx context.Context, events ...string) (<-chan *redis.Message, func() error)

func (*GoRedisClient) SentinelSet

func (c *GoRedisClient) SentinelSet(ctx context.Context, shard, parameter, value string) error

func (*GoRedisClient) SentinelSlaves

func (c *GoRedisClient) SentinelSlaves(ctx context.Context, shard string) ([]interface{}, error)

type RedisServerInfoCache added in v0.13.0

type RedisServerInfoCache struct {
	CacheAge time.Duration
	Info     map[string]string
}

type Role

type Role string

Role represents the role of a redis server within a shard

const (
	// Master is the master role in a shard. Under normal circumstances, only
	// a server in the shard can be master at a given time
	Master Role = "master"
	// Slave are servers within the shard that replicate data from the master
	// for data high availabilty purposes
	Slave Role = "slave"
	// Unknown represents a state in which the role of the server is still unknown
	Unknown Role = "unknown"
)

type SentinelInfoCache added in v0.13.0

type SentinelInfoCache map[string]map[string]RedisServerInfoCache

func (SentinelInfoCache) GetValue added in v0.13.0

func (sic SentinelInfoCache) GetValue(shard, runID, key string, maxCacheAge time.Duration) (string, error)

type SentinelMasterCmdResult

type SentinelMasterCmdResult struct {
	Name                  string `redis:"name"`
	IP                    string `redis:"ip"`
	Port                  int    `redis:"port"`
	RunID                 string `redis:"runid"`
	Flags                 string `redis:"flags"`
	LinkPendingCommands   int    `redis:"link-pending-commands"`
	LinkRefcount          int    `redis:"link-refcount"`
	LastPingSent          int    `redis:"last-ping-sent"`
	LastOkPingReply       int    `redis:"last-ok-ping-reply"`
	LastPingReply         int    `redis:"last-ping-reply"`
	DownAfterMilliseconds int    `redis:"down-after-milliseconds"`
	InfoRefresh           int    `redis:"info-refresh"`
	RoleReported          string `redis:"role-reported"`
	RoleReportedTime      int    `redis:"role-reported-time"`
	ConfigEpoch           int    `redis:"config-epoch"`
	NumSlaves             int    `redis:"num-slaves"`
	NumOtherSentinels     int    `redis:"num-other-sentinels"`
	Quorum                int    `redis:"quorum"`
	FailoverTimeout       int    `redis:"failover-timeout"`
	ParallelSyncs         int    `redis:"parallel-syncs"`
}

SentinelMasterCmdResult represents the output of the "sentinel master" command

type SentinelSlaveCmdResult

type SentinelSlaveCmdResult struct {
	Name                  string `redis:"name"`
	IP                    string `redis:"ip"`
	Port                  int    `redis:"port"`
	RunID                 string `redis:"runid"`
	Flags                 string `redis:"flags"`
	LinkPendingCommands   int    `redis:"link-pending-commands"`
	LinkRefcount          int    `redis:"link-refcount"`
	LastPingSent          int    `redis:"last-ping-sent"`
	LastOkPingReply       int    `redis:"last-ok-ping-reply"`
	LastPingReply         int    `redis:"last-ping-reply"`
	DownAfterMilliseconds int    `redis:"down-after-milliseconds"`
	InfoRefresh           int    `redis:"info-refresh"`
	RoleReported          string `redis:"role-reported"`
	RoleReportedTime      int    `redis:"role-reported-time"`
	MasterLinkDownTime    int    `redis:"master-link-down-time"`
	MasterLinkStatus      string `redis:"master-link-status"`
	MasterHost            string `redis:"master-host"`
	MasterPort            int    `redis:"master-port"`
	SlavePriority         int    `redis:"slave-priority"`
	SlaveReplOffset       int    `redis:"slave-repl-offset"`
}

SentinelSlaveCmdResult represents the output of the "sentinel slave" command

Jump to

Keyboard shortcuts

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