server

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InfoStringToMap

func InfoStringToMap(in string) map[string]string

Types

type Server

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

Server is a host that talks the redis protocol Contains methods to use a subset of redis commands

func MustNewServer

func MustNewServer(connectionString string, alias *string) *Server

func NewFakeServerWithFakeClient

func NewFakeServerWithFakeClient(host, port string, responses ...client.FakeResponse) *Server

NewFakeServerWithFakeClient returns a fake server with a fake client that will return the provided responses when called. This is only intended for testing.

func NewServer

func NewServer(connectionString string, alias *string) (*Server, error)

NewServer returns a new client for this redis server from the given connection string. It can optionally be passed an alias to identify the server.

func NewServerFromParams

func NewServerFromParams(alias, host, port string, c client.TestableInterface) *Server

func (*Server) CloseClient

func (srv *Server) CloseClient() error

func (*Server) GetAlias

func (srv *Server) GetAlias() string

func (*Server) GetClient

func (srv *Server) GetClient() client.TestableInterface

func (*Server) GetHost

func (srv *Server) GetHost() string

func (*Server) GetPort

func (srv *Server) GetPort() string

func (*Server) ID

func (srv *Server) ID() string

ID returns the ID of the server, which takes the form "host:port"

func (*Server) RedisBGSave

func (srv *Server) RedisBGSave(ctx context.Context) error

func (*Server) RedisConfigGet

func (srv *Server) RedisConfigGet(ctx context.Context, parameter string) (string, error)

func (*Server) RedisConfigSet

func (srv *Server) RedisConfigSet(ctx context.Context, parameter, value string) error

func (*Server) RedisDebugSleep

func (srv *Server) RedisDebugSleep(ctx context.Context, duration time.Duration) error

func (*Server) RedisInfo

func (srv *Server) RedisInfo(ctx context.Context, section string) (map[string]string, error)

func (*Server) RedisLastSave

func (srv *Server) RedisLastSave(ctx context.Context) (int64, error)

func (*Server) RedisRole

func (srv *Server) RedisRole(ctx context.Context) (client.Role, string, error)

func (*Server) RedisSet

func (srv *Server) RedisSet(ctx context.Context, key string, value interface{}) error

func (*Server) RedisSlaveOf

func (srv *Server) RedisSlaveOf(ctx context.Context, host, port string) error

func (*Server) SentinelGetMasterAddrByName

func (srv *Server) SentinelGetMasterAddrByName(ctx context.Context, shard string) (string, int, error)

func (*Server) SentinelInfoCache

func (srv *Server) SentinelInfoCache(ctx context.Context) (client.SentinelInfoCache, error)

func (*Server) SentinelMaster

func (srv *Server) SentinelMaster(ctx context.Context, shard string) (*client.SentinelMasterCmdResult, error)

func (*Server) SentinelMasters

func (srv *Server) SentinelMasters(ctx context.Context) ([]client.SentinelMasterCmdResult, error)

func (*Server) SentinelMonitor

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

func (*Server) SentinelPSubscribe

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

func (*Server) SentinelPing

func (srv *Server) SentinelPing(ctx context.Context) error

func (*Server) SentinelSet

func (srv *Server) SentinelSet(ctx context.Context, shard, parameter, value string) error

func (*Server) SentinelSlaves

func (srv *Server) SentinelSlaves(ctx context.Context, shard string) ([]client.SentinelSlaveCmdResult, error)

func (*Server) SetAlias

func (srv *Server) SetAlias(alias string)

type ServerPool

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

ServerPool holds a thread safe list of Servers. It is intended for client reuse throughout the code.

func NewServerPool

func NewServerPool(servers ...*Server) *ServerPool

func (*ServerPool) GetServer

func (pool *ServerPool) GetServer(connectionString string, alias *string) (*Server, error)

Jump to

Keyboard shortcuts

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