Documentation ¶
Index ¶
- Variables
- type ConfChange
- func (*ConfChange) Descriptor() ([]byte, []int)
- func (m *ConfChange) GetChangeType() ConfChangeType
- func (m *ConfChange) GetContext() []byte
- func (m *ConfChange) GetId() uint64
- func (m *ConfChange) GetNodeId() uint64
- func (m *ConfChange) Marshal() (dAtA []byte, err error)
- func (m *ConfChange) MarshalTo(dAtA []byte) (int, error)
- func (m *ConfChange) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ConfChange) ProtoMessage()
- func (m *ConfChange) Reset()
- func (m *ConfChange) Size() (n int)
- func (m *ConfChange) String() string
- func (m *ConfChange) Unmarshal(dAtA []byte) error
- func (m *ConfChange) XXX_DiscardUnknown()
- func (m *ConfChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ConfChange) XXX_Merge(src proto.Message)
- func (m *ConfChange) XXX_Size() int
- func (m *ConfChange) XXX_Unmarshal(b []byte) error
- type ConfChangeSingle
- func (*ConfChangeSingle) Descriptor() ([]byte, []int)
- func (m *ConfChangeSingle) GetChangeType() ConfChangeType
- func (m *ConfChangeSingle) GetNodeId() uint64
- func (m *ConfChangeSingle) Marshal() (dAtA []byte, err error)
- func (m *ConfChangeSingle) MarshalTo(dAtA []byte) (int, error)
- func (m *ConfChangeSingle) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ConfChangeSingle) ProtoMessage()
- func (m *ConfChangeSingle) Reset()
- func (m *ConfChangeSingle) Size() (n int)
- func (m *ConfChangeSingle) String() string
- func (m *ConfChangeSingle) Unmarshal(dAtA []byte) error
- func (m *ConfChangeSingle) XXX_DiscardUnknown()
- func (m *ConfChangeSingle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ConfChangeSingle) XXX_Merge(src proto.Message)
- func (m *ConfChangeSingle) XXX_Size() int
- func (m *ConfChangeSingle) XXX_Unmarshal(b []byte) error
- type ConfChangeTransition
- type ConfChangeType
- type ConfChangeV2
- func (*ConfChangeV2) Descriptor() ([]byte, []int)
- func (m *ConfChangeV2) GetChanges() []*ConfChangeSingle
- func (m *ConfChangeV2) GetContext() []byte
- func (m *ConfChangeV2) GetTransition() ConfChangeTransition
- func (m *ConfChangeV2) Marshal() (dAtA []byte, err error)
- func (m *ConfChangeV2) MarshalTo(dAtA []byte) (int, error)
- func (m *ConfChangeV2) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ConfChangeV2) ProtoMessage()
- func (m *ConfChangeV2) Reset()
- func (m *ConfChangeV2) Size() (n int)
- func (m *ConfChangeV2) String() string
- func (m *ConfChangeV2) Unmarshal(dAtA []byte) error
- func (m *ConfChangeV2) XXX_DiscardUnknown()
- func (m *ConfChangeV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ConfChangeV2) XXX_Merge(src proto.Message)
- func (m *ConfChangeV2) XXX_Size() int
- func (m *ConfChangeV2) XXX_Unmarshal(b []byte) error
- type ConfState
- func (*ConfState) Descriptor() ([]byte, []int)
- func (m *ConfState) GetAutoLeave() bool
- func (m *ConfState) GetLearners() []uint64
- func (m *ConfState) GetLearnersNext() []uint64
- func (m *ConfState) GetVoters() []uint64
- func (m *ConfState) GetVotersOutgoing() []uint64
- func (m *ConfState) Marshal() (dAtA []byte, err error)
- func (m *ConfState) MarshalTo(dAtA []byte) (int, error)
- func (m *ConfState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ConfState) ProtoMessage()
- func (m *ConfState) Reset()
- func (m *ConfState) Size() (n int)
- func (m *ConfState) String() string
- func (m *ConfState) Unmarshal(dAtA []byte) error
- func (m *ConfState) XXX_DiscardUnknown()
- func (m *ConfState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ConfState) XXX_Merge(src proto.Message)
- func (m *ConfState) XXX_Size() int
- func (m *ConfState) XXX_Unmarshal(b []byte) error
- type Entry
- func (*Entry) Descriptor() ([]byte, []int)
- func (m *Entry) GetContext() []byte
- func (m *Entry) GetData() []byte
- func (m *Entry) GetEntryType() EntryType
- func (m *Entry) GetIndex() uint64
- func (m *Entry) GetSyncLog() bool
- func (m *Entry) GetTerm() uint64
- func (m *Entry) Marshal() (dAtA []byte, err error)
- func (m *Entry) MarshalTo(dAtA []byte) (int, error)
- func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Entry) ProtoMessage()
- func (m *Entry) Reset()
- func (m *Entry) Size() (n int)
- func (m *Entry) String() string
- func (m *Entry) Unmarshal(dAtA []byte) error
- func (m *Entry) XXX_DiscardUnknown()
- func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Entry) XXX_Merge(src proto.Message)
- func (m *Entry) XXX_Size() int
- func (m *Entry) XXX_Unmarshal(b []byte) error
- type EntryType
- type HardState
- func (*HardState) Descriptor() ([]byte, []int)
- func (m *HardState) GetCommit() uint64
- func (m *HardState) GetTerm() uint64
- func (m *HardState) GetVote() uint64
- func (m *HardState) Marshal() (dAtA []byte, err error)
- func (m *HardState) MarshalTo(dAtA []byte) (int, error)
- func (m *HardState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*HardState) ProtoMessage()
- func (m *HardState) Reset()
- func (m *HardState) Size() (n int)
- func (m *HardState) String() string
- func (m *HardState) Unmarshal(dAtA []byte) error
- func (m *HardState) XXX_DiscardUnknown()
- func (m *HardState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *HardState) XXX_Merge(src proto.Message)
- func (m *HardState) XXX_Size() int
- func (m *HardState) XXX_Unmarshal(b []byte) error
- type Message
- func (*Message) Descriptor() ([]byte, []int)
- func (m *Message) GetCommit() uint64
- func (m *Message) GetContext() []byte
- func (m *Message) GetEntries() []*Entry
- func (m *Message) GetFrom() uint64
- func (m *Message) GetIndex() uint64
- func (m *Message) GetLogTerm() uint64
- func (m *Message) GetMsgType() MessageType
- func (m *Message) GetPriority() uint64
- func (m *Message) GetReject() bool
- func (m *Message) GetRejectHint() uint64
- func (m *Message) GetRequestSnapshot() uint64
- func (m *Message) GetSnapshot() *Snapshot
- func (m *Message) GetTerm() uint64
- func (m *Message) GetTo() uint64
- func (m *Message) Marshal() (dAtA []byte, err error)
- func (m *Message) MarshalTo(dAtA []byte) (int, error)
- func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Message) ProtoMessage()
- func (m *Message) Reset()
- func (m *Message) Size() (n int)
- func (m *Message) String() string
- func (m *Message) Unmarshal(dAtA []byte) error
- func (m *Message) XXX_DiscardUnknown()
- func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Message) XXX_Merge(src proto.Message)
- func (m *Message) XXX_Size() int
- func (m *Message) XXX_Unmarshal(b []byte) error
- type MessageType
- type Snapshot
- func (*Snapshot) Descriptor() ([]byte, []int)
- func (m *Snapshot) GetData() []byte
- func (m *Snapshot) GetMetadata() *SnapshotMetadata
- func (m *Snapshot) Marshal() (dAtA []byte, err error)
- func (m *Snapshot) MarshalTo(dAtA []byte) (int, error)
- func (m *Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Snapshot) ProtoMessage()
- func (m *Snapshot) Reset()
- func (m *Snapshot) Size() (n int)
- func (m *Snapshot) String() string
- func (m *Snapshot) Unmarshal(dAtA []byte) error
- func (m *Snapshot) XXX_DiscardUnknown()
- func (m *Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Snapshot) XXX_Merge(src proto.Message)
- func (m *Snapshot) XXX_Size() int
- func (m *Snapshot) XXX_Unmarshal(b []byte) error
- type SnapshotMetadata
- func (*SnapshotMetadata) Descriptor() ([]byte, []int)
- func (m *SnapshotMetadata) GetConfState() *ConfState
- func (m *SnapshotMetadata) GetIndex() uint64
- func (m *SnapshotMetadata) GetTerm() uint64
- func (m *SnapshotMetadata) Marshal() (dAtA []byte, err error)
- func (m *SnapshotMetadata) MarshalTo(dAtA []byte) (int, error)
- func (m *SnapshotMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*SnapshotMetadata) ProtoMessage()
- func (m *SnapshotMetadata) Reset()
- func (m *SnapshotMetadata) Size() (n int)
- func (m *SnapshotMetadata) String() string
- func (m *SnapshotMetadata) Unmarshal(dAtA []byte) error
- func (m *SnapshotMetadata) XXX_DiscardUnknown()
- func (m *SnapshotMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SnapshotMetadata) XXX_Merge(src proto.Message)
- func (m *SnapshotMetadata) XXX_Size() int
- func (m *SnapshotMetadata) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthEraftpb = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowEraftpb = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupEraftpb = fmt.Errorf("proto: unexpected end of group") )
var ConfChangeTransition_name = map[int32]string{
0: "Auto",
1: "Implicit",
2: "Explicit",
}
var ConfChangeTransition_value = map[string]int32{
"Auto": 0,
"Implicit": 1,
"Explicit": 2,
}
var ConfChangeType_name = map[int32]string{
0: "AddNode",
1: "RemoveNode",
2: "AddLearnerNode",
}
var ConfChangeType_value = map[string]int32{
"AddNode": 0,
"RemoveNode": 1,
"AddLearnerNode": 2,
}
var EntryType_name = map[int32]string{
0: "EntryNormal",
1: "EntryConfChange",
2: "EntryConfChangeV2",
}
var EntryType_value = map[string]int32{
"EntryNormal": 0,
"EntryConfChange": 1,
"EntryConfChangeV2": 2,
}
var MessageType_name = map[int32]string{
0: "MsgHup",
1: "MsgBeat",
2: "MsgPropose",
3: "MsgAppend",
4: "MsgAppendResponse",
5: "MsgRequestVote",
6: "MsgRequestVoteResponse",
7: "MsgSnapshot",
8: "MsgHeartbeat",
9: "MsgHeartbeatResponse",
10: "MsgUnreachable",
11: "MsgSnapStatus",
12: "MsgCheckQuorum",
13: "MsgTransferLeader",
14: "MsgTimeoutNow",
15: "MsgReadIndex",
16: "MsgReadIndexResp",
17: "MsgRequestPreVote",
18: "MsgRequestPreVoteResponse",
}
var MessageType_value = map[string]int32{
"MsgHup": 0,
"MsgBeat": 1,
"MsgPropose": 2,
"MsgAppend": 3,
"MsgAppendResponse": 4,
"MsgRequestVote": 5,
"MsgRequestVoteResponse": 6,
"MsgSnapshot": 7,
"MsgHeartbeat": 8,
"MsgHeartbeatResponse": 9,
"MsgUnreachable": 10,
"MsgSnapStatus": 11,
"MsgCheckQuorum": 12,
"MsgTransferLeader": 13,
"MsgTimeoutNow": 14,
"MsgReadIndex": 15,
"MsgReadIndexResp": 16,
"MsgRequestPreVote": 17,
"MsgRequestPreVoteResponse": 18,
}
Functions ¶
This section is empty.
Types ¶
type ConfChange ¶
type ConfChange struct { ChangeType ConfChangeType `protobuf:"varint,2,opt,name=change_type,json=changeType,proto3,enum=eraftpb.ConfChangeType" json:"change_type,omitempty"` NodeId uint64 `protobuf:"varint,3,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` Context []byte `protobuf:"bytes,4,opt,name=context,proto3" json:"context,omitempty"` Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ConfChange) Descriptor ¶
func (*ConfChange) Descriptor() ([]byte, []int)
func (*ConfChange) GetChangeType ¶
func (m *ConfChange) GetChangeType() ConfChangeType
func (*ConfChange) GetContext ¶
func (m *ConfChange) GetContext() []byte
func (*ConfChange) GetId ¶
func (m *ConfChange) GetId() uint64
func (*ConfChange) GetNodeId ¶
func (m *ConfChange) GetNodeId() uint64
func (*ConfChange) Marshal ¶
func (m *ConfChange) Marshal() (dAtA []byte, err error)
func (*ConfChange) MarshalToSizedBuffer ¶
func (m *ConfChange) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ConfChange) ProtoMessage ¶
func (*ConfChange) ProtoMessage()
func (*ConfChange) Reset ¶
func (m *ConfChange) Reset()
func (*ConfChange) Size ¶
func (m *ConfChange) Size() (n int)
func (*ConfChange) String ¶
func (m *ConfChange) String() string
func (*ConfChange) Unmarshal ¶
func (m *ConfChange) Unmarshal(dAtA []byte) error
func (*ConfChange) XXX_DiscardUnknown ¶
func (m *ConfChange) XXX_DiscardUnknown()
func (*ConfChange) XXX_Marshal ¶
func (m *ConfChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ConfChange) XXX_Merge ¶
func (m *ConfChange) XXX_Merge(src proto.Message)
func (*ConfChange) XXX_Size ¶
func (m *ConfChange) XXX_Size() int
func (*ConfChange) XXX_Unmarshal ¶
func (m *ConfChange) XXX_Unmarshal(b []byte) error
type ConfChangeSingle ¶
type ConfChangeSingle struct { ChangeType ConfChangeType `protobuf:"varint,1,opt,name=change_type,json=changeType,proto3,enum=eraftpb.ConfChangeType" json:"change_type,omitempty"` NodeId uint64 `protobuf:"varint,2,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
ConfChangeSingle is an individual configuration change operation. Multiple such operations can be carried out atomically via a ConfChangeV2.
func (*ConfChangeSingle) Descriptor ¶
func (*ConfChangeSingle) Descriptor() ([]byte, []int)
func (*ConfChangeSingle) GetChangeType ¶
func (m *ConfChangeSingle) GetChangeType() ConfChangeType
func (*ConfChangeSingle) GetNodeId ¶
func (m *ConfChangeSingle) GetNodeId() uint64
func (*ConfChangeSingle) Marshal ¶
func (m *ConfChangeSingle) Marshal() (dAtA []byte, err error)
func (*ConfChangeSingle) MarshalToSizedBuffer ¶
func (m *ConfChangeSingle) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ConfChangeSingle) ProtoMessage ¶
func (*ConfChangeSingle) ProtoMessage()
func (*ConfChangeSingle) Reset ¶
func (m *ConfChangeSingle) Reset()
func (*ConfChangeSingle) Size ¶
func (m *ConfChangeSingle) Size() (n int)
func (*ConfChangeSingle) String ¶
func (m *ConfChangeSingle) String() string
func (*ConfChangeSingle) Unmarshal ¶
func (m *ConfChangeSingle) Unmarshal(dAtA []byte) error
func (*ConfChangeSingle) XXX_DiscardUnknown ¶
func (m *ConfChangeSingle) XXX_DiscardUnknown()
func (*ConfChangeSingle) XXX_Marshal ¶
func (m *ConfChangeSingle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ConfChangeSingle) XXX_Merge ¶
func (m *ConfChangeSingle) XXX_Merge(src proto.Message)
func (*ConfChangeSingle) XXX_Size ¶
func (m *ConfChangeSingle) XXX_Size() int
func (*ConfChangeSingle) XXX_Unmarshal ¶
func (m *ConfChangeSingle) XXX_Unmarshal(b []byte) error
type ConfChangeTransition ¶
type ConfChangeTransition int32
const ( // Automatically use the simple protocol if possible, otherwise fall back // to ConfChangeType::Implicit. Most applications will want to use this. ConfChangeTransition_Auto ConfChangeTransition = 0 // Use joint consensus unconditionally, and transition out of them // automatically (by proposing a zero configuration change). // // This option is suitable for applications that want to minimize the time // spent in the joint configuration and do not store the joint configuration // in the state machine (outside of InitialState). ConfChangeTransition_Implicit ConfChangeTransition = 1 // Use joint consensus and remain in the joint configuration until the // application proposes a no-op configuration change. This is suitable for // applications that want to explicitly control the transitions, for example // to use a custom payload (via the Context field). ConfChangeTransition_Explicit ConfChangeTransition = 2 )
func (ConfChangeTransition) EnumDescriptor ¶
func (ConfChangeTransition) EnumDescriptor() ([]byte, []int)
func (ConfChangeTransition) String ¶
func (x ConfChangeTransition) String() string
type ConfChangeType ¶
type ConfChangeType int32
const ( ConfChangeType_AddNode ConfChangeType = 0 ConfChangeType_RemoveNode ConfChangeType = 1 ConfChangeType_AddLearnerNode ConfChangeType = 2 )
func (ConfChangeType) EnumDescriptor ¶
func (ConfChangeType) EnumDescriptor() ([]byte, []int)
func (ConfChangeType) String ¶
func (x ConfChangeType) String() string
type ConfChangeV2 ¶
type ConfChangeV2 struct { Transition ConfChangeTransition `protobuf:"varint,1,opt,name=transition,proto3,enum=eraftpb.ConfChangeTransition" json:"transition,omitempty"` Changes []*ConfChangeSingle `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` Context []byte `protobuf:"bytes,3,opt,name=context,proto3" json:"context,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
ConfChangeV2 messages initiate configuration changes. They support both the simple "one at a time" membership change protocol and full Joint Consensus allowing for arbitrary changes in membership.
The supplied context is treated as an opaque payload and can be used to attach an action on the state machine to the application of the config change proposal. Note that contrary to Joint Consensus as outlined in the Raft paper1, configuration changes become active when they are *applied* to the state machine (not when they are appended to the log).
The simple protocol can be used whenever only a single change is made.
Non-simple changes require the use of Joint Consensus, for which two configuration changes are run. The first configuration change specifies the desired changes and transitions the Raft group into the joint configuration, in which quorum requires a majority of both the pre-changes and post-changes configuration. Joint Consensus avoids entering fragile intermediate configurations that could compromise survivability. For example, without the use of Joint Consensus and running across three availability zones with a replication factor of three, it is not possible to replace a voter without entering an intermediate configuration that does not survive the outage of one availability zone.
The provided ConfChangeTransition specifies how (and whether) Joint Consensus is used, and assigns the task of leaving the joint configuration either to Raft or the application. Leaving the joint configuration is accomplished by proposing a ConfChangeV2 with only and optionally the Context field populated.
For details on Raft membership changes, see:
func (*ConfChangeV2) Descriptor ¶
func (*ConfChangeV2) Descriptor() ([]byte, []int)
func (*ConfChangeV2) GetChanges ¶
func (m *ConfChangeV2) GetChanges() []*ConfChangeSingle
func (*ConfChangeV2) GetContext ¶
func (m *ConfChangeV2) GetContext() []byte
func (*ConfChangeV2) GetTransition ¶
func (m *ConfChangeV2) GetTransition() ConfChangeTransition
func (*ConfChangeV2) Marshal ¶
func (m *ConfChangeV2) Marshal() (dAtA []byte, err error)
func (*ConfChangeV2) MarshalToSizedBuffer ¶
func (m *ConfChangeV2) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ConfChangeV2) ProtoMessage ¶
func (*ConfChangeV2) ProtoMessage()
func (*ConfChangeV2) Reset ¶
func (m *ConfChangeV2) Reset()
func (*ConfChangeV2) Size ¶
func (m *ConfChangeV2) Size() (n int)
func (*ConfChangeV2) String ¶
func (m *ConfChangeV2) String() string
func (*ConfChangeV2) Unmarshal ¶
func (m *ConfChangeV2) Unmarshal(dAtA []byte) error
func (*ConfChangeV2) XXX_DiscardUnknown ¶
func (m *ConfChangeV2) XXX_DiscardUnknown()
func (*ConfChangeV2) XXX_Marshal ¶
func (m *ConfChangeV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ConfChangeV2) XXX_Merge ¶
func (m *ConfChangeV2) XXX_Merge(src proto.Message)
func (*ConfChangeV2) XXX_Size ¶
func (m *ConfChangeV2) XXX_Size() int
func (*ConfChangeV2) XXX_Unmarshal ¶
func (m *ConfChangeV2) XXX_Unmarshal(b []byte) error
type ConfState ¶
type ConfState struct { Voters []uint64 `protobuf:"varint,1,rep,packed,name=voters,proto3" json:"voters,omitempty"` Learners []uint64 `protobuf:"varint,2,rep,packed,name=learners,proto3" json:"learners,omitempty"` // The voters in the outgoing config. If not empty the node is in joint consensus. VotersOutgoing []uint64 `protobuf:"varint,3,rep,packed,name=voters_outgoing,json=votersOutgoing,proto3" json:"voters_outgoing,omitempty"` // The nodes that will become learners when the outgoing config is removed. // These nodes are necessarily currently in nodes_joint (or they would have // been added to the incoming config right away). LearnersNext []uint64 `protobuf:"varint,4,rep,packed,name=learners_next,json=learnersNext,proto3" json:"learners_next,omitempty"` // If set, the config is joint and Raft will automatically transition into // the final config (i.e. remove the outgoing config) when this is safe. AutoLeave bool `protobuf:"varint,5,opt,name=auto_leave,json=autoLeave,proto3" json:"auto_leave,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ConfState) Descriptor ¶
func (*ConfState) GetAutoLeave ¶
func (*ConfState) GetLearners ¶
func (*ConfState) GetLearnersNext ¶
func (*ConfState) GetVotersOutgoing ¶
func (*ConfState) MarshalToSizedBuffer ¶
func (*ConfState) ProtoMessage ¶
func (*ConfState) ProtoMessage()
func (*ConfState) XXX_DiscardUnknown ¶
func (m *ConfState) XXX_DiscardUnknown()
func (*ConfState) XXX_Marshal ¶
func (*ConfState) XXX_Unmarshal ¶
type Entry ¶
type Entry struct { EntryType EntryType `protobuf:"varint,1,opt,name=entry_type,json=entryType,proto3,enum=eraftpb.EntryType" json:"entry_type,omitempty"` Term uint64 `protobuf:"varint,2,opt,name=term,proto3" json:"term,omitempty"` Index uint64 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` Context []byte `protobuf:"bytes,6,opt,name=context,proto3" json:"context,omitempty"` // Deprecated! It is kept for backward compatibility. // TODO: remove it in the next major release. SyncLog bool `protobuf:"varint,5,opt,name=sync_log,json=syncLog,proto3" json:"sync_log,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
The entry is a type of change that needs to be applied. It contains two data fields. While the fields are built into the model; their usage is determined by the entry_type.
For normal entries, the data field should contain the data change that should be applied. The context field can be used for any contextual data that might be relevant to the application of the data.
For configuration changes, the data will contain the ConfChange message and the context will provide anything needed to assist the configuration change. The context if for the user to set and use in this case.
func (*Entry) Descriptor ¶
func (*Entry) GetContext ¶
func (*Entry) GetEntryType ¶
func (*Entry) GetSyncLog ¶
func (*Entry) ProtoMessage ¶
func (*Entry) ProtoMessage()
func (*Entry) XXX_DiscardUnknown ¶
func (m *Entry) XXX_DiscardUnknown()
func (*Entry) XXX_Marshal ¶
func (*Entry) XXX_Unmarshal ¶
type HardState ¶
type HardState struct { Term uint64 `protobuf:"varint,1,opt,name=term,proto3" json:"term,omitempty"` Vote uint64 `protobuf:"varint,2,opt,name=vote,proto3" json:"vote,omitempty"` Commit uint64 `protobuf:"varint,3,opt,name=commit,proto3" json:"commit,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*HardState) Descriptor ¶
func (*HardState) MarshalToSizedBuffer ¶
func (*HardState) ProtoMessage ¶
func (*HardState) ProtoMessage()
func (*HardState) XXX_DiscardUnknown ¶
func (m *HardState) XXX_DiscardUnknown()
func (*HardState) XXX_Marshal ¶
func (*HardState) XXX_Unmarshal ¶
type Message ¶
type Message struct { MsgType MessageType `protobuf:"varint,1,opt,name=msg_type,json=msgType,proto3,enum=eraftpb.MessageType" json:"msg_type,omitempty"` To uint64 `protobuf:"varint,2,opt,name=to,proto3" json:"to,omitempty"` From uint64 `protobuf:"varint,3,opt,name=from,proto3" json:"from,omitempty"` Term uint64 `protobuf:"varint,4,opt,name=term,proto3" json:"term,omitempty"` LogTerm uint64 `protobuf:"varint,5,opt,name=log_term,json=logTerm,proto3" json:"log_term,omitempty"` Index uint64 `protobuf:"varint,6,opt,name=index,proto3" json:"index,omitempty"` Entries []*Entry `protobuf:"bytes,7,rep,name=entries,proto3" json:"entries,omitempty"` Commit uint64 `protobuf:"varint,8,opt,name=commit,proto3" json:"commit,omitempty"` Snapshot *Snapshot `protobuf:"bytes,9,opt,name=snapshot,proto3" json:"snapshot,omitempty"` RequestSnapshot uint64 `protobuf:"varint,13,opt,name=request_snapshot,json=requestSnapshot,proto3" json:"request_snapshot,omitempty"` Reject bool `protobuf:"varint,10,opt,name=reject,proto3" json:"reject,omitempty"` RejectHint uint64 `protobuf:"varint,11,opt,name=reject_hint,json=rejectHint,proto3" json:"reject_hint,omitempty"` Context []byte `protobuf:"bytes,12,opt,name=context,proto3" json:"context,omitempty"` Priority uint64 `protobuf:"varint,14,opt,name=priority,proto3" json:"priority,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Message) Descriptor ¶
func (*Message) GetContext ¶
func (*Message) GetEntries ¶
func (*Message) GetLogTerm ¶
func (*Message) GetMsgType ¶
func (m *Message) GetMsgType() MessageType
func (*Message) GetPriority ¶
func (*Message) GetRejectHint ¶
func (*Message) GetRequestSnapshot ¶
func (*Message) GetSnapshot ¶
func (*Message) MarshalToSizedBuffer ¶
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) XXX_DiscardUnknown ¶
func (m *Message) XXX_DiscardUnknown()
func (*Message) XXX_Marshal ¶
func (*Message) XXX_Unmarshal ¶
type MessageType ¶
type MessageType int32
const ( MessageType_MsgHup MessageType = 0 MessageType_MsgBeat MessageType = 1 MessageType_MsgPropose MessageType = 2 MessageType_MsgAppend MessageType = 3 MessageType_MsgAppendResponse MessageType = 4 MessageType_MsgRequestVote MessageType = 5 MessageType_MsgRequestVoteResponse MessageType = 6 MessageType_MsgSnapshot MessageType = 7 MessageType_MsgHeartbeat MessageType = 8 MessageType_MsgHeartbeatResponse MessageType = 9 MessageType_MsgUnreachable MessageType = 10 MessageType_MsgSnapStatus MessageType = 11 MessageType_MsgCheckQuorum MessageType = 12 MessageType_MsgTransferLeader MessageType = 13 MessageType_MsgTimeoutNow MessageType = 14 MessageType_MsgReadIndex MessageType = 15 MessageType_MsgReadIndexResp MessageType = 16 MessageType_MsgRequestPreVote MessageType = 17 MessageType_MsgRequestPreVoteResponse MessageType = 18 )
func (MessageType) EnumDescriptor ¶
func (MessageType) EnumDescriptor() ([]byte, []int)
func (MessageType) String ¶
func (x MessageType) String() string
type Snapshot ¶
type Snapshot struct { Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` Metadata *SnapshotMetadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Snapshot) Descriptor ¶
func (*Snapshot) GetMetadata ¶
func (m *Snapshot) GetMetadata() *SnapshotMetadata
func (*Snapshot) MarshalToSizedBuffer ¶
func (*Snapshot) ProtoMessage ¶
func (*Snapshot) ProtoMessage()
func (*Snapshot) XXX_DiscardUnknown ¶
func (m *Snapshot) XXX_DiscardUnknown()
func (*Snapshot) XXX_Marshal ¶
func (*Snapshot) XXX_Unmarshal ¶
type SnapshotMetadata ¶
type SnapshotMetadata struct { // The current `ConfState`. ConfState *ConfState `protobuf:"bytes,1,opt,name=conf_state,json=confState,proto3" json:"conf_state,omitempty"` // The applied index. Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` // The term of the applied index. Term uint64 `protobuf:"varint,3,opt,name=term,proto3" json:"term,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SnapshotMetadata) Descriptor ¶
func (*SnapshotMetadata) Descriptor() ([]byte, []int)
func (*SnapshotMetadata) GetConfState ¶
func (m *SnapshotMetadata) GetConfState() *ConfState
func (*SnapshotMetadata) GetIndex ¶
func (m *SnapshotMetadata) GetIndex() uint64
func (*SnapshotMetadata) GetTerm ¶
func (m *SnapshotMetadata) GetTerm() uint64
func (*SnapshotMetadata) Marshal ¶
func (m *SnapshotMetadata) Marshal() (dAtA []byte, err error)
func (*SnapshotMetadata) MarshalToSizedBuffer ¶
func (m *SnapshotMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*SnapshotMetadata) ProtoMessage ¶
func (*SnapshotMetadata) ProtoMessage()
func (*SnapshotMetadata) Reset ¶
func (m *SnapshotMetadata) Reset()
func (*SnapshotMetadata) Size ¶
func (m *SnapshotMetadata) Size() (n int)
func (*SnapshotMetadata) String ¶
func (m *SnapshotMetadata) String() string
func (*SnapshotMetadata) Unmarshal ¶
func (m *SnapshotMetadata) Unmarshal(dAtA []byte) error
func (*SnapshotMetadata) XXX_DiscardUnknown ¶
func (m *SnapshotMetadata) XXX_DiscardUnknown()
func (*SnapshotMetadata) XXX_Marshal ¶
func (m *SnapshotMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SnapshotMetadata) XXX_Merge ¶
func (m *SnapshotMetadata) XXX_Merge(src proto.Message)
func (*SnapshotMetadata) XXX_Size ¶
func (m *SnapshotMetadata) XXX_Size() int
func (*SnapshotMetadata) XXX_Unmarshal ¶
func (m *SnapshotMetadata) XXX_Unmarshal(b []byte) error