Documentation
¶
Index ¶
- func New(options ...Option) ra.Promoter
- type ExtraConfig
- type ExtraServerInfo
- type ImprovedPromoter
- func (p *ImprovedPromoter) CalculatePromotionsAndDemotions(config *ra.Config, state *ra.State) ra.RaftChanges
- func (p *ImprovedPromoter) FilterFailedServerRemovals(config *ra.Config, state *ra.State, failed *ra.FailedServers) *ra.FailedServers
- func (p *ImprovedPromoter) GetNodeTypes(config *ra.Config, state *ra.State) map[raft.ServerID]ra.NodeType
- func (p *ImprovedPromoter) GetServerExt(config *ra.Config, srvState *ra.ServerState) interface{}
- func (p *ImprovedPromoter) GetStateExt(config *ra.Config, state *ra.State) interface{}
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ExtraConfig ¶ added in v0.4.0
type ExtraServerInfo ¶ added in v0.4.0
type ImprovedPromoter ¶ added in v0.4.0
type ImprovedPromoter struct {
// contains filtered or unexported fields
}
ImprovedPromoter is a new version of the promoter with improved funcionality
func (*ImprovedPromoter) CalculatePromotionsAndDemotions ¶ added in v0.4.0
func (p *ImprovedPromoter) CalculatePromotionsAndDemotions(config *ra.Config, state *ra.State) ra.RaftChanges
CalculatePromotionsAndDemotions return the changes
func (*ImprovedPromoter) FilterFailedServerRemovals ¶ added in v0.4.0
func (p *ImprovedPromoter) FilterFailedServerRemovals(config *ra.Config, state *ra.State, failed *ra.FailedServers) *ra.FailedServers
FilterFailedServerRemovals takes in the current state and structure outlining all the failed/stale servers and will return those failed servers which the promoter thinks should be allowed to be removed.
func (*ImprovedPromoter) GetNodeTypes ¶ added in v0.4.0
func (p *ImprovedPromoter) GetNodeTypes(config *ra.Config, state *ra.State) map[raft.ServerID]ra.NodeType
GetNodeTypes returns a map of ServerID to NodeType for all the servers which should have their NodeType field updated
func (*ImprovedPromoter) GetServerExt ¶ added in v0.4.0
func (p *ImprovedPromoter) GetServerExt(config *ra.Config, srvState *ra.ServerState) interface{}
GetServerExt returns some object that should be stored in the Ext field of the Server This value will not be used by the code in this repo but may be used by the other Promoter methods and the application utilizing autopilot. If the value returned is nil the extended state will not be updated.
func (*ImprovedPromoter) GetStateExt ¶ added in v0.4.0
func (p *ImprovedPromoter) GetStateExt(config *ra.Config, state *ra.State) interface{}
GetStateExt returns some object that should be stored in the Ext field of the State This value will not be used by the code in this repo but may be used by the other Promoter methods and the application utilizing autopilot. If the value returned is nil the extended state will not be updated.
type Option ¶ added in v0.4.2
type Option func(*ImprovedPromoter)
Option is an option to be used when creating a new Autopilot instance
func WithLogger ¶ added in v0.4.2
func WithLogger(logger hclog.Logger) Option
WithLogger returns an Option to set the Autopilot instance's logger