Documentation
¶
Index ¶
- Constants
- type State
- func (c *State) ElectionTimeout() time.Duration
- func (c *State) HeartbeatTimeout() time.Duration
- func (c *State) Load(buf []byte) error
- func (c *State) LoadFile(fileName string) error
- func (c *State) Lock()
- func (c *State) MinPurgeDuration() time.Duration
- func (c *State) MinPurgeRecords() uint32
- func (c *State) RLock()
- func (c *State) RUnlock()
- func (c *State) SetElectionTimeout(d time.Duration)
- func (c *State) SetHeartbeatTimeout(d time.Duration)
- func (c *State) SetMinPurgeDuration(d time.Duration)
- func (c *State) SetMinPurgeRecords(v uint32)
- func (c *State) SetWebHooks(h []hooks.WebHook)
- func (c *State) ShouldPurgeRecords() bool
- func (c *State) Store() ([]byte, error)
- func (c *State) StoreFile(fileName string) error
- func (c *State) Timeouts() (time.Duration, time.Duration)
- func (c *State) Unlock()
- func (c *State) Validate() error
- func (c *State) WebHooks() []hooks.WebHook
- type StoredState
Constants ¶
const ( // DefaultElectionTimeout is the election timeout out of the box. // It may be modified using UpdateRaftConfig DefaultElectionTimeout = "10s" // DefaultHeartbeatTimeout is the default heartbeat timeout. It may be // modified using UpdateRaftConfig DefaultHeartbeatTimeout = "2s" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State describes configuration information about the raft service that is shared around the cluster. If either MinPurgeRecords OR MinPurgeDuration is set to greater than zero, then the leader will send a purge request to the quorum every so often. A State is also an RWMutex so that it can (and should) be locked and unlocked on each go-around.
func GetDefaultConfig ¶
func GetDefaultConfig() *State
GetDefaultConfig should be used as the basis for any configuration changes.
func (*State) ElectionTimeout ¶
ElectionTimeout is the amount of time a node will wait once it has heard from the current leader before it declares itself a candidate. It must always be a small multiple of HeartbeatTimeout.
func (*State) HeartbeatTimeout ¶
HeartbeatTimeout is the amount of time between heartbeat messages from the leader to other nodes.
func (*State) MinPurgeDuration ¶
MinPurgeDuration defines the minimum amount of time that a record must remain on the change list before being purged. Default is zero, which no purging.
func (*State) MinPurgeRecords ¶
MinPurgeRecords defines the minimum number of records that must be retained on a purge. Default is zero, which means no purging.
func (*State) RUnlock ¶
func (c *State) RUnlock()
RUnlock unlocks the internal latch just like an RWMutex
func (*State) SetElectionTimeout ¶ added in v0.5.5
SetElectionTimeout updates ElectionTimeout in a thread-safe way.
func (*State) SetHeartbeatTimeout ¶ added in v0.5.5
SetHeartbeatTimeout updates HeartbeatTimeout in a thread-safe way.
func (*State) SetMinPurgeDuration ¶ added in v0.5.5
SetMinPurgeDuration updates MinPurgeDuration in a thread-safe way.
func (*State) SetMinPurgeRecords ¶ added in v0.5.5
SetMinPurgeRecords updates MinPurgeRecords in a thread-safe way.
func (*State) SetWebHooks ¶ added in v0.5.5
SetWebHooks updates the web hooks in a thread-safe way.
func (*State) ShouldPurgeRecords ¶
ShouldPurgeRecords is a convenience that lets us know if both parameters are set to cause automatic purging to happen.
func (*State) Timeouts ¶ added in v0.5.5
Timeouts is a quick way to get the election and heartbeat timeouts in one call. The first one returned is the heartbeat timeout, then election timeout.
type StoredState ¶ added in v0.5.5
type StoredState struct { MinPurgeRecords uint32 `yaml:"minPurgeRecords"` MinPurgeDuration string `yaml:"minPurgeDuration"` ElectionTimeout string `yaml:"electionTimeout"` HeartbeatTimeout string `yaml:"heartbeatTimeout"` WebHooks []hooks.WebHook `yaml:"webHooks,omitempty"` }
StoredState is the structure that is read from and written to YAML