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 ¶
func MapStringP ¶
func MapStringP(m map[string]string) *map[string]string
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) 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 ¶
type Duration struct {
time.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 (d Duration) MarshalJSON() ([]byte, error)
func (*Duration) UnmarshalJSON ¶
func (d *Duration) UnmarshalJSON(b []byte) error
type KeeperDiscoveryInfo ¶
type KeeperDiscoveryInfo struct {
ListenAddress string
Port string
}
type KeeperInfo ¶
type KeeperInfo struct {
ID string
ClusterViewVersion int
ListenAddress string
Port string
PGListenAddress string
PGPort string
}
type KeeperRole ¶
type KeeperRole struct {
ID string
Follow string
}
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) 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
type KeepersState ¶
type KeepersState map[string]*KeeperState
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 ¶
func (c *NilConfig) UnmarshalJSON(in []byte) error
type PostgresState ¶
type PostgresState struct {
Initialized bool
Role common.Role
SystemID string
TimelineID uint64
XLogPos uint64
TimelinesHistory PostgresTimelinesHistory
}
type PostgresTimelineHistory ¶
type PostgresTimelineHistory struct {
TimelineID uint64
SwitchPoint uint64
Reason string
}
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
type ProxyInfo ¶
type ProxyInfo struct {
ID string
ListenAddress string
Port string
ClusterViewVersion int
}
type SentinelInfo ¶
type SentinelInfo struct {
ID string
ListenAddress string
Port string
}
Click to show internal directories.
Click to hide internal directories.