Documentation ¶
Index ¶
- type RedisServer
- type SentinelPool
- func (sp SentinelPool) Cleanup(log logr.Logger) []error
- func (sp SentinelPool) IsMonitoringShards(ctx context.Context, shards []string) (bool, error)
- func (sp SentinelPool) Monitor(ctx context.Context, shards ShardedCluster) (map[string][]string, error)
- func (sp SentinelPool) MonitoredShards(ctx context.Context, quorum int, options ...ShardDiscoveryOption) (saasv1alpha1.MonitoredShards, error)
- type SentinelServer
- func (ss *SentinelServer) Cleanup(log logr.Logger) error
- func (ss *SentinelServer) DiscoverShard(ctx context.Context, shard string, maxInfoCacheAge time.Duration, ...) (map[string]saasv1alpha1.RedisServerDetails, error)
- func (ss *SentinelServer) IsMonitoringShards(ctx context.Context, shards []string) (bool, error)
- func (ss *SentinelServer) Monitor(ctx context.Context, shards ShardedCluster) ([]string, error)
- func (ss *SentinelServer) MonitoredShards(ctx context.Context, options ...ShardDiscoveryOption) (saasv1alpha1.MonitoredShards, error)
- func (ss *SentinelServer) OpenDirectRedisConnection(ctx context.Context, ip string, port int) (*RedisServer, error)
- type Shard
- type ShardDiscoveryOption
- type ShardDiscoveryOptions
- type ShardedCluster
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisServer ¶
RedisServer represent a redis server and its characteristics
func NewRedisServerFromConnectionString ¶
func NewRedisServerFromConnectionString(name, connectionString string) (*RedisServer, error)
func (*RedisServer) Cleanup ¶ added in v0.14.0
func (srv *RedisServer) Cleanup(log logr.Logger) error
Cleanup closes all Redis clients opened during the RedisServer object creation
func (*RedisServer) Discover ¶
func (srv *RedisServer) Discover(ctx context.Context) error
Discover returns the Role for a given redis Server
func (*RedisServer) IP ¶
func (rs *RedisServer) IP() (string, error)
type SentinelPool ¶
type SentinelPool []SentinelServer
SentinelPool represents a pool of SentinelServers that monitor the same group of redis shards
func NewSentinelPool ¶
func NewSentinelPool(ctx context.Context, cl client.Client, key types.NamespacedName, replicas int) (SentinelPool, error)
NewSentinelPool creates a new SentinelPool object given a key and a number of replicas by calling the k8s API to discover sentinel Pods. The kye es the Name/Namespace of the StatefulSet that owns the sentinel Pods.
func (SentinelPool) Cleanup ¶ added in v0.14.0
func (sp SentinelPool) Cleanup(log logr.Logger) []error
Cleanup closes all Redis clients opened during the SentinelPool object creation
func (SentinelPool) IsMonitoringShards ¶
IsMonitoringShards checks whether or all the shards in the passed list are being monitored by all sentinel servers in the SentinelPool
func (SentinelPool) Monitor ¶
func (sp SentinelPool) Monitor(ctx context.Context, shards ShardedCluster) (map[string][]string, error)
Monitor ensures that all the shards in the ShardedCluster object are monitored by all sentinel servers in the SentinelPool
func (SentinelPool) MonitoredShards ¶ added in v0.13.0
func (sp SentinelPool) MonitoredShards(ctx context.Context, quorum int, options ...ShardDiscoveryOption) (saasv1alpha1.MonitoredShards, error)
MonitoredShards returns the list of monitored shards of this SentinelServer
type SentinelServer ¶
type SentinelServer struct { Name string IP string Port string CRUD *crud.CRUD MonitoredRedisServers map[string]*RedisServer }
SentinelServer represents a sentinel Pod
func NewSentinelServerFromConnectionString ¶
func NewSentinelServerFromConnectionString(name, connectionString string) (*SentinelServer, error)
func (*SentinelServer) Cleanup ¶ added in v0.14.0
func (ss *SentinelServer) Cleanup(log logr.Logger) error
Cleanup closes all Redis clients opened during the SentinelServer object creation
func (*SentinelServer) DiscoverShard ¶ added in v0.16.1
func (ss *SentinelServer) DiscoverShard(ctx context.Context, shard string, maxInfoCacheAge time.Duration, opts ShardDiscoveryOptions) (map[string]saasv1alpha1.RedisServerDetails, error)
func (*SentinelServer) IsMonitoringShards ¶
IsMonitoringShards checks whether or all the shards in the passed list are being monitored by the SentinelServer
func (*SentinelServer) Monitor ¶
func (ss *SentinelServer) Monitor(ctx context.Context, shards ShardedCluster) ([]string, error)
Monitor ensures that all the shards in the ShardedCluster object are monitored by the SentinelServer
func (*SentinelServer) MonitoredShards ¶ added in v0.13.0
func (ss *SentinelServer) MonitoredShards(ctx context.Context, options ...ShardDiscoveryOption) (saasv1alpha1.MonitoredShards, error)
MonitoredShards returns the list of monitored shards of this SentinelServer
func (*SentinelServer) OpenDirectRedisConnection ¶ added in v0.16.1
func (ss *SentinelServer) OpenDirectRedisConnection(ctx context.Context, ip string, port int) (*RedisServer, error)
type Shard ¶
type Shard struct { Name string Servers []RedisServer }
Shard is a list of the redis Server objects that compose a redis shard
func (*Shard) Cleanup ¶ added in v0.14.0
Cleanup closes all Redis clients opened during the Shard object creation
func (*Shard) Discover ¶
Discover retrieves the role and read-only flag for all the servers in the shard
func (*Shard) GetMasterAddr ¶
GetMasterAddr returns the URL of the master server in a shard or error if zero or more than one master is found
type ShardDiscoveryOption ¶ added in v0.16.1
type ShardDiscoveryOption int
const ( OnlyMasterDiscoveryOpt ShardDiscoveryOption = iota SlaveReadOnlyDiscoveryOpt SaveConfigDiscoveryOpt )
type ShardDiscoveryOptions ¶ added in v0.16.1
type ShardDiscoveryOptions []ShardDiscoveryOption
func (ShardDiscoveryOptions) Has ¶ added in v0.16.1
func (sdos ShardDiscoveryOptions) Has(sdo ShardDiscoveryOption) bool
type ShardedCluster ¶
type ShardedCluster []Shard
ShardedCluster represents a sharded redis cluster, composed by several Shards
func NewShardedCluster ¶
func NewShardedCluster(ctx context.Context, serverList map[string][]string, log logr.Logger) (ShardedCluster, error)
NewShardedCluster returns a new ShardedCluster given the shard structure passed as a map[string][]string
func (ShardedCluster) Cleanup ¶ added in v0.14.0
func (sc ShardedCluster) Cleanup(log logr.Logger) []error
Cleanup closes all Redis clients opened during the ShardedCluster object creation
func (ShardedCluster) GetShardByName ¶
func (sc ShardedCluster) GetShardByName(name string) *Shard
func (ShardedCluster) GetShardNames ¶
func (sc ShardedCluster) GetShardNames() []string