Documentation ¶
Index ¶
- Constants
- func BoolP(b bool) *bool
- func MapStringP(m map[string]string) *map[string]string
- func StringP(s string) *string
- func UintP(u uint) *uint
- type ClusterData
- type ClusterView
- type Config
- type Duration
- type KeeperDiscoveryInfo
- type KeeperInfo
- type KeeperRole
- type KeeperState
- type KeepersDiscoveryInfo
- type KeepersInfo
- type KeepersRole
- type KeepersState
- type NilConfig
- type PostgresState
- type PostgresTimelineHistory
- type PostgresTimelinesHistory
- type ProxiesInfo
- type ProxyConf
- type ProxyInfo
- type SentinelInfo
- type SentinelsInfo
Constants ¶
View Source
const ( DefaultProxyCheckInterval = 5 * time.Second DefaultRequestTimeout = 10 * time.Second DefaultSleepInterval = 5 * time.Second DefaultKeeperFailInterval = 20 * time.Second DefaultMaxStandbysPerSender = 3 DefaultSynchronousReplication = false DefaultInitWithMultipleKeepers = false DefaultUsePGRewind = false )
View Source
const (
CurrentCDFormatVersion uint64 = 0
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClusterData ¶
type ClusterData struct { // ClusterData format version. Used to detect incompatible // version and do upgrade. Needs to be bumped when a non // backward compatible change is done to the other struct // members. FormatVersion uint64 KeepersState KeepersState ClusterView *ClusterView }
A struct containing the KeepersState and the ClusterView since they need to be in sync
type ClusterView ¶
type ClusterView struct { Version int Master string KeepersRole KeepersRole ProxyConf *ProxyConf Config *NilConfig ChangeTime time.Time }
func NewClusterView ¶
func NewClusterView() *ClusterView
NewClusterView return an initialized clusterView with Version: 0, zero ChangeTime, no Master and empty KeepersRole.
func (*ClusterView) Copy ¶
func (cv *ClusterView) Copy() *ClusterView
func (*ClusterView) Equals ¶
func (cv *ClusterView) Equals(ncv *ClusterView) bool
Equals checks if the clusterViews are the same. It ignores the ChangeTime.
func (*ClusterView) GetFollowersIDs ¶
func (cv *ClusterView) GetFollowersIDs(id string) []string
Returns a sorted list of followersIDs
type Config ¶
type Config struct { // Time after which any request (keepers checks from sentinel etc...) will fail. RequestTimeout time.Duration // Interval to wait before next check (for every component: keeper, sentinel, proxy). SleepInterval time.Duration // Interval after the first fail to declare a keeper as not healthy. KeeperFailInterval time.Duration // Max number of standbys for every sender. A sender can be a master or // another standby (with cascading replication). MaxStandbysPerSender uint // Use Synchronous replication between master and its standbys SynchronousReplication bool // Choose a random initial master when multiple keeper are registered InitWithMultipleKeepers bool // Whether to use pg_rewind UsePGRewind bool // Map of postgres parameters PGParameters map[string]string }
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
type Duration ¶
Duration is needed to be able to marshal/unmarshal json strings with time unit (eg. 3s, 100ms) instead of ugly times in nanoseconds.
func (Duration) MarshalJSON ¶
func (*Duration) UnmarshalJSON ¶
type KeeperDiscoveryInfo ¶
type KeeperInfo ¶
type KeeperInfo struct { ID string ClusterViewVersion int ListenAddress string Port string PGListenAddress string PGPort string }
func (*KeeperInfo) Copy ¶
func (k *KeeperInfo) Copy() *KeeperInfo
type KeeperRole ¶
func (*KeeperRole) Copy ¶
func (kr *KeeperRole) Copy() *KeeperRole
type KeeperState ¶
type KeeperState struct { ID string ErrorStartTime time.Time Healthy bool ClusterViewVersion int ListenAddress string Port string PGListenAddress string PGPort string PGState *PostgresState }
func (*KeeperState) ChangedFromKeeperInfo ¶
func (ks *KeeperState) ChangedFromKeeperInfo(ki *KeeperInfo) (bool, error)
func (*KeeperState) CleanError ¶
func (ks *KeeperState) CleanError()
func (*KeeperState) Copy ¶
func (ks *KeeperState) Copy() *KeeperState
func (*KeeperState) SetError ¶
func (ks *KeeperState) SetError()
func (*KeeperState) UpdateFromKeeperInfo ¶
func (ks *KeeperState) UpdateFromKeeperInfo(ki *KeeperInfo) error
type KeepersDiscoveryInfo ¶
type KeepersDiscoveryInfo []*KeeperDiscoveryInfo
type KeepersInfo ¶
type KeepersInfo map[string]*KeeperInfo
type KeepersRole ¶
type KeepersRole map[string]*KeeperRole
func NewKeepersRole ¶
func NewKeepersRole() KeepersRole
func (KeepersRole) Copy ¶
func (ksr KeepersRole) Copy() KeepersRole
type KeepersState ¶
type KeepersState map[string]*KeeperState
func (KeepersState) Copy ¶
func (kss KeepersState) Copy() KeepersState
func (KeepersState) NewFromKeeperInfo ¶
func (kss KeepersState) NewFromKeeperInfo(ki *KeeperInfo) error
func (KeepersState) SortedKeys ¶
func (kss KeepersState) SortedKeys() []string
type NilConfig ¶
type NilConfig struct { RequestTimeout *Duration `json:"request_timeout,omitempty"` SleepInterval *Duration `json:"sleep_interval,omitempty"` KeeperFailInterval *Duration `json:"keeper_fail_interval,omitempty"` MaxStandbysPerSender *uint `json:"max_standbys_per_sender,omitempty"` SynchronousReplication *bool `json:"synchronous_replication,omitempty"` InitWithMultipleKeepers *bool `json:"init_with_multiple_keepers,omitempty"` UsePGRewind *bool `json:"use_pg_rewind,omitempty"` PGParameters *map[string]string `json:"pg_parameters,omitempty"` }
func (*NilConfig) MergeDefaults ¶
func (c *NilConfig) MergeDefaults()
func (*NilConfig) UnmarshalJSON ¶
type PostgresState ¶
type PostgresState struct { Initialized bool Role common.Role SystemID string TimelineID uint64 XLogPos uint64 TimelinesHistory PostgresTimelinesHistory }
func (*PostgresState) Copy ¶
func (p *PostgresState) Copy() *PostgresState
type PostgresTimelineHistory ¶
type PostgresTimelinesHistory ¶
type PostgresTimelinesHistory []*PostgresTimelineHistory
func (PostgresTimelinesHistory) Copy ¶
func (tlsh PostgresTimelinesHistory) Copy() PostgresTimelinesHistory
func (PostgresTimelinesHistory) GetTimelineHistory ¶
func (tlsh PostgresTimelinesHistory) GetTimelineHistory(id uint64) *PostgresTimelineHistory
type ProxiesInfo ¶
type ProxiesInfo []*ProxyInfo
func (ProxiesInfo) Len ¶
func (p ProxiesInfo) Len() int
func (ProxiesInfo) Less ¶
func (p ProxiesInfo) Less(i, j int) bool
func (ProxiesInfo) Swap ¶
func (p ProxiesInfo) Swap(i, j int)
type SentinelInfo ¶
type SentinelsInfo ¶
type SentinelsInfo []*SentinelInfo
func (SentinelsInfo) Len ¶
func (s SentinelsInfo) Len() int
func (SentinelsInfo) Less ¶
func (s SentinelsInfo) Less(i, j int) bool
func (SentinelsInfo) Swap ¶
func (s SentinelsInfo) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.