raftpb

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package raftpb contains definitions of Raft internal structs, states and messages that are not visible to typical dragonboat applications. It is required when building your customized LogDB and Raft RPC modules. You can safely ignore this package when building dragonboat applications.

Index

Constants

View Source
const (
	// RaftEntryEncodingScheme is the scheme name of the codec.
	RaftEntryEncodingScheme = "colfer"
)

Variables

View Source
var (
	ErrInvalidLengthRaft = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRaft   = fmt.Errorf("proto: integer overflow")
)
View Source
var ChecksumType_name = map[int32]string{
	0: "CRC32IEEE",
	1: "HIGHWAY",
}
View Source
var ChecksumType_value = map[string]int32{
	"CRC32IEEE": 0,
	"HIGHWAY":   1,
}
View Source
var (
	// ColferSizeMax is the upper limit for serial byte sizes.
	ColferSizeMax = 256 * 1024 * 1024
)

Colfer configuration attributes

View Source
var ConfigChangeType_name = map[int32]string{
	0: "AddNode",
	1: "RemoveNode",
	2: "AddObserver",
}
View Source
var ConfigChangeType_value = map[string]int32{
	"AddNode":     0,
	"RemoveNode":  1,
	"AddObserver": 2,
}
View Source
var EntryType_name = map[int32]string{
	0: "ApplicationEntry",
	1: "ConfigChangeEntry",
}
View Source
var EntryType_value = map[string]int32{
	"ApplicationEntry":  0,
	"ConfigChangeEntry": 1,
}
View Source
var MessageType_name = map[int32]string{
	0:  "LocalTick",
	1:  "Election",
	2:  "LeaderHeartbeat",
	3:  "ConfigChangeEvent",
	4:  "NoOP",
	5:  "Ping",
	6:  "Pong",
	7:  "Propose",
	8:  "SnapshotStatus",
	9:  "Unreachable",
	10: "CheckQuorum",
	11: "BatchedReadIndex",
	12: "Replicate",
	13: "ReplicateResp",
	14: "RequestVote",
	15: "RequestVoteResp",
	16: "InstallSnapshot",
	17: "Heartbeat",
	18: "HeartbeatResp",
	19: "ReadIndex",
	20: "ReadIndexResp",
	21: "Quiesce",
	22: "SnapshotReceived",
	23: "LeaderTransfer",
	24: "TimeoutNow",
}
View Source
var MessageType_value = map[string]int32{
	"LocalTick":         0,
	"Election":          1,
	"LeaderHeartbeat":   2,
	"ConfigChangeEvent": 3,
	"NoOP":              4,
	"Ping":              5,
	"Pong":              6,
	"Propose":           7,
	"SnapshotStatus":    8,
	"Unreachable":       9,
	"CheckQuorum":       10,
	"BatchedReadIndex":  11,
	"Replicate":         12,
	"ReplicateResp":     13,
	"RequestVote":       14,
	"RequestVoteResp":   15,
	"InstallSnapshot":   16,
	"Heartbeat":         17,
	"HeartbeatResp":     18,
	"ReadIndex":         19,
	"ReadIndexResp":     20,
	"Quiesce":           21,
	"SnapshotReceived":  22,
	"LeaderTransfer":    23,
	"TimeoutNow":        24,
}

Functions

func IsEmptySnapshot

func IsEmptySnapshot(s Snapshot) bool

IsEmptySnapshot returns a boolean flag indicating whether the given snapshot is and empty dummy record.

func IsEmptyState

func IsEmptyState(st State) bool

IsEmptyState returns a boolean flag indicating whether the given State is empty.

func IsStateEqual

func IsStateEqual(a State, b State) bool

IsStateEqual returns whether two input state instances are equal.

Types

type Bootstrap

type Bootstrap struct {
	Addresses map[uint64]string `` /* 139-byte string literal not displayed */
	Join      bool              `protobuf:"varint,2,opt,name=join" json:"join"`
}

func (*Bootstrap) Descriptor

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

func (*Bootstrap) GetAddresses

func (m *Bootstrap) GetAddresses() map[uint64]string

func (*Bootstrap) GetJoin

func (m *Bootstrap) GetJoin() bool

func (*Bootstrap) Marshal

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

func (*Bootstrap) MarshalTo

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

func (*Bootstrap) ProtoMessage

func (*Bootstrap) ProtoMessage()

func (*Bootstrap) Reset

func (m *Bootstrap) Reset()

func (*Bootstrap) Size

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

func (*Bootstrap) String

func (m *Bootstrap) String() string

func (*Bootstrap) Unmarshal

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

func (*Bootstrap) Validate

func (b *Bootstrap) Validate(nodes map[uint64]string, join bool) bool

Validate checks whether the incoming nodes parameter and the join flag is valid given the recorded bootstrap infomration in Log DB.

func (*Bootstrap) XXX_DiscardUnknown

func (m *Bootstrap) XXX_DiscardUnknown()

func (*Bootstrap) XXX_Marshal

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

func (*Bootstrap) XXX_Merge

func (dst *Bootstrap) XXX_Merge(src proto.Message)

func (*Bootstrap) XXX_Size

func (m *Bootstrap) XXX_Size() int

func (*Bootstrap) XXX_Unmarshal

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

type ChecksumType

type ChecksumType int32
const (
	CRC32IEEE ChecksumType = 0
	HIGHWAY   ChecksumType = 1
)

func (ChecksumType) Enum

func (x ChecksumType) Enum() *ChecksumType

func (ChecksumType) EnumDescriptor

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

func (ChecksumType) String

func (x ChecksumType) String() string

func (*ChecksumType) UnmarshalJSON

func (x *ChecksumType) UnmarshalJSON(data []byte) error

type ColferError

type ColferError int

ColferError signals a data mismatch as as a byte index.

func (ColferError) Error

func (i ColferError) Error() string

Error honors the error interface.

type ColferMax

type ColferMax string

ColferMax signals an upper limit breach.

func (ColferMax) Error

func (m ColferMax) Error() string

Error honors the error interface.

type ColferTail

type ColferTail int

ColferTail signals data continuation as a byte index.

func (ColferTail) Error

func (i ColferTail) Error() string

Error honors the error interface.

type ConfigChange

type ConfigChange struct {
	ConfigChangeId uint64           `protobuf:"varint,1,opt,name=config_change_id,json=configChangeId" json:"config_change_id"`
	Type           ConfigChangeType `protobuf:"varint,2,opt,name=Type,enum=raftpb.ConfigChangeType" json:"Type"`
	NodeID         uint64           `protobuf:"varint,3,opt,name=NodeID" json:"NodeID"`
	Address        string           `protobuf:"bytes,4,opt,name=Address" json:"Address"`
	Initialize     bool             `protobuf:"varint,5,opt,name=Initialize" json:"Initialize"`
}

func (*ConfigChange) Descriptor

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

func (*ConfigChange) GetAddress

func (m *ConfigChange) GetAddress() string

func (*ConfigChange) GetConfigChangeId

func (m *ConfigChange) GetConfigChangeId() uint64

func (*ConfigChange) GetInitialize

func (m *ConfigChange) GetInitialize() bool

func (*ConfigChange) GetNodeID

func (m *ConfigChange) GetNodeID() uint64

func (*ConfigChange) GetType

func (m *ConfigChange) GetType() ConfigChangeType

func (*ConfigChange) Marshal

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

func (*ConfigChange) MarshalTo

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

func (*ConfigChange) ProtoMessage

func (*ConfigChange) ProtoMessage()

func (*ConfigChange) Reset

func (m *ConfigChange) Reset()

func (*ConfigChange) Size

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

func (*ConfigChange) String

func (m *ConfigChange) String() string

func (*ConfigChange) Unmarshal

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

func (*ConfigChange) XXX_DiscardUnknown

func (m *ConfigChange) XXX_DiscardUnknown()

func (*ConfigChange) XXX_Marshal

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

func (*ConfigChange) XXX_Merge

func (dst *ConfigChange) XXX_Merge(src proto.Message)

func (*ConfigChange) XXX_Size

func (m *ConfigChange) XXX_Size() int

func (*ConfigChange) XXX_Unmarshal

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

type ConfigChangeType

type ConfigChangeType int32
const (
	AddNode     ConfigChangeType = 0
	RemoveNode  ConfigChangeType = 1
	AddObserver ConfigChangeType = 2
)

func (ConfigChangeType) Enum

func (ConfigChangeType) EnumDescriptor

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

func (ConfigChangeType) String

func (x ConfigChangeType) String() string

func (*ConfigChangeType) UnmarshalJSON

func (x *ConfigChangeType) UnmarshalJSON(data []byte) error

type Entry

type Entry struct {
	Term        uint64    `protobuf:"varint,1,opt,name=Term" json:"Term"`
	Index       uint64    `protobuf:"varint,2,opt,name=Index" json:"Index"`
	Type        EntryType `protobuf:"varint,3,opt,name=Type,enum=raftpb.EntryType" json:"Type"`
	Key         uint64    `protobuf:"varint,4,opt,name=Key" json:"Key"`
	ClientID    uint64    `protobuf:"varint,5,opt,name=ClientID" json:"ClientID"`
	SeriesID    uint64    `protobuf:"varint,6,opt,name=SeriesID" json:"SeriesID"`
	RespondedTo uint64    `protobuf:"varint,7,opt,name=RespondedTo" json:"RespondedTo"`
	Cmd         []byte    `protobuf:"bytes,8,opt,name=Cmd" json:"Cmd"`
}

func (*Entry) Descriptor

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

func (*Entry) GetClientID

func (m *Entry) GetClientID() uint64

func (*Entry) GetCmd

func (m *Entry) GetCmd() []byte

func (*Entry) GetIndex

func (m *Entry) GetIndex() uint64

func (*Entry) GetKey

func (m *Entry) GetKey() uint64

func (*Entry) GetRespondedTo

func (m *Entry) GetRespondedTo() uint64

func (*Entry) GetSeriesID

func (m *Entry) GetSeriesID() uint64

func (*Entry) GetTerm

func (m *Entry) GetTerm() uint64

func (*Entry) GetType

func (m *Entry) GetType() EntryType

func (*Entry) IsConfigChange

func (e *Entry) IsConfigChange() bool

IsConfigChange returns a boolean value indicating whether the entry is for config change.

func (*Entry) IsEmpty

func (e *Entry) IsEmpty() bool

IsEmpty returns a boolean value indicating whether the entry is Empty.

func (*Entry) IsEndOfSessionRequest

func (e *Entry) IsEndOfSessionRequest() bool

IsEndOfSessionRequest returns a boolean value indicating whether the entry is for requesting the session to come to an end.

func (*Entry) IsNewSessionRequest

func (e *Entry) IsNewSessionRequest() bool

IsNewSessionRequest returns a boolean value indicating whether the entry is for reqeusting a new client.

func (*Entry) IsNoOPSession

func (e *Entry) IsNoOPSession() bool

IsNoOPSession returns a boolean value indicating whether the entry is NoOP session managed.

func (*Entry) IsSessionManaged

func (e *Entry) IsSessionManaged() bool

IsSessionManaged returns a boolean value indicating whether the entry is session managed.

func (*Entry) IsUpdateEntry

func (e *Entry) IsUpdateEntry() bool

IsUpdateEntry returns a boolean flag indicating whether the entry is a regular application entry not used for session management.

func (*Entry) Marshal

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

func (*Entry) MarshalTo

func (o *Entry) MarshalTo(buf []byte) (int, error)

MarshalTo marshals the entry to the specified byte slice.

func (*Entry) ProtoMessage

func (*Entry) ProtoMessage()

func (*Entry) Reset

func (m *Entry) Reset()

func (*Entry) Size

func (o *Entry) Size() int

Size returns the actual size of an entry

func (*Entry) SizeUpperLimit

func (o *Entry) SizeUpperLimit() int

SizeUpperLimit returns the upper limit size of an entry.

func (*Entry) String

func (m *Entry) String() string

func (*Entry) Unmarshal

func (o *Entry) Unmarshal(data []byte) error

Unmarshal unmarshals the input to the current entry instance.

func (*Entry) XXX_DiscardUnknown

func (m *Entry) XXX_DiscardUnknown()

func (*Entry) XXX_Marshal

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

func (*Entry) XXX_Merge

func (dst *Entry) XXX_Merge(src proto.Message)

func (*Entry) XXX_Size

func (m *Entry) XXX_Size() int

func (*Entry) XXX_Unmarshal

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

type EntryBatch

type EntryBatch struct {
	Entries []Entry `protobuf:"bytes,1,rep,name=entries" json:"entries"`
}

func (*EntryBatch) Descriptor

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

func (*EntryBatch) GetEntries

func (m *EntryBatch) GetEntries() []Entry

func (*EntryBatch) Marshal

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

func (*EntryBatch) MarshalTo

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

func (*EntryBatch) ProtoMessage

func (*EntryBatch) ProtoMessage()

func (*EntryBatch) Reset

func (m *EntryBatch) Reset()

func (*EntryBatch) Size

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

func (*EntryBatch) SizeUpperLimit

func (m *EntryBatch) SizeUpperLimit() (n int)

SizeUpperLimit returns the upper limit size of the entry batch.

func (*EntryBatch) String

func (m *EntryBatch) String() string

func (*EntryBatch) Unmarshal

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

func (*EntryBatch) XXX_DiscardUnknown

func (m *EntryBatch) XXX_DiscardUnknown()

func (*EntryBatch) XXX_Marshal

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

func (*EntryBatch) XXX_Merge

func (dst *EntryBatch) XXX_Merge(src proto.Message)

func (*EntryBatch) XXX_Size

func (m *EntryBatch) XXX_Size() int

func (*EntryBatch) XXX_Unmarshal

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

type EntryType

type EntryType int32
const (
	ApplicationEntry  EntryType = 0
	ConfigChangeEntry EntryType = 1
)

func (EntryType) Enum

func (x EntryType) Enum() *EntryType

func (EntryType) EnumDescriptor

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

func (EntryType) String

func (x EntryType) String() string

func (*EntryType) UnmarshalJSON

func (x *EntryType) UnmarshalJSON(data []byte) error

type Membership

type Membership struct {
	ConfigChangeId uint64            `protobuf:"varint,1,opt,name=config_change_id,json=configChangeId" json:"config_change_id"`
	Addresses      map[uint64]string `` /* 139-byte string literal not displayed */
	Removed        map[uint64]bool   `` /* 136-byte string literal not displayed */
	Observers      map[uint64]string `` /* 139-byte string literal not displayed */
}

func (*Membership) Descriptor

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

func (*Membership) GetAddresses

func (m *Membership) GetAddresses() map[uint64]string

func (*Membership) GetConfigChangeId

func (m *Membership) GetConfigChangeId() uint64

func (*Membership) GetObservers

func (m *Membership) GetObservers() map[uint64]string

func (*Membership) GetRemoved

func (m *Membership) GetRemoved() map[uint64]bool

func (*Membership) Marshal

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

func (*Membership) MarshalTo

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

func (*Membership) ProtoMessage

func (*Membership) ProtoMessage()

func (*Membership) Reset

func (m *Membership) Reset()

func (*Membership) Size

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

func (*Membership) String

func (m *Membership) String() string

func (*Membership) Unmarshal

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

func (*Membership) XXX_DiscardUnknown

func (m *Membership) XXX_DiscardUnknown()

func (*Membership) XXX_Marshal

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

func (*Membership) XXX_Merge

func (dst *Membership) XXX_Merge(src proto.Message)

func (*Membership) XXX_Size

func (m *Membership) XXX_Size() int

func (*Membership) XXX_Unmarshal

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

type Message

type Message struct {
	Type      MessageType `protobuf:"varint,1,opt,name=type,enum=raftpb.MessageType" json:"type"`
	To        uint64      `protobuf:"varint,2,opt,name=to" json:"to"`
	From      uint64      `protobuf:"varint,3,opt,name=from" json:"from"`
	ClusterId uint64      `protobuf:"varint,4,opt,name=cluster_id,json=clusterId" json:"cluster_id"`
	Term      uint64      `protobuf:"varint,5,opt,name=term" json:"term"`
	LogTerm   uint64      `protobuf:"varint,6,opt,name=log_term,json=logTerm" json:"log_term"`
	LogIndex  uint64      `protobuf:"varint,7,opt,name=log_index,json=logIndex" json:"log_index"`
	Commit    uint64      `protobuf:"varint,8,opt,name=commit" json:"commit"`
	Reject    bool        `protobuf:"varint,9,opt,name=reject" json:"reject"`
	Hint      uint64      `protobuf:"varint,10,opt,name=hint" json:"hint"`
	Entries   []Entry     `protobuf:"bytes,11,rep,name=entries" json:"entries"`
	Snapshot  Snapshot    `protobuf:"bytes,12,opt,name=snapshot" json:"snapshot"`
	HintHigh  uint64      `protobuf:"varint,13,opt,name=hint_high,json=hintHigh" json:"hint_high"`
}

func (*Message) Descriptor

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

func (*Message) GetClusterId

func (m *Message) GetClusterId() uint64

func (*Message) GetCommit

func (m *Message) GetCommit() uint64

func (*Message) GetEntries

func (m *Message) GetEntries() []Entry

func (*Message) GetFrom

func (m *Message) GetFrom() uint64

func (*Message) GetHint

func (m *Message) GetHint() uint64

func (*Message) GetHintHigh

func (m *Message) GetHintHigh() uint64

func (*Message) GetLogIndex

func (m *Message) GetLogIndex() uint64

func (*Message) GetLogTerm

func (m *Message) GetLogTerm() uint64

func (*Message) GetReject

func (m *Message) GetReject() bool

func (*Message) GetSnapshot

func (m *Message) GetSnapshot() Snapshot

func (*Message) GetTerm

func (m *Message) GetTerm() uint64

func (*Message) GetTo

func (m *Message) GetTo() uint64

func (*Message) GetType

func (m *Message) GetType() MessageType

func (*Message) Marshal

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

func (*Message) MarshalTo

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

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) Reset

func (m *Message) Reset()

func (*Message) Size

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

func (*Message) SizeUpperLimit

func (m *Message) SizeUpperLimit() int

SizeUpperLimit returns the upper limit size of the message.

func (*Message) String

func (m *Message) String() string

func (*Message) Unmarshal

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

Unmarshal unmarshals the message instance using the input byte slice.

func (*Message) XXX_DiscardUnknown

func (m *Message) XXX_DiscardUnknown()

func (*Message) XXX_Marshal

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

func (*Message) XXX_Merge

func (dst *Message) XXX_Merge(src proto.Message)

func (*Message) XXX_Size

func (m *Message) XXX_Size() int

func (*Message) XXX_Unmarshal

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

type MessageBatch

type MessageBatch struct {
	Requests      []Message `protobuf:"bytes,1,rep,name=requests" json:"requests"`
	DeploymentId  uint64    `protobuf:"varint,2,opt,name=deployment_id,json=deploymentId" json:"deployment_id"`
	SourceAddress string    `protobuf:"bytes,3,opt,name=source_address,json=sourceAddress" json:"source_address"`
	BinVer        uint32    `protobuf:"varint,4,opt,name=bin_ver,json=binVer" json:"bin_ver"`
}

func (*MessageBatch) Descriptor

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

func (*MessageBatch) GetBinVer

func (m *MessageBatch) GetBinVer() uint32

func (*MessageBatch) GetDeploymentId

func (m *MessageBatch) GetDeploymentId() uint64

func (*MessageBatch) GetRequests

func (m *MessageBatch) GetRequests() []Message

func (*MessageBatch) GetSourceAddress

func (m *MessageBatch) GetSourceAddress() string

func (*MessageBatch) Marshal

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

func (*MessageBatch) MarshalTo

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

func (*MessageBatch) ProtoMessage

func (*MessageBatch) ProtoMessage()

func (*MessageBatch) Reset

func (m *MessageBatch) Reset()

func (*MessageBatch) Size

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

func (*MessageBatch) SizeUpperLimit

func (m *MessageBatch) SizeUpperLimit() int

SizeUpperLimit returns the upper limit size of the message batch.

func (*MessageBatch) String

func (m *MessageBatch) String() string

func (*MessageBatch) Unmarshal

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

Unmarshal unmarshals the message batch instance using the input byte slice.

func (*MessageBatch) XXX_DiscardUnknown

func (m *MessageBatch) XXX_DiscardUnknown()

func (*MessageBatch) XXX_Marshal

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

func (*MessageBatch) XXX_Merge

func (dst *MessageBatch) XXX_Merge(src proto.Message)

func (*MessageBatch) XXX_Size

func (m *MessageBatch) XXX_Size() int

func (*MessageBatch) XXX_Unmarshal

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

type MessageType

type MessageType int32
const (
	LocalTick         MessageType = 0
	Election          MessageType = 1
	LeaderHeartbeat   MessageType = 2
	ConfigChangeEvent MessageType = 3
	NoOP              MessageType = 4
	Ping              MessageType = 5
	Pong              MessageType = 6
	Propose           MessageType = 7
	SnapshotStatus    MessageType = 8
	Unreachable       MessageType = 9
	CheckQuorum       MessageType = 10
	BatchedReadIndex  MessageType = 11
	Replicate         MessageType = 12
	ReplicateResp     MessageType = 13
	RequestVote       MessageType = 14
	RequestVoteResp   MessageType = 15
	InstallSnapshot   MessageType = 16
	Heartbeat         MessageType = 17
	HeartbeatResp     MessageType = 18
	ReadIndex         MessageType = 19
	ReadIndexResp     MessageType = 20
	Quiesce           MessageType = 21
	SnapshotReceived  MessageType = 22
	LeaderTransfer    MessageType = 23
	TimeoutNow        MessageType = 24
)

func (MessageType) Enum

func (x MessageType) Enum() *MessageType

func (MessageType) EnumDescriptor

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

func (MessageType) String

func (x MessageType) String() string

func (*MessageType) UnmarshalJSON

func (x *MessageType) UnmarshalJSON(data []byte) error

type RaftDataStatus

type RaftDataStatus struct {
	Address  string `protobuf:"bytes,1,opt,name=address" json:"address"`
	BinVer   uint32 `protobuf:"varint,2,opt,name=bin_ver,json=binVer" json:"bin_ver"`
	HardHash uint64 `protobuf:"varint,3,opt,name=hard_hash,json=hardHash" json:"hard_hash"`
}

func (*RaftDataStatus) Descriptor

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

func (*RaftDataStatus) GetAddress

func (m *RaftDataStatus) GetAddress() string

func (*RaftDataStatus) GetBinVer

func (m *RaftDataStatus) GetBinVer() uint32

func (*RaftDataStatus) GetHardHash

func (m *RaftDataStatus) GetHardHash() uint64

func (*RaftDataStatus) Marshal

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

func (*RaftDataStatus) MarshalTo

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

func (*RaftDataStatus) ProtoMessage

func (*RaftDataStatus) ProtoMessage()

func (*RaftDataStatus) Reset

func (m *RaftDataStatus) Reset()

func (*RaftDataStatus) Size

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

func (*RaftDataStatus) String

func (m *RaftDataStatus) String() string

func (*RaftDataStatus) Unmarshal

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

func (*RaftDataStatus) XXX_DiscardUnknown

func (m *RaftDataStatus) XXX_DiscardUnknown()

func (*RaftDataStatus) XXX_Marshal

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

func (*RaftDataStatus) XXX_Merge

func (dst *RaftDataStatus) XXX_Merge(src proto.Message)

func (*RaftDataStatus) XXX_Size

func (m *RaftDataStatus) XXX_Size() int

func (*RaftDataStatus) XXX_Unmarshal

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

type ReadyToRead

type ReadyToRead struct {
	Index     uint64
	SystemCtx SystemCtx
}

ReadyToRead is used to indicate that a previous batch of ReadIndex requests are now ready for read once the entry specified by the Index value is applied in the state machine.

type Response

type Response struct {
}

dummy message used by grpc

func (*Response) Descriptor

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

func (*Response) Marshal

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

func (*Response) MarshalTo

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

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) Size

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

func (*Response) String

func (m *Response) String() string

func (*Response) Unmarshal

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

func (*Response) XXX_DiscardUnknown

func (m *Response) XXX_DiscardUnknown()

func (*Response) XXX_Marshal

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

func (*Response) XXX_Merge

func (dst *Response) XXX_Merge(src proto.Message)

func (*Response) XXX_Size

func (m *Response) XXX_Size() int

func (*Response) XXX_Unmarshal

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

type Snapshot

type Snapshot struct {
	Filepath   string          `protobuf:"bytes,2,opt,name=filepath" json:"filepath"`
	FileSize   uint64          `protobuf:"varint,3,opt,name=file_size,json=fileSize" json:"file_size"`
	Index      uint64          `protobuf:"varint,4,opt,name=index" json:"index"`
	Term       uint64          `protobuf:"varint,5,opt,name=term" json:"term"`
	Membership Membership      `protobuf:"bytes,6,opt,name=membership" json:"membership"`
	Files      []*SnapshotFile `protobuf:"bytes,7,rep,name=files" json:"files,omitempty"`
}

field id 1 was used for optional string filename

func (*Snapshot) Descriptor

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

func (*Snapshot) GetFileSize

func (m *Snapshot) GetFileSize() uint64

func (*Snapshot) GetFilepath

func (m *Snapshot) GetFilepath() string

func (*Snapshot) GetFiles

func (m *Snapshot) GetFiles() []*SnapshotFile

func (*Snapshot) GetIndex

func (m *Snapshot) GetIndex() uint64

func (*Snapshot) GetMembership

func (m *Snapshot) GetMembership() Membership

func (*Snapshot) GetTerm

func (m *Snapshot) GetTerm() uint64

func (*Snapshot) Marshal

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

func (*Snapshot) MarshalTo

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

func (*Snapshot) ProtoMessage

func (*Snapshot) ProtoMessage()

func (*Snapshot) Reset

func (m *Snapshot) Reset()

func (*Snapshot) Size

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

func (*Snapshot) String

func (m *Snapshot) String() string

func (*Snapshot) Unmarshal

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

func (*Snapshot) Validate

func (snapshot *Snapshot) Validate() bool

Validate validates the snapshot instance.

func (*Snapshot) XXX_DiscardUnknown

func (m *Snapshot) XXX_DiscardUnknown()

func (*Snapshot) XXX_Marshal

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

func (*Snapshot) XXX_Merge

func (dst *Snapshot) XXX_Merge(src proto.Message)

func (*Snapshot) XXX_Size

func (m *Snapshot) XXX_Size() int

func (*Snapshot) XXX_Unmarshal

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

type SnapshotChunk

type SnapshotChunk struct {
	ClusterId      uint64       `protobuf:"varint,1,opt,name=cluster_id,json=clusterId" json:"cluster_id"`
	NodeId         uint64       `protobuf:"varint,2,opt,name=node_id,json=nodeId" json:"node_id"`
	From           uint64       `protobuf:"varint,3,opt,name=from" json:"from"`
	ChunkId        uint64       `protobuf:"varint,4,opt,name=chunk_id,json=chunkId" json:"chunk_id"`
	ChunkSize      uint64       `protobuf:"varint,5,opt,name=chunk_size,json=chunkSize" json:"chunk_size"`
	ChunkCount     uint64       `protobuf:"varint,6,opt,name=chunk_count,json=chunkCount" json:"chunk_count"`
	Data           []byte       `protobuf:"bytes,7,opt,name=data" json:"data"`
	Index          uint64       `protobuf:"varint,8,opt,name=index" json:"index"`
	Term           uint64       `protobuf:"varint,9,opt,name=term" json:"term"`
	Membership     Membership   `protobuf:"bytes,10,opt,name=membership" json:"membership"`
	Filepath       string       `protobuf:"bytes,12,opt,name=filepath" json:"filepath"`
	FileSize       uint64       `protobuf:"varint,13,opt,name=file_size,json=fileSize" json:"file_size"`
	DeploymentId   uint64       `protobuf:"varint,14,opt,name=deployment_id,json=deploymentId" json:"deployment_id"`
	FileChunkId    uint64       `protobuf:"varint,15,opt,name=file_chunk_id,json=fileChunkId" json:"file_chunk_id"`
	FileChunkCount uint64       `protobuf:"varint,16,opt,name=file_chunk_count,json=fileChunkCount" json:"file_chunk_count"`
	HasFileInfo    bool         `protobuf:"varint,17,opt,name=has_file_info,json=hasFileInfo" json:"has_file_info"`
	FileInfo       SnapshotFile `protobuf:"bytes,18,opt,name=file_info,json=fileInfo" json:"file_info"`
	BinVer         uint32       `protobuf:"varint,19,opt,name=bin_ver,json=binVer" json:"bin_ver"`
}

field id 11 was used for optional string filename

func (*SnapshotChunk) Descriptor

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

func (*SnapshotChunk) GetBinVer

func (m *SnapshotChunk) GetBinVer() uint32

func (*SnapshotChunk) GetChunkCount

func (m *SnapshotChunk) GetChunkCount() uint64

func (*SnapshotChunk) GetChunkId

func (m *SnapshotChunk) GetChunkId() uint64

func (*SnapshotChunk) GetChunkSize

func (m *SnapshotChunk) GetChunkSize() uint64

func (*SnapshotChunk) GetClusterId

func (m *SnapshotChunk) GetClusterId() uint64

func (*SnapshotChunk) GetData

func (m *SnapshotChunk) GetData() []byte

func (*SnapshotChunk) GetDeploymentId

func (m *SnapshotChunk) GetDeploymentId() uint64

func (*SnapshotChunk) GetFileChunkCount

func (m *SnapshotChunk) GetFileChunkCount() uint64

func (*SnapshotChunk) GetFileChunkId

func (m *SnapshotChunk) GetFileChunkId() uint64

func (*SnapshotChunk) GetFileInfo

func (m *SnapshotChunk) GetFileInfo() SnapshotFile

func (*SnapshotChunk) GetFileSize

func (m *SnapshotChunk) GetFileSize() uint64

func (*SnapshotChunk) GetFilepath

func (m *SnapshotChunk) GetFilepath() string

func (*SnapshotChunk) GetFrom

func (m *SnapshotChunk) GetFrom() uint64

func (*SnapshotChunk) GetHasFileInfo

func (m *SnapshotChunk) GetHasFileInfo() bool

func (*SnapshotChunk) GetIndex

func (m *SnapshotChunk) GetIndex() uint64

func (*SnapshotChunk) GetMembership

func (m *SnapshotChunk) GetMembership() Membership

func (*SnapshotChunk) GetNodeId

func (m *SnapshotChunk) GetNodeId() uint64

func (*SnapshotChunk) GetTerm

func (m *SnapshotChunk) GetTerm() uint64

func (*SnapshotChunk) Marshal

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

func (*SnapshotChunk) MarshalTo

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

func (*SnapshotChunk) ProtoMessage

func (*SnapshotChunk) ProtoMessage()

func (*SnapshotChunk) Reset

func (m *SnapshotChunk) Reset()

func (*SnapshotChunk) Size

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

func (*SnapshotChunk) String

func (m *SnapshotChunk) String() string

func (*SnapshotChunk) Unmarshal

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

func (*SnapshotChunk) XXX_DiscardUnknown

func (m *SnapshotChunk) XXX_DiscardUnknown()

func (*SnapshotChunk) XXX_Marshal

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

func (*SnapshotChunk) XXX_Merge

func (dst *SnapshotChunk) XXX_Merge(src proto.Message)

func (*SnapshotChunk) XXX_Size

func (m *SnapshotChunk) XXX_Size() int

func (*SnapshotChunk) XXX_Unmarshal

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

type SnapshotFile

type SnapshotFile struct {
	Filepath string `protobuf:"bytes,2,opt,name=filepath" json:"filepath"`
	FileSize uint64 `protobuf:"varint,3,opt,name=file_size,json=fileSize" json:"file_size"`
	FileId   uint64 `protobuf:"varint,4,opt,name=file_id,json=fileId" json:"file_id"`
	Metadata []byte `protobuf:"bytes,5,opt,name=metadata" json:"metadata"`
}

field id 1 was used for optional string filename

func (*SnapshotFile) Descriptor

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

func (*SnapshotFile) Filename

func (f *SnapshotFile) Filename() string

Filename returns the filename of the external snapshot file.

func (*SnapshotFile) GetFileId

func (m *SnapshotFile) GetFileId() uint64

func (*SnapshotFile) GetFileSize

func (m *SnapshotFile) GetFileSize() uint64

func (*SnapshotFile) GetFilepath

func (m *SnapshotFile) GetFilepath() string

func (*SnapshotFile) GetMetadata

func (m *SnapshotFile) GetMetadata() []byte

func (*SnapshotFile) Marshal

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

func (*SnapshotFile) MarshalTo

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

func (*SnapshotFile) ProtoMessage

func (*SnapshotFile) ProtoMessage()

func (*SnapshotFile) Reset

func (m *SnapshotFile) Reset()

func (*SnapshotFile) Size

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

func (*SnapshotFile) String

func (m *SnapshotFile) String() string

func (*SnapshotFile) Unmarshal

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

func (*SnapshotFile) XXX_DiscardUnknown

func (m *SnapshotFile) XXX_DiscardUnknown()

func (*SnapshotFile) XXX_Marshal

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

func (*SnapshotFile) XXX_Merge

func (dst *SnapshotFile) XXX_Merge(src proto.Message)

func (*SnapshotFile) XXX_Size

func (m *SnapshotFile) XXX_Size() int

func (*SnapshotFile) XXX_Unmarshal

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

type SnapshotHeader

type SnapshotHeader struct {
	SessionSize     uint64       `protobuf:"varint,1,opt,name=session_size,json=sessionSize" json:"session_size"`
	DataStoreSize   uint64       `protobuf:"varint,2,opt,name=data_store_size,json=dataStoreSize" json:"data_store_size"`
	UnreliableTime  uint64       `protobuf:"varint,3,opt,name=unreliable_time,json=unreliableTime" json:"unreliable_time"`
	GitVersion      string       `protobuf:"bytes,4,opt,name=git_version,json=gitVersion" json:"git_version"`
	HeaderChecksum  []byte       `protobuf:"bytes,5,opt,name=header_checksum,json=headerChecksum" json:"header_checksum"`
	PayloadChecksum []byte       `protobuf:"bytes,6,opt,name=payload_checksum,json=payloadChecksum" json:"payload_checksum"`
	ChecksumType    ChecksumType `protobuf:"varint,7,opt,name=checksum_type,json=checksumType,enum=raftpb.ChecksumType" json:"checksum_type"`
	Version         uint64       `protobuf:"varint,8,opt,name=version" json:"version"`
}

func (*SnapshotHeader) Descriptor

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

func (*SnapshotHeader) GetChecksumType

func (m *SnapshotHeader) GetChecksumType() ChecksumType

func (*SnapshotHeader) GetDataStoreSize

func (m *SnapshotHeader) GetDataStoreSize() uint64

func (*SnapshotHeader) GetGitVersion

func (m *SnapshotHeader) GetGitVersion() string

func (*SnapshotHeader) GetHeaderChecksum

func (m *SnapshotHeader) GetHeaderChecksum() []byte

func (*SnapshotHeader) GetPayloadChecksum

func (m *SnapshotHeader) GetPayloadChecksum() []byte

func (*SnapshotHeader) GetSessionSize

func (m *SnapshotHeader) GetSessionSize() uint64

func (*SnapshotHeader) GetUnreliableTime

func (m *SnapshotHeader) GetUnreliableTime() uint64

func (*SnapshotHeader) GetVersion

func (m *SnapshotHeader) GetVersion() uint64

func (*SnapshotHeader) Marshal

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

func (*SnapshotHeader) MarshalTo

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

func (*SnapshotHeader) ProtoMessage

func (*SnapshotHeader) ProtoMessage()

func (*SnapshotHeader) Reset

func (m *SnapshotHeader) Reset()

func (*SnapshotHeader) Size

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

func (*SnapshotHeader) String

func (m *SnapshotHeader) String() string

func (*SnapshotHeader) Unmarshal

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

func (*SnapshotHeader) XXX_DiscardUnknown

func (m *SnapshotHeader) XXX_DiscardUnknown()

func (*SnapshotHeader) XXX_Marshal

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

func (*SnapshotHeader) XXX_Merge

func (dst *SnapshotHeader) XXX_Merge(src proto.Message)

func (*SnapshotHeader) XXX_Size

func (m *SnapshotHeader) XXX_Size() int

func (*SnapshotHeader) XXX_Unmarshal

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

type State

type State struct {
	Term   uint64 `protobuf:"varint,1,opt,name=term" json:"term"`
	Vote   uint64 `protobuf:"varint,2,opt,name=vote" json:"vote"`
	Commit uint64 `protobuf:"varint,3,opt,name=commit" json:"commit"`
}

according to the original raft protocol, commit is not included in the persistent state. why it is included here is documented in github.com/lni/DragonBoatDocs/raft.md

func (*State) Descriptor

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

func (*State) GetCommit

func (m *State) GetCommit() uint64

func (*State) GetTerm

func (m *State) GetTerm() uint64

func (*State) GetVote

func (m *State) GetVote() uint64

func (*State) Marshal

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

func (*State) MarshalTo

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

func (*State) ProtoMessage

func (*State) ProtoMessage()

func (*State) Reset

func (m *State) Reset()

func (*State) Size

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

func (*State) String

func (m *State) String() string

func (*State) Unmarshal

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

func (*State) XXX_DiscardUnknown

func (m *State) XXX_DiscardUnknown()

func (*State) XXX_Marshal

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

func (*State) XXX_Merge

func (dst *State) XXX_Merge(src proto.Message)

func (*State) XXX_Size

func (m *State) XXX_Size() int

func (*State) XXX_Unmarshal

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

type SystemCtx

type SystemCtx struct {
	Low  uint64
	High uint64
}

SystemCtx is used to identify a ReadIndex operation.

type Update

type Update struct {
	ClusterID uint64
	NodeID    uint64
	// The current persistent state of a raft node. It must be stored onto
	// persistent storage before any non-replication can be sent to other nodes.
	// isStateEqual(emptyState) returns true when the state is empty.
	State
	// EntriesToSave are entries waiting to be stored onto persistent storage.
	EntriesToSave []Entry
	// CommittedEntries are entries already committed in raft and ready to be
	// applied by dragonboat applications.
	CommittedEntries []Entry
	// Whether there are more committed entries ready to be applied.
	MoreCommittedEntries bool
	// Snapshot is the metadata of the snapshot ready to be applied.
	Snapshot Snapshot
	// ReadyToReads provides a list of ReadIndex requests ready for local read.
	ReadyToReads []ReadyToRead
	// Messages is a list of outgoing messages to be sent to remote nodes.
	// As stated above, replication messages can be immediately sent, all other
	// messages must be sent after the persistent state and entries are saved
	// onto persistent storage.
	Messages []Message
	// LastApplied is the actual last applied index reported by the RSM.
	LastApplied uint64
	// UpdateCommit contains info on how the Update instance can be committed
	// to actually progress the state of raft.
	UpdateCommit UpdateCommit
}

Update is a collection of state, entries and messages that are expected to be processed by raft's upper layer to progress the raft node modelled as state machine.

func (*Update) HasUpdate

func (ud *Update) HasUpdate() bool

HasUpdate returns a boolean value indicating whether the returned Update instance actually has any update to be processed.

type UpdateCommit

type UpdateCommit struct {
	AppliedTo        uint64
	StableLogTo      uint64
	StableLogTerm    uint64
	StableSnapshotTo uint64
	ReadyToRead      uint64
}

UpdateCommit is used to describe how to commit the Update instance to progress the state of raft.

Jump to

Keyboard shortcuts

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