Documentation ¶
Overview ¶
Code generated by atomix-go-framework. DO NOT EDIT.
Code generated by atomix-go-framework. DO NOT EDIT.
Index ¶
- Constants
- Variables
- func RegisterService(node *rsm.Node)
- type AnointProposal
- type AnointProposals
- type EnterProposal
- type EnterProposals
- type EventsProposal
- type EventsProposals
- type EvictProposal
- type EvictProposals
- type GetTermQuery
- type LeaderElectionState
- func (*LeaderElectionState) Descriptor() ([]byte, []int)
- func (m *LeaderElectionState) GetValue() int64
- func (m *LeaderElectionState) Marshal() (dAtA []byte, err error)
- func (m *LeaderElectionState) MarshalTo(dAtA []byte) (int, error)
- func (m *LeaderElectionState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*LeaderElectionState) ProtoMessage()
- func (m *LeaderElectionState) Reset()
- func (m *LeaderElectionState) Size() (n int)
- func (m *LeaderElectionState) String() string
- func (m *LeaderElectionState) Unmarshal(dAtA []byte) error
- func (m *LeaderElectionState) XXX_DiscardUnknown()
- func (m *LeaderElectionState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LeaderElectionState) XXX_Merge(src proto.Message)
- func (m *LeaderElectionState) XXX_Size() int
- func (m *LeaderElectionState) XXX_Unmarshal(b []byte) error
- type NewServiceFunc
- type PromoteProposal
- type PromoteProposals
- type Proposal
- type ProposalID
- type ProposalState
- type Proposals
- type Query
- type Service
- type ServiceAdaptor
- type ServiceContext
- type Session
- type SessionID
- type SessionState
- type Sessions
- type SnapshotReader
- type SnapshotWriter
- type Watcher
- type WithdrawProposal
- type WithdrawProposals
Constants ¶
View Source
const Type = "Election"
Variables ¶
Functions ¶
func RegisterService ¶
RegisterService registers the election primitive service on the given node
Types ¶
type AnointProposal ¶
type AnointProposal interface { Proposal Request() *election.AnointRequest }
type AnointProposals ¶
type AnointProposals interface { Get(ProposalID) (AnointProposal, bool) List() []AnointProposal }
type EnterProposal ¶
type EnterProposal interface { Proposal Request() *election.EnterRequest }
type EnterProposals ¶
type EnterProposals interface { Get(ProposalID) (EnterProposal, bool) List() []EnterProposal }
type EventsProposal ¶
type EventsProposal interface { Proposal Request() *election.EventsRequest Notify(*election.EventsResponse) Close() }
type EventsProposals ¶
type EventsProposals interface { Get(ProposalID) (EventsProposal, bool) List() []EventsProposal }
type EvictProposal ¶
type EvictProposal interface { Proposal Request() *election.EvictRequest }
type EvictProposals ¶
type EvictProposals interface { Get(ProposalID) (EvictProposal, bool) List() []EvictProposal }
type GetTermQuery ¶ added in v0.9.1
type GetTermQuery interface { Query Request() *election.GetTermRequest }
type LeaderElectionState ¶
type LeaderElectionState struct { meta.ObjectMeta `protobuf:"bytes,1,opt,name=meta,proto3,embedded=meta" json:"meta"` Value int64 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` }
func (*LeaderElectionState) Descriptor ¶
func (*LeaderElectionState) Descriptor() ([]byte, []int)
func (*LeaderElectionState) GetValue ¶
func (m *LeaderElectionState) GetValue() int64
func (*LeaderElectionState) Marshal ¶
func (m *LeaderElectionState) Marshal() (dAtA []byte, err error)
func (*LeaderElectionState) MarshalTo ¶
func (m *LeaderElectionState) MarshalTo(dAtA []byte) (int, error)
func (*LeaderElectionState) MarshalToSizedBuffer ¶
func (m *LeaderElectionState) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*LeaderElectionState) ProtoMessage ¶
func (*LeaderElectionState) ProtoMessage()
func (*LeaderElectionState) Reset ¶
func (m *LeaderElectionState) Reset()
func (*LeaderElectionState) Size ¶
func (m *LeaderElectionState) Size() (n int)
func (*LeaderElectionState) String ¶
func (m *LeaderElectionState) String() string
func (*LeaderElectionState) Unmarshal ¶
func (m *LeaderElectionState) Unmarshal(dAtA []byte) error
func (*LeaderElectionState) XXX_DiscardUnknown ¶
func (m *LeaderElectionState) XXX_DiscardUnknown()
func (*LeaderElectionState) XXX_Marshal ¶
func (m *LeaderElectionState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*LeaderElectionState) XXX_Merge ¶
func (m *LeaderElectionState) XXX_Merge(src proto.Message)
func (*LeaderElectionState) XXX_Size ¶
func (m *LeaderElectionState) XXX_Size() int
func (*LeaderElectionState) XXX_Unmarshal ¶
func (m *LeaderElectionState) XXX_Unmarshal(b []byte) error
type NewServiceFunc ¶
type NewServiceFunc func(ServiceContext) Service
type PromoteProposal ¶
type PromoteProposal interface { Proposal Request() *election.PromoteRequest }
type PromoteProposals ¶
type PromoteProposals interface { Get(ProposalID) (PromoteProposal, bool) List() []PromoteProposal }
type Proposal ¶
type Proposal interface { fmt.Stringer ID() ProposalID Session() Session State() ProposalState Watch(func(ProposalState)) Watcher }
type ProposalID ¶
type ProposalID uint64
type ProposalState ¶ added in v0.9.1
type ProposalState int
const ( ProposalComplete ProposalState = iota ProposalOpen )
type Proposals ¶
type Proposals interface { Enter() EnterProposals Withdraw() WithdrawProposals Anoint() AnointProposals Promote() PromoteProposals Evict() EvictProposals Events() EventsProposals }
type Service ¶
type Service interface { ServiceContext Backup(SnapshotWriter) error Restore(SnapshotReader) error // Enter enters the leader election Enter(EnterProposal) (*election.EnterResponse, error) // Withdraw withdraws a candidate from the leader election Withdraw(WithdrawProposal) (*election.WithdrawResponse, error) // Anoint anoints a candidate leader Anoint(AnointProposal) (*election.AnointResponse, error) // Promote promotes a candidate Promote(PromoteProposal) (*election.PromoteResponse, error) // Evict evicts a candidate from the election Evict(EvictProposal) (*election.EvictResponse, error) // GetTerm gets the current leadership term GetTerm(GetTermQuery) (*election.GetTermResponse, error) // Events listens for leadership events Events(EventsProposal) }
type ServiceAdaptor ¶
type ServiceAdaptor struct { rsm.ServiceContext // contains filtered or unexported fields }
func (*ServiceAdaptor) ExecuteCommand ¶ added in v0.9.1
func (s *ServiceAdaptor) ExecuteCommand(command rsm.Command)
func (*ServiceAdaptor) ExecuteQuery ¶ added in v0.9.1
func (s *ServiceAdaptor) ExecuteQuery(query rsm.Query)
type ServiceContext ¶
type Session ¶
type Session interface { ID() SessionID State() SessionState Watch(func(SessionState)) Watcher Proposals() Proposals }
type SnapshotReader ¶
type SnapshotReader interface {
ReadState() (*LeaderElectionState, error)
}
type SnapshotWriter ¶
type SnapshotWriter interface {
WriteState(*LeaderElectionState) error
}
type WithdrawProposal ¶
type WithdrawProposal interface { Proposal Request() *election.WithdrawRequest }
type WithdrawProposals ¶
type WithdrawProposals interface { Get(ProposalID) (WithdrawProposal, bool) List() []WithdrawProposal }
Click to show internal directories.
Click to hide internal directories.