Documentation ¶
Index ¶
- type MasterInfo
- type Option
- type Options
- type ReplicaInfo
- type Sentinel
- func (s *Sentinel) Addr() string
- func (s *Sentinel) Close()
- func (s *Sentinel) CurrentConnectionCount() int
- func (s *Sentinel) Host() string
- func (s *Sentinel) Master() *miniredis.Miniredis
- func (s *Sentinel) MasterInfo(opts ...Option) MasterInfo
- func (s *Sentinel) Port() string
- func (s *Sentinel) Replica() *miniredis.Miniredis
- func (s *Sentinel) ReplicaInfo(opts ...Option) ReplicaInfo
- func (s *Sentinel) RequireAuth(pw string)
- func (s *Sentinel) Restart() error
- func (s *Sentinel) SetReplica(replica *miniredis.Miniredis)
- func (s *Sentinel) Start() error
- func (s *Sentinel) StartAddr(addr string) error
- func (s *Sentinel) TotalConnectionCount() int
- func (s *Sentinel) WithMaster(m *miniredis.Miniredis, opts ...Option)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MasterInfo ¶
type MasterInfo struct { Name string `mapstructure:"name"` IP string `mapstructure:"ip"` Port string `mapstructure:"port"` RunID string `mapstructure:"runid"` Flags string `mapstructure:"flags"` LinkPendingCommands string `mapstructure:"link-pending-commands"` LinkRefCount string `mapstructure:"link-refcount"` LastPingSent string `mapstructure:"last-ping-sent"` LastOkPingReply string `mapstructure:"last-ok-ping-reply"` LastPingReply string `mapstructure:"last-ping-reply"` DownAfterMilliseconds string `mapstructure:"down-after-milliseconds"` InfoRefresh string `mapstructure:"info-refresh"` RoleReported string `mapstructure:"role-reported"` RoleReportedTime string `mapstructure:"role-reported-time"` ConfigEpoch string `mapstructure:"config-epoch"` NumSlaves string `mapstructure:"num-slaves"` NumOtherSentinels string `mapstructure:"num-other-sentinels"` Quorum string `mapstructure:"quorum"` FailoverTimeout string `mapstructure:"failover-timeout"` ParallelSync string `mapstructure:"parallel-syncs"` }
MasterInfo - define a redis master
func NewMasterInfoFromStrings ¶
func NewMasterInfoFromStrings(s []string) (MasterInfo, error)
NewMasterInfoFromStrings creates a new MasterInfo
type Option ¶
type Option func(*Options)
Option - how Options are passed as arguments
func WithMaster ¶
func WithMaster(m *miniredis.Miniredis) Option
WithMaster - set the primary miniredis for the sentinel
func WithMasterName ¶
WithMasterName - set the name of the master
func WithReplica ¶
func WithReplica(replica *miniredis.Miniredis) Option
WithReplica - set the replicas for sentinel
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options = how options are represented
type ReplicaInfo ¶
type ReplicaInfo struct { Name string `mapstructure:"name"` IP string `mapstructure:"ip"` Port string `mapstructure:"port"` RunID string `mapstructure:"runid"` Flags string `mapstructure:"flags"` LinkPendingCommands string `mapstructure:"link-pending-commands"` LinkRefCount string `mapstructure:"link-refcount"` LastPingSent string `mapstructure:"last-ping-sent"` LastOkPingReply string `mapstructure:"last-ok-ping-reply"` LastPingReply string `mapstructure:"last-ping-reply"` DownAfterMilliseconds string `mapstructure:"down-after-milliseconds"` InfoRefresh string `mapstructure:"info-refresh"` RoleReported string `mapstructure:"role-reported"` RoleReportedTime string `mapstructure:"role-reported-time"` MasterLinkDownTime string `mapstructure:"master-link-down-time"` MasterLinkStatus string `mapstructure:"master-link-status"` MasterHost string `mapstructure:"master-host"` MasterPort string `mapstructure:"master-port"` SlavePriority string `mapstructure:"slave-priority"` SlaveReplOffset string `mapstructure:"slave-repl-offset"` }
ReplicaInfo - define a redis master
func NewReplicaInfoFromStrings ¶
func NewReplicaInfoFromStrings(s []string) (ReplicaInfo, error)
NewReplicaInfoFromStrings creates a new ReplicaInfo
type Sentinel ¶
Sentinel - a redis sentinel server implementation.
func NewSentinel ¶
NewSentinel makes a new, non-started, Miniredis object.
func (*Sentinel) Addr ¶
Addr returns '127.0.0.1:12345'. Can be given to a Dial(). See also Host() and Port(), which return the same things.
func (*Sentinel) CurrentConnectionCount ¶
CurrentConnectionCount returns the number of currently connected clients.
func (*Sentinel) MasterInfo ¶
func (s *Sentinel) MasterInfo(opts ...Option) MasterInfo
MasterInfo - get the master's info
func (*Sentinel) Replica ¶
func (s *Sentinel) Replica() *miniredis.Miniredis
Replica - get the current replica
func (*Sentinel) ReplicaInfo ¶
func (s *Sentinel) ReplicaInfo(opts ...Option) ReplicaInfo
ReplicaInfo - get the replica's info
func (*Sentinel) RequireAuth ¶
RequireAuth makes every connection need to AUTH first. Disable again by setting an empty string.
func (*Sentinel) Restart ¶
Restart restarts a Close()d server on the same port. Values will be preserved.
func (*Sentinel) SetReplica ¶
func (s *Sentinel) SetReplica(replica *miniredis.Miniredis)
SetReplica - replace all the existing replicas
func (*Sentinel) Start ¶
Start starts a server. It listens on a random port on localhost. See also Addr().
func (*Sentinel) StartAddr ¶
StartAddr runs sentinel with a given addr. Examples: "127.0.0.1:26379", ":6379", or "127.0.0.1:0"
func (*Sentinel) TotalConnectionCount ¶
TotalConnectionCount returns the number of client connections since server start.
func (*Sentinel) WithMaster ¶
WithMaster - set the master