election

package
v0.5.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

Type is the leader election primitive type

Variables

View Source
var (
	ErrInvalidLengthElection        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowElection          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupElection = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ListenResponse_Type_name = map[int32]string{
	0: "CHANGED",
}
View Source
var ListenResponse_Type_value = map[string]int32{
	"CHANGED": 0,
}

Functions

func RegisterPrimitive

func RegisterPrimitive(node *atomix.Node)

RegisterPrimitive registers the primitive on the given node

Types

type AnointRequest

type AnointRequest struct {
	ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}

func (*AnointRequest) Descriptor

func (*AnointRequest) Descriptor() ([]byte, []int)

func (*AnointRequest) GetID

func (m *AnointRequest) GetID() string

func (*AnointRequest) Marshal

func (m *AnointRequest) Marshal() (dAtA []byte, err error)

func (*AnointRequest) MarshalTo

func (m *AnointRequest) MarshalTo(dAtA []byte) (int, error)

func (*AnointRequest) MarshalToSizedBuffer

func (m *AnointRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*AnointRequest) ProtoMessage

func (*AnointRequest) ProtoMessage()

func (*AnointRequest) Reset

func (m *AnointRequest) Reset()

func (*AnointRequest) Size

func (m *AnointRequest) Size() (n int)

func (*AnointRequest) String

func (m *AnointRequest) String() string

func (*AnointRequest) Unmarshal

func (m *AnointRequest) Unmarshal(dAtA []byte) error

func (*AnointRequest) XXX_DiscardUnknown

func (m *AnointRequest) XXX_DiscardUnknown()

func (*AnointRequest) XXX_Marshal

func (m *AnointRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AnointRequest) XXX_Merge

func (m *AnointRequest) XXX_Merge(src proto.Message)

func (*AnointRequest) XXX_Size

func (m *AnointRequest) XXX_Size() int

func (*AnointRequest) XXX_Unmarshal

func (m *AnointRequest) XXX_Unmarshal(b []byte) error

type AnointResponse

type AnointResponse struct {
	Term *Term `protobuf:"bytes,2,opt,name=term,proto3" json:"term,omitempty"`
}

func (*AnointResponse) Descriptor

func (*AnointResponse) Descriptor() ([]byte, []int)

func (*AnointResponse) GetTerm

func (m *AnointResponse) GetTerm() *Term

func (*AnointResponse) Marshal

func (m *AnointResponse) Marshal() (dAtA []byte, err error)

func (*AnointResponse) MarshalTo

func (m *AnointResponse) MarshalTo(dAtA []byte) (int, error)

func (*AnointResponse) MarshalToSizedBuffer

func (m *AnointResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*AnointResponse) ProtoMessage

func (*AnointResponse) ProtoMessage()

func (*AnointResponse) Reset

func (m *AnointResponse) Reset()

func (*AnointResponse) Size

func (m *AnointResponse) Size() (n int)

func (*AnointResponse) String

func (m *AnointResponse) String() string

func (*AnointResponse) Unmarshal

func (m *AnointResponse) Unmarshal(dAtA []byte) error

func (*AnointResponse) XXX_DiscardUnknown

func (m *AnointResponse) XXX_DiscardUnknown()

func (*AnointResponse) XXX_Marshal

func (m *AnointResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AnointResponse) XXX_Merge

func (m *AnointResponse) XXX_Merge(src proto.Message)

func (*AnointResponse) XXX_Size

func (m *AnointResponse) XXX_Size() int

func (*AnointResponse) XXX_Unmarshal

func (m *AnointResponse) XXX_Unmarshal(b []byte) error

type ElectionRegistration

type ElectionRegistration struct {
	ID        string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	SessionID uint64 `protobuf:"varint,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
}

Election registration

func (*ElectionRegistration) Descriptor

func (*ElectionRegistration) Descriptor() ([]byte, []int)

func (*ElectionRegistration) GetID

func (m *ElectionRegistration) GetID() string

func (*ElectionRegistration) GetSessionID

func (m *ElectionRegistration) GetSessionID() uint64

func (*ElectionRegistration) Marshal

func (m *ElectionRegistration) Marshal() (dAtA []byte, err error)

func (*ElectionRegistration) MarshalTo

func (m *ElectionRegistration) MarshalTo(dAtA []byte) (int, error)

func (*ElectionRegistration) MarshalToSizedBuffer

func (m *ElectionRegistration) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ElectionRegistration) ProtoMessage

func (*ElectionRegistration) ProtoMessage()

func (*ElectionRegistration) Reset

func (m *ElectionRegistration) Reset()

func (*ElectionRegistration) Size

func (m *ElectionRegistration) Size() (n int)

func (*ElectionRegistration) String

func (m *ElectionRegistration) String() string

func (*ElectionRegistration) Unmarshal

func (m *ElectionRegistration) Unmarshal(dAtA []byte) error

func (*ElectionRegistration) XXX_DiscardUnknown

func (m *ElectionRegistration) XXX_DiscardUnknown()

func (*ElectionRegistration) XXX_Marshal

func (m *ElectionRegistration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ElectionRegistration) XXX_Merge

func (m *ElectionRegistration) XXX_Merge(src proto.Message)

func (*ElectionRegistration) XXX_Size

func (m *ElectionRegistration) XXX_Size() int

func (*ElectionRegistration) XXX_Unmarshal

func (m *ElectionRegistration) XXX_Unmarshal(b []byte) error

type ElectionSnapshot

type ElectionSnapshot struct {
	Term       uint64                  `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"`
	Timestamp  *time.Time              `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp,omitempty"`
	Leader     *ElectionRegistration   `protobuf:"bytes,3,opt,name=leader,proto3" json:"leader,omitempty"`
	Candidates []*ElectionRegistration `protobuf:"bytes,4,rep,name=candidates,proto3" json:"candidates,omitempty"`
}

Election snapshot

func (*ElectionSnapshot) Descriptor

func (*ElectionSnapshot) Descriptor() ([]byte, []int)

func (*ElectionSnapshot) GetCandidates

func (m *ElectionSnapshot) GetCandidates() []*ElectionRegistration

func (*ElectionSnapshot) GetLeader

func (m *ElectionSnapshot) GetLeader() *ElectionRegistration

func (*ElectionSnapshot) GetTerm

func (m *ElectionSnapshot) GetTerm() uint64

func (*ElectionSnapshot) GetTimestamp

func (m *ElectionSnapshot) GetTimestamp() *time.Time

func (*ElectionSnapshot) Marshal

func (m *ElectionSnapshot) Marshal() (dAtA []byte, err error)

func (*ElectionSnapshot) MarshalTo

func (m *ElectionSnapshot) MarshalTo(dAtA []byte) (int, error)

func (*ElectionSnapshot) MarshalToSizedBuffer

func (m *ElectionSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ElectionSnapshot) ProtoMessage

func (*ElectionSnapshot) ProtoMessage()

func (*ElectionSnapshot) Reset

func (m *ElectionSnapshot) Reset()

func (*ElectionSnapshot) Size

func (m *ElectionSnapshot) Size() (n int)

func (*ElectionSnapshot) String

func (m *ElectionSnapshot) String() string

func (*ElectionSnapshot) Unmarshal

func (m *ElectionSnapshot) Unmarshal(dAtA []byte) error

func (*ElectionSnapshot) XXX_DiscardUnknown

func (m *ElectionSnapshot) XXX_DiscardUnknown()

func (*ElectionSnapshot) XXX_Marshal

func (m *ElectionSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ElectionSnapshot) XXX_Merge

func (m *ElectionSnapshot) XXX_Merge(src proto.Message)

func (*ElectionSnapshot) XXX_Size

func (m *ElectionSnapshot) XXX_Size() int

func (*ElectionSnapshot) XXX_Unmarshal

func (m *ElectionSnapshot) XXX_Unmarshal(b []byte) error

type EnterRequest

type EnterRequest struct {
	ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}

func (*EnterRequest) Descriptor

func (*EnterRequest) Descriptor() ([]byte, []int)

func (*EnterRequest) GetID

func (m *EnterRequest) GetID() string

func (*EnterRequest) Marshal

func (m *EnterRequest) Marshal() (dAtA []byte, err error)

func (*EnterRequest) MarshalTo

func (m *EnterRequest) MarshalTo(dAtA []byte) (int, error)

func (*EnterRequest) MarshalToSizedBuffer

func (m *EnterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EnterRequest) ProtoMessage

func (*EnterRequest) ProtoMessage()

func (*EnterRequest) Reset

func (m *EnterRequest) Reset()

func (*EnterRequest) Size

func (m *EnterRequest) Size() (n int)

func (*EnterRequest) String

func (m *EnterRequest) String() string

func (*EnterRequest) Unmarshal

func (m *EnterRequest) Unmarshal(dAtA []byte) error

func (*EnterRequest) XXX_DiscardUnknown

func (m *EnterRequest) XXX_DiscardUnknown()

func (*EnterRequest) XXX_Marshal

func (m *EnterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EnterRequest) XXX_Merge

func (m *EnterRequest) XXX_Merge(src proto.Message)

func (*EnterRequest) XXX_Size

func (m *EnterRequest) XXX_Size() int

func (*EnterRequest) XXX_Unmarshal

func (m *EnterRequest) XXX_Unmarshal(b []byte) error

type EnterResponse

type EnterResponse struct {
	Term *Term `protobuf:"bytes,1,opt,name=term,proto3" json:"term,omitempty"`
}

func (*EnterResponse) Descriptor

func (*EnterResponse) Descriptor() ([]byte, []int)

func (*EnterResponse) GetTerm

func (m *EnterResponse) GetTerm() *Term

func (*EnterResponse) Marshal

func (m *EnterResponse) Marshal() (dAtA []byte, err error)

func (*EnterResponse) MarshalTo

func (m *EnterResponse) MarshalTo(dAtA []byte) (int, error)

func (*EnterResponse) MarshalToSizedBuffer

func (m *EnterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EnterResponse) ProtoMessage

func (*EnterResponse) ProtoMessage()

func (*EnterResponse) Reset

func (m *EnterResponse) Reset()

func (*EnterResponse) Size

func (m *EnterResponse) Size() (n int)

func (*EnterResponse) String

func (m *EnterResponse) String() string

func (*EnterResponse) Unmarshal

func (m *EnterResponse) Unmarshal(dAtA []byte) error

func (*EnterResponse) XXX_DiscardUnknown

func (m *EnterResponse) XXX_DiscardUnknown()

func (*EnterResponse) XXX_Marshal

func (m *EnterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EnterResponse) XXX_Merge

func (m *EnterResponse) XXX_Merge(src proto.Message)

func (*EnterResponse) XXX_Size

func (m *EnterResponse) XXX_Size() int

func (*EnterResponse) XXX_Unmarshal

func (m *EnterResponse) XXX_Unmarshal(b []byte) error

type EvictRequest

type EvictRequest struct {
	ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}

func (*EvictRequest) Descriptor

func (*EvictRequest) Descriptor() ([]byte, []int)

func (*EvictRequest) GetID

func (m *EvictRequest) GetID() string

func (*EvictRequest) Marshal

func (m *EvictRequest) Marshal() (dAtA []byte, err error)

func (*EvictRequest) MarshalTo

func (m *EvictRequest) MarshalTo(dAtA []byte) (int, error)

func (*EvictRequest) MarshalToSizedBuffer

func (m *EvictRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EvictRequest) ProtoMessage

func (*EvictRequest) ProtoMessage()

func (*EvictRequest) Reset

func (m *EvictRequest) Reset()

func (*EvictRequest) Size

func (m *EvictRequest) Size() (n int)

func (*EvictRequest) String

func (m *EvictRequest) String() string

func (*EvictRequest) Unmarshal

func (m *EvictRequest) Unmarshal(dAtA []byte) error

func (*EvictRequest) XXX_DiscardUnknown

func (m *EvictRequest) XXX_DiscardUnknown()

func (*EvictRequest) XXX_Marshal

func (m *EvictRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EvictRequest) XXX_Merge

func (m *EvictRequest) XXX_Merge(src proto.Message)

func (*EvictRequest) XXX_Size

func (m *EvictRequest) XXX_Size() int

func (*EvictRequest) XXX_Unmarshal

func (m *EvictRequest) XXX_Unmarshal(b []byte) error

type EvictResponse

type EvictResponse struct {
	Term *Term `protobuf:"bytes,2,opt,name=term,proto3" json:"term,omitempty"`
}

func (*EvictResponse) Descriptor

func (*EvictResponse) Descriptor() ([]byte, []int)

func (*EvictResponse) GetTerm

func (m *EvictResponse) GetTerm() *Term

func (*EvictResponse) Marshal

func (m *EvictResponse) Marshal() (dAtA []byte, err error)

func (*EvictResponse) MarshalTo

func (m *EvictResponse) MarshalTo(dAtA []byte) (int, error)

func (*EvictResponse) MarshalToSizedBuffer

func (m *EvictResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EvictResponse) ProtoMessage

func (*EvictResponse) ProtoMessage()

func (*EvictResponse) Reset

func (m *EvictResponse) Reset()

func (*EvictResponse) Size

func (m *EvictResponse) Size() (n int)

func (*EvictResponse) String

func (m *EvictResponse) String() string

func (*EvictResponse) Unmarshal

func (m *EvictResponse) Unmarshal(dAtA []byte) error

func (*EvictResponse) XXX_DiscardUnknown

func (m *EvictResponse) XXX_DiscardUnknown()

func (*EvictResponse) XXX_Marshal

func (m *EvictResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EvictResponse) XXX_Merge

func (m *EvictResponse) XXX_Merge(src proto.Message)

func (*EvictResponse) XXX_Size

func (m *EvictResponse) XXX_Size() int

func (*EvictResponse) XXX_Unmarshal

func (m *EvictResponse) XXX_Unmarshal(b []byte) error

type GetTermRequest

type GetTermRequest struct {
}

func (*GetTermRequest) Descriptor

func (*GetTermRequest) Descriptor() ([]byte, []int)

func (*GetTermRequest) Marshal

func (m *GetTermRequest) Marshal() (dAtA []byte, err error)

func (*GetTermRequest) MarshalTo

func (m *GetTermRequest) MarshalTo(dAtA []byte) (int, error)

func (*GetTermRequest) MarshalToSizedBuffer

func (m *GetTermRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GetTermRequest) ProtoMessage

func (*GetTermRequest) ProtoMessage()

func (*GetTermRequest) Reset

func (m *GetTermRequest) Reset()

func (*GetTermRequest) Size

func (m *GetTermRequest) Size() (n int)

func (*GetTermRequest) String

func (m *GetTermRequest) String() string

func (*GetTermRequest) Unmarshal

func (m *GetTermRequest) Unmarshal(dAtA []byte) error

func (*GetTermRequest) XXX_DiscardUnknown

func (m *GetTermRequest) XXX_DiscardUnknown()

func (*GetTermRequest) XXX_Marshal

func (m *GetTermRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetTermRequest) XXX_Merge

func (m *GetTermRequest) XXX_Merge(src proto.Message)

func (*GetTermRequest) XXX_Size

func (m *GetTermRequest) XXX_Size() int

func (*GetTermRequest) XXX_Unmarshal

func (m *GetTermRequest) XXX_Unmarshal(b []byte) error

type GetTermResponse

type GetTermResponse struct {
	Term *Term `protobuf:"bytes,2,opt,name=term,proto3" json:"term,omitempty"`
}

func (*GetTermResponse) Descriptor

func (*GetTermResponse) Descriptor() ([]byte, []int)

func (*GetTermResponse) GetTerm

func (m *GetTermResponse) GetTerm() *Term

func (*GetTermResponse) Marshal

func (m *GetTermResponse) Marshal() (dAtA []byte, err error)

func (*GetTermResponse) MarshalTo

func (m *GetTermResponse) MarshalTo(dAtA []byte) (int, error)

func (*GetTermResponse) MarshalToSizedBuffer

func (m *GetTermResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GetTermResponse) ProtoMessage

func (*GetTermResponse) ProtoMessage()

func (*GetTermResponse) Reset

func (m *GetTermResponse) Reset()

func (*GetTermResponse) Size

func (m *GetTermResponse) Size() (n int)

func (*GetTermResponse) String

func (m *GetTermResponse) String() string

func (*GetTermResponse) Unmarshal

func (m *GetTermResponse) Unmarshal(dAtA []byte) error

func (*GetTermResponse) XXX_DiscardUnknown

func (m *GetTermResponse) XXX_DiscardUnknown()

func (*GetTermResponse) XXX_Marshal

func (m *GetTermResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetTermResponse) XXX_Merge

func (m *GetTermResponse) XXX_Merge(src proto.Message)

func (*GetTermResponse) XXX_Size

func (m *GetTermResponse) XXX_Size() int

func (*GetTermResponse) XXX_Unmarshal

func (m *GetTermResponse) XXX_Unmarshal(b []byte) error

type ListenRequest

type ListenRequest struct {
}

func (*ListenRequest) Descriptor

func (*ListenRequest) Descriptor() ([]byte, []int)

func (*ListenRequest) Marshal

func (m *ListenRequest) Marshal() (dAtA []byte, err error)

func (*ListenRequest) MarshalTo

func (m *ListenRequest) MarshalTo(dAtA []byte) (int, error)

func (*ListenRequest) MarshalToSizedBuffer

func (m *ListenRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ListenRequest) ProtoMessage

func (*ListenRequest) ProtoMessage()

func (*ListenRequest) Reset

func (m *ListenRequest) Reset()

func (*ListenRequest) Size

func (m *ListenRequest) Size() (n int)

func (*ListenRequest) String

func (m *ListenRequest) String() string

func (*ListenRequest) Unmarshal

func (m *ListenRequest) Unmarshal(dAtA []byte) error

func (*ListenRequest) XXX_DiscardUnknown

func (m *ListenRequest) XXX_DiscardUnknown()

func (*ListenRequest) XXX_Marshal

func (m *ListenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListenRequest) XXX_Merge

func (m *ListenRequest) XXX_Merge(src proto.Message)

func (*ListenRequest) XXX_Size

func (m *ListenRequest) XXX_Size() int

func (*ListenRequest) XXX_Unmarshal

func (m *ListenRequest) XXX_Unmarshal(b []byte) error

type ListenResponse

type ListenResponse struct {
	Type ListenResponse_Type `protobuf:"varint,1,opt,name=type,proto3,enum=atomix.election.service.ListenResponse_Type" json:"type,omitempty"`
	Term *Term               `protobuf:"bytes,2,opt,name=term,proto3" json:"term,omitempty"`
}

func (*ListenResponse) Descriptor

func (*ListenResponse) Descriptor() ([]byte, []int)

func (*ListenResponse) GetTerm

func (m *ListenResponse) GetTerm() *Term

func (*ListenResponse) GetType

func (m *ListenResponse) GetType() ListenResponse_Type

func (*ListenResponse) Marshal

func (m *ListenResponse) Marshal() (dAtA []byte, err error)

func (*ListenResponse) MarshalTo

func (m *ListenResponse) MarshalTo(dAtA []byte) (int, error)

func (*ListenResponse) MarshalToSizedBuffer

func (m *ListenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ListenResponse) ProtoMessage

func (*ListenResponse) ProtoMessage()

func (*ListenResponse) Reset

func (m *ListenResponse) Reset()

func (*ListenResponse) Size

func (m *ListenResponse) Size() (n int)

func (*ListenResponse) String

func (m *ListenResponse) String() string

func (*ListenResponse) Unmarshal

func (m *ListenResponse) Unmarshal(dAtA []byte) error

func (*ListenResponse) XXX_DiscardUnknown

func (m *ListenResponse) XXX_DiscardUnknown()

func (*ListenResponse) XXX_Marshal

func (m *ListenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ListenResponse) XXX_Merge

func (m *ListenResponse) XXX_Merge(src proto.Message)

func (*ListenResponse) XXX_Size

func (m *ListenResponse) XXX_Size() int

func (*ListenResponse) XXX_Unmarshal

func (m *ListenResponse) XXX_Unmarshal(b []byte) error

type ListenResponse_Type

type ListenResponse_Type int32
const (
	ListenResponse_CHANGED ListenResponse_Type = 0
)

func (ListenResponse_Type) EnumDescriptor

func (ListenResponse_Type) EnumDescriptor() ([]byte, []int)

func (ListenResponse_Type) String

func (x ListenResponse_Type) String() string

type Primitive

type Primitive struct{}

Primitive is the counter primitive

func (*Primitive) NewService

func (p *Primitive) NewService(scheduler primitive.Scheduler, context primitive.ServiceContext) primitive.Service

NewService creates a new election service

func (*Primitive) RegisterServer

func (p *Primitive) RegisterServer(server *grpc.Server, protocol primitive.Protocol)

RegisterServer registers the election server with the protocol

type PromoteRequest

type PromoteRequest struct {
	ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}

func (*PromoteRequest) Descriptor

func (*PromoteRequest) Descriptor() ([]byte, []int)

func (*PromoteRequest) GetID

func (m *PromoteRequest) GetID() string

func (*PromoteRequest) Marshal

func (m *PromoteRequest) Marshal() (dAtA []byte, err error)

func (*PromoteRequest) MarshalTo

func (m *PromoteRequest) MarshalTo(dAtA []byte) (int, error)

func (*PromoteRequest) MarshalToSizedBuffer

func (m *PromoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PromoteRequest) ProtoMessage

func (*PromoteRequest) ProtoMessage()

func (*PromoteRequest) Reset

func (m *PromoteRequest) Reset()

func (*PromoteRequest) Size

func (m *PromoteRequest) Size() (n int)

func (*PromoteRequest) String

func (m *PromoteRequest) String() string

func (*PromoteRequest) Unmarshal

func (m *PromoteRequest) Unmarshal(dAtA []byte) error

func (*PromoteRequest) XXX_DiscardUnknown

func (m *PromoteRequest) XXX_DiscardUnknown()

func (*PromoteRequest) XXX_Marshal

func (m *PromoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PromoteRequest) XXX_Merge

func (m *PromoteRequest) XXX_Merge(src proto.Message)

func (*PromoteRequest) XXX_Size

func (m *PromoteRequest) XXX_Size() int

func (*PromoteRequest) XXX_Unmarshal

func (m *PromoteRequest) XXX_Unmarshal(b []byte) error

type PromoteResponse

type PromoteResponse struct {
	Term *Term `protobuf:"bytes,2,opt,name=term,proto3" json:"term,omitempty"`
}

func (*PromoteResponse) Descriptor

func (*PromoteResponse) Descriptor() ([]byte, []int)

func (*PromoteResponse) GetTerm

func (m *PromoteResponse) GetTerm() *Term

func (*PromoteResponse) Marshal

func (m *PromoteResponse) Marshal() (dAtA []byte, err error)

func (*PromoteResponse) MarshalTo

func (m *PromoteResponse) MarshalTo(dAtA []byte) (int, error)

func (*PromoteResponse) MarshalToSizedBuffer

func (m *PromoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PromoteResponse) ProtoMessage

func (*PromoteResponse) ProtoMessage()

func (*PromoteResponse) Reset

func (m *PromoteResponse) Reset()

func (*PromoteResponse) Size

func (m *PromoteResponse) Size() (n int)

func (*PromoteResponse) String

func (m *PromoteResponse) String() string

func (*PromoteResponse) Unmarshal

func (m *PromoteResponse) Unmarshal(dAtA []byte) error

func (*PromoteResponse) XXX_DiscardUnknown

func (m *PromoteResponse) XXX_DiscardUnknown()

func (*PromoteResponse) XXX_Marshal

func (m *PromoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PromoteResponse) XXX_Merge

func (m *PromoteResponse) XXX_Merge(src proto.Message)

func (*PromoteResponse) XXX_Size

func (m *PromoteResponse) XXX_Size() int

func (*PromoteResponse) XXX_Unmarshal

func (m *PromoteResponse) XXX_Unmarshal(b []byte) error

type Server

type Server struct {
	*primitive.Server
}

Server is an implementation of LeaderElectionServiceServer for the election primitive

func (*Server) Anoint

func (s *Server) Anoint(ctx context.Context, request *api.AnointRequest) (*api.AnointResponse, error)

Anoint assigns leadership to a candidate

func (*Server) Close

func (s *Server) Close(ctx context.Context, request *api.CloseRequest) (*api.CloseResponse, error)

Close closes a session

func (*Server) Create

func (s *Server) Create(ctx context.Context, request *api.CreateRequest) (*api.CreateResponse, error)

Create opens a new session

func (*Server) Enter

func (s *Server) Enter(ctx context.Context, request *api.EnterRequest) (*api.EnterResponse, error)

Enter enters a candidate in the election

func (*Server) Events

Events lists for election change events

func (*Server) Evict

func (s *Server) Evict(ctx context.Context, request *api.EvictRequest) (*api.EvictResponse, error)

Evict removes a candidate from the election

func (*Server) GetTerm

func (s *Server) GetTerm(ctx context.Context, request *api.GetTermRequest) (*api.GetTermResponse, error)

GetTerm gets the current election term

func (*Server) Promote

func (s *Server) Promote(ctx context.Context, request *api.PromoteRequest) (*api.PromoteResponse, error)

Promote increases the priority of a candidate

func (*Server) Withdraw

func (s *Server) Withdraw(ctx context.Context, request *api.WithdrawRequest) (*api.WithdrawResponse, error)

Withdraw withdraws a candidate from the election

type Service

type Service struct {
	primitive.Service
	// contains filtered or unexported fields
}

Service is a state machine for an election primitive

func (*Service) Anoint

func (e *Service) Anoint(bytes []byte) ([]byte, error)

Anoint assigns leadership to a candidate

func (*Service) Backup

func (e *Service) Backup(writer io.Writer) error

Backup takes a snapshot of the service

func (*Service) Enter

func (e *Service) Enter(bytes []byte) ([]byte, error)

Enter enters a candidate in the election

func (*Service) Events

func (e *Service) Events(bytes []byte, stream primitive.Stream)

Events registers the given channel to receive election events

func (*Service) Evict

func (e *Service) Evict(bytes []byte) ([]byte, error)

Evict removes a candidate from the election

func (*Service) GetTerm

func (e *Service) GetTerm(bytes []byte) ([]byte, error)

GetTerm gets the current election term

func (*Service) Promote

func (e *Service) Promote(bytes []byte) ([]byte, error)

Promote increases the priority of a candidate

func (*Service) Restore

func (e *Service) Restore(reader io.Reader) error

Restore restores the service from a snapshot

func (*Service) SessionClosed

func (e *Service) SessionClosed(session primitive.Session)

SessionClosed is called when a session is closed by the client

func (*Service) SessionExpired

func (e *Service) SessionExpired(session primitive.Session)

SessionExpired is called when a session is expired by the server

func (*Service) Withdraw

func (e *Service) Withdraw(bytes []byte) ([]byte, error)

Withdraw withdraws a candidate from the election

type Term

type Term struct {
	ID         uint64     `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Timestamp  *time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp,omitempty"`
	Leader     string     `protobuf:"bytes,3,opt,name=leader,proto3" json:"leader,omitempty"`
	Candidates []string   `protobuf:"bytes,4,rep,name=candidates,proto3" json:"candidates,omitempty"`
}

func (*Term) Descriptor

func (*Term) Descriptor() ([]byte, []int)

func (*Term) GetCandidates

func (m *Term) GetCandidates() []string

func (*Term) GetID

func (m *Term) GetID() uint64

func (*Term) GetLeader

func (m *Term) GetLeader() string

func (*Term) GetTimestamp

func (m *Term) GetTimestamp() *time.Time

func (*Term) Marshal

func (m *Term) Marshal() (dAtA []byte, err error)

func (*Term) MarshalTo

func (m *Term) MarshalTo(dAtA []byte) (int, error)

func (*Term) MarshalToSizedBuffer

func (m *Term) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Term) ProtoMessage

func (*Term) ProtoMessage()

func (*Term) Reset

func (m *Term) Reset()

func (*Term) Size

func (m *Term) Size() (n int)

func (*Term) String

func (m *Term) String() string

func (*Term) Unmarshal

func (m *Term) Unmarshal(dAtA []byte) error

func (*Term) XXX_DiscardUnknown

func (m *Term) XXX_DiscardUnknown()

func (*Term) XXX_Marshal

func (m *Term) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Term) XXX_Merge

func (m *Term) XXX_Merge(src proto.Message)

func (*Term) XXX_Size

func (m *Term) XXX_Size() int

func (*Term) XXX_Unmarshal

func (m *Term) XXX_Unmarshal(b []byte) error

type WithdrawRequest

type WithdrawRequest struct {
	ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
}

func (*WithdrawRequest) Descriptor

func (*WithdrawRequest) Descriptor() ([]byte, []int)

func (*WithdrawRequest) GetID

func (m *WithdrawRequest) GetID() string

func (*WithdrawRequest) Marshal

func (m *WithdrawRequest) Marshal() (dAtA []byte, err error)

func (*WithdrawRequest) MarshalTo

func (m *WithdrawRequest) MarshalTo(dAtA []byte) (int, error)

func (*WithdrawRequest) MarshalToSizedBuffer

func (m *WithdrawRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*WithdrawRequest) ProtoMessage

func (*WithdrawRequest) ProtoMessage()

func (*WithdrawRequest) Reset

func (m *WithdrawRequest) Reset()

func (*WithdrawRequest) Size

func (m *WithdrawRequest) Size() (n int)

func (*WithdrawRequest) String

func (m *WithdrawRequest) String() string

func (*WithdrawRequest) Unmarshal

func (m *WithdrawRequest) Unmarshal(dAtA []byte) error

func (*WithdrawRequest) XXX_DiscardUnknown

func (m *WithdrawRequest) XXX_DiscardUnknown()

func (*WithdrawRequest) XXX_Marshal

func (m *WithdrawRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WithdrawRequest) XXX_Merge

func (m *WithdrawRequest) XXX_Merge(src proto.Message)

func (*WithdrawRequest) XXX_Size

func (m *WithdrawRequest) XXX_Size() int

func (*WithdrawRequest) XXX_Unmarshal

func (m *WithdrawRequest) XXX_Unmarshal(b []byte) error

type WithdrawResponse

type WithdrawResponse struct {
	Term *Term `protobuf:"bytes,2,opt,name=term,proto3" json:"term,omitempty"`
}

func (*WithdrawResponse) Descriptor

func (*WithdrawResponse) Descriptor() ([]byte, []int)

func (*WithdrawResponse) GetTerm

func (m *WithdrawResponse) GetTerm() *Term

func (*WithdrawResponse) Marshal

func (m *WithdrawResponse) Marshal() (dAtA []byte, err error)

func (*WithdrawResponse) MarshalTo

func (m *WithdrawResponse) MarshalTo(dAtA []byte) (int, error)

func (*WithdrawResponse) MarshalToSizedBuffer

func (m *WithdrawResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*WithdrawResponse) ProtoMessage

func (*WithdrawResponse) ProtoMessage()

func (*WithdrawResponse) Reset

func (m *WithdrawResponse) Reset()

func (*WithdrawResponse) Size

func (m *WithdrawResponse) Size() (n int)

func (*WithdrawResponse) String

func (m *WithdrawResponse) String() string

func (*WithdrawResponse) Unmarshal

func (m *WithdrawResponse) Unmarshal(dAtA []byte) error

func (*WithdrawResponse) XXX_DiscardUnknown

func (m *WithdrawResponse) XXX_DiscardUnknown()

func (*WithdrawResponse) XXX_Marshal

func (m *WithdrawResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WithdrawResponse) XXX_Merge

func (m *WithdrawResponse) XXX_Merge(src proto.Message)

func (*WithdrawResponse) XXX_Size

func (m *WithdrawResponse) XXX_Size() int

func (*WithdrawResponse) XXX_Unmarshal

func (m *WithdrawResponse) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL