Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( RaftStatus_name = map[int32]string{ 0: "RAFT_STATUS_UNSPECIFIED", 1: "RAFT_STATUS_LEADER", 2: "RAFT_STATUS_FOLLOWER", 3: "RAFT_STATUS_CANDIDATE", } RaftStatus_value = map[string]int32{ "RAFT_STATUS_UNSPECIFIED": 0, "RAFT_STATUS_LEADER": 1, "RAFT_STATUS_FOLLOWER": 2, "RAFT_STATUS_CANDIDATE": 3, } )
Enum value maps for RaftStatus.
var ErrInvalidURL = errors.New("invalid URL")
var File_v1_raft_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Raft ¶
type Raft struct {
// contains filtered or unexported fields
}
Raft is the representation of a raft node.
func (*Raft) GetPeerIDs ¶
GetPeerIDs returns the peer addresses of the raft node.
func (*Raft) GetStatus ¶
func (r *Raft) GetStatus() RaftStatus
GetStatus returns the status of the raft node.
func (*Raft) LeaderPromotion ¶
func (r *Raft) LeaderPromotion()
LeaderPromotion promotes the current node to leader.
func (*Raft) SetStatus ¶
func (r *Raft) SetStatus(status RaftStatus)
SetStatus sets the status of the raft node.
func (*Raft) UpdateHeartbeat ¶
func (r *Raft) UpdateHeartbeat()
UpdateHeartbeat updates the last heartbeat of the raft node.
type RaftBuilder ¶
type RaftBuilder struct {
// contains filtered or unexported fields
}
RaftBuilder is used to build a new Raft.
func NewRaftBuilder ¶
func NewRaftBuilder() *RaftBuilder
NewRaftBuilder returns a new instance of RaftBuilder.
func (*RaftBuilder) Build ¶
func (b *RaftBuilder) Build() (*Raft, error)
Build finalizes the building process and returns the built Raft.
func (*RaftBuilder) SetAddress ¶
func (b *RaftBuilder) SetAddress(address string) *RaftBuilder
SetAddress sets the address of the Raft.
func (*RaftBuilder) SetName ¶
func (b *RaftBuilder) SetName(name string) *RaftBuilder
SetName sets the name of the Raft.
func (*RaftBuilder) SetPeerIDs ¶
func (b *RaftBuilder) SetPeerIDs(peerIDs []string) *RaftBuilder
SetPeerIDs sets the peerIDs of the Raft.
func (*RaftBuilder) SetWeight ¶
func (b *RaftBuilder) SetWeight(weight int32) *RaftBuilder
SetWeight sets the weight of the Raft.
type RaftStatus ¶
type RaftStatus int32
RaftStatus is the status of a raft node.
const ( // RAFT_STATUS_UNSPECIFIED is the default status of a raft node. RaftStatus_RAFT_STATUS_UNSPECIFIED RaftStatus = 0 // RAFT_STATUS_LEADER is the status of a raft node when it is the leader. RaftStatus_RAFT_STATUS_LEADER RaftStatus = 1 // RAFT_STATUS_FOLLOWER is the status of a raft node when it is a follower. RaftStatus_RAFT_STATUS_FOLLOWER RaftStatus = 2 // RAFT_STATUS_CANDIDATE is the status of a raft node when it is a candidate. RaftStatus_RAFT_STATUS_CANDIDATE RaftStatus = 3 )
func (RaftStatus) Descriptor ¶
func (RaftStatus) Descriptor() protoreflect.EnumDescriptor
func (RaftStatus) Enum ¶
func (x RaftStatus) Enum() *RaftStatus
func (RaftStatus) EnumDescriptor
deprecated
func (RaftStatus) EnumDescriptor() ([]byte, []int)
Deprecated: Use RaftStatus.Descriptor instead.
func (RaftStatus) Number ¶
func (x RaftStatus) Number() protoreflect.EnumNumber
func (RaftStatus) String ¶
func (x RaftStatus) String() string
func (RaftStatus) Type ¶
func (RaftStatus) Type() protoreflect.EnumType