raftpb

package
v0.0.0-...-93a8726 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 12 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// NoNode is the flag used to indicate that the node id field is not set.
	NoNode uint64 = 0
)
View Source
const NonCmdFieldSize = 16 * 8
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 (
	// LastChunkCount is the special chunk count value used to indicate that the
	// chunk is the last one.
	LastChunkCount uint64 = math.MaxUint64
	// PoisonChunkCount is the special chunk count value used to indicate that
	// the processing goroutine should return.
	PoisonChunkCount uint64 = math.MaxUint64 - 1
)
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 uint64 = 8 * 1024 * 1024 * 1024 * 1024
)

Colfer configuration attributes.

View Source
var CompressionType_name = map[int32]string{
	0: "NoCompression",
	1: "Snappy",
}
View Source
var CompressionType_value = map[string]int32{
	"NoCompression": 0,
	"Snappy":        1,
}
View Source
var ConfigChangeType_name = map[int32]string{
	0: "AddNode",
	1: "RemoveNode",
	2: "AddNonVoting",
	3: "AddWitness",
}
View Source
var ConfigChangeType_value = map[string]int32{
	"AddNode":      0,
	"RemoveNode":   1,
	"AddNonVoting": 2,
	"AddWitness":   3,
}
View Source
var EntryType_name = map[int32]string{
	0: "ApplicationEntry",
	1: "ConfigChangeEntry",
	2: "EncodedEntry",
	3: "MetadataEntry",
}
View Source
var EntryType_value = map[string]int32{
	"ApplicationEntry":  0,
	"ConfigChangeEntry": 1,
	"EncodedEntry":      2,
	"MetadataEntry":     3,
}
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",
	25: "RateLimit",
	26: "RequestPreVote",
	27: "RequestPreVoteResp",
}
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,
	"RateLimit":          25,
	"RequestPreVote":     26,
	"RequestPreVoteResp": 27,
}
View Source
var StateMachineType_name = map[int32]string{
	0: "UnknownStateMachine",
	1: "RegularStateMachine",
	2: "ConcurrentStateMachine",
	3: "OnDiskStateMachine",
}
View Source
var StateMachineType_value = map[string]int32{
	"UnknownStateMachine":    0,
	"RegularStateMachine":    1,
	"ConcurrentStateMachine": 2,
	"OnDiskStateMachine":     3,
}

Functions

func GetEntrySliceInMemSize

func GetEntrySliceInMemSize(ents []Entry) uint64

GetEntrySliceInMemSize returns the in memory size of the specified entry slice. Size 24 bytes used to hold ents itself is not counted.

func GetEntrySliceSize

func GetEntrySliceSize(ents []Entry) uint64

GetEntrySliceSize returns the upper limit of the entry slice size.

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.

func MustMarshal

func MustMarshal(m Marshaler) []byte

MustMarshal marshals the input object or panic if there is any error.

func MustMarshalTo

func MustMarshalTo(m Marshaler, result []byte) []byte

MustMarshalTo marshals the input object to the specified buffer or panic if there is any error.

func MustUnmarshal

func MustUnmarshal(m Unmarshaler, data []byte)

MustUnmarshal unmarshals the specified object using the provided marshalled data. MustUnmarshal will panic if there is any error.

Types

type Bootstrap

type Bootstrap struct {
	Addresses map[uint64]string
	Join      bool
	Type      StateMachineType
}

func NewBootstrapInfo

func NewBootstrapInfo(join bool,
	smType StateMachineType, nodes map[uint64]string) Bootstrap

NewBootstrapInfo creates and returns a new bootstrap record.

func (*Bootstrap) Marshal

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

func (*Bootstrap) MarshalTo

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

func (*Bootstrap) Size

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

func (*Bootstrap) Unmarshal

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

func (*Bootstrap) Validate

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

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

type ChecksumType

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

func (ChecksumType) String

func (x ChecksumType) String() string

type Chunk

type Chunk struct {
	ClusterId      uint64
	NodeId         uint64
	From           uint64
	ChunkId        uint64
	ChunkSize      uint64
	ChunkCount     uint64
	Data           []byte
	Index          uint64
	Term           uint64
	Membership     Membership
	Filepath       string
	FileSize       uint64
	DeploymentId   uint64
	FileChunkId    uint64
	FileChunkCount uint64
	HasFileInfo    bool
	FileInfo       SnapshotFile
	BinVer         uint32
	OnDiskIndex    uint64
	Witness        bool
}

func (Chunk) IsLastChunk

func (m Chunk) IsLastChunk() bool

IsLastChunk returns a boolean value indicating whether the chunk is the last chunk of a snapshot.

func (Chunk) IsLastFileChunk

func (m Chunk) IsLastFileChunk() bool

IsLastFileChunk returns a boolean value indicating whether the chunk is the last chunk of a snapshot file.

func (Chunk) IsPoisonChunk

func (m Chunk) IsPoisonChunk() bool

IsPoisonChunk returns a boolean value indicating whether the chunk is a special poison chunk.

func (*Chunk) Marshal

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

func (*Chunk) MarshalTo

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

func (*Chunk) Size

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

func (*Chunk) Unmarshal

func (m *Chunk) Unmarshal(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 CompressionType

type CompressionType int32
const (
	NoCompression CompressionType = 0
	Snappy        CompressionType = 1
)

func (CompressionType) String

func (x CompressionType) String() string

type ConfigChange

type ConfigChange struct {
	ConfigChangeId uint64
	Type           ConfigChangeType
	NodeID         uint64
	Address        string
	Initialize     bool
}

func (*ConfigChange) Marshal

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

func (*ConfigChange) MarshalTo

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

func (*ConfigChange) Size

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

func (*ConfigChange) Unmarshal

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

type ConfigChangeType

type ConfigChangeType int32
const (
	AddNode      ConfigChangeType = 0
	RemoveNode   ConfigChangeType = 1
	AddNonVoting ConfigChangeType = 2
	AddWitness   ConfigChangeType = 3
)

func (ConfigChangeType) String

func (x ConfigChangeType) String() string

type Entry

type Entry struct {
	Term        uint64
	Index       uint64
	Type        EntryType
	Key         uint64
	ClientID    uint64
	SeriesID    uint64
	RespondedTo uint64
	Cmd         []byte
}

func EntriesToApply

func EntriesToApply(entries []Entry, applied uint64, strict bool) []Entry

func (*Entry) IsConfigChange

func (m *Entry) IsConfigChange() bool

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

func (*Entry) IsEmpty

func (m *Entry) IsEmpty() bool

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

func (*Entry) IsEndOfSessionRequest

func (m *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 (m *Entry) IsNewSessionRequest() bool

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

func (*Entry) IsNoOPSession

func (m *Entry) IsNoOPSession() bool

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

func (*Entry) IsProposal

func (m *Entry) IsProposal() bool

IsProposal returns a boolean value indicating whether the entry is a regular update entry.

func (*Entry) IsSessionManaged

func (m *Entry) IsSessionManaged() bool

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

func (*Entry) IsUpdateEntry

func (m *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 (m *Entry) MarshalTo(buf []byte) (int, error)

MarshalTo marshals the entry to the specified byte slice.

func (*Entry) Size

func (m *Entry) Size() int

Size returns the actual size of an entry.

func (*Entry) SizeUpperLimit

func (m *Entry) SizeUpperLimit() int

SizeUpperLimit returns the upper limit size of an entry.

func (*Entry) Unmarshal

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

Unmarshal unmarshals the input to the current entry instance.

type EntryBatch

type EntryBatch struct {
	Entries []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) 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) Unmarshal

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

type EntryType

type EntryType int32
const (
	ApplicationEntry  EntryType = 0
	ConfigChangeEntry EntryType = 1
	EncodedEntry      EntryType = 2
	MetadataEntry     EntryType = 3
)

func (EntryType) String

func (x EntryType) String() string

type IChunkSink

type IChunkSink interface {
	Receive(chunk Chunk) (bool, bool)
	Close() error
	ClusterID() uint64
	ToNodeID() uint64
}

IChunkSink is the snapshot chunk sink for handling snapshot chunks being streamed.

type ICompactor

type ICompactor interface {
	Compact(uint64) error
}

type IMessageHandler

type IMessageHandler interface {
	HandleMessageBatch(batch MessageBatch) (uint64, uint64)
	HandleUnreachable(clusterID uint64, nodeID uint64)
	HandleSnapshotStatus(clusterID uint64, nodeID uint64, rejected bool)
	HandleSnapshot(clusterID uint64, nodeID uint64, from uint64)
}

IMessageHandler is the interface required to handle incoming raft requests.

type ITransportEvent

type ITransportEvent interface {
	ConnectionEstablished(string, bool)
	ConnectionFailed(string, bool)
}

ITransportEvent is the interface for notifying connection status changes.

type Marshaler

type Marshaler interface {
	Marshal() ([]byte, error)
	MarshalTo([]byte) (int, error)
}

Marshaler is the interface for instances that can be marshalled.

type Membership

type Membership struct {
	ConfigChangeId uint64
	Addresses      map[uint64]string
	Removed        map[uint64]bool
	NonVotings     map[uint64]string
	Witnesses      map[uint64]string
}

func (*Membership) Marshal

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

func (*Membership) MarshalTo

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

func (*Membership) Size

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

func (*Membership) Unmarshal

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

type Message

type Message struct {
	Type      MessageType
	To        uint64
	From      uint64
	ClusterId uint64
	Term      uint64
	LogTerm   uint64
	LogIndex  uint64
	Commit    uint64
	Reject    bool
	Hint      uint64
	Entries   []Entry
	Snapshot  Snapshot
	HintHigh  uint64
}

func (*Message) CanDrop

func (m *Message) CanDrop() bool

CanDrop returns a boolean value indicating whether the message can be safely dropped.

func (*Message) Marshal

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

func (*Message) MarshalTo

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

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) Unmarshal

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

Unmarshal unmarshals the message instance using the input byte slice.

type MessageBatch

type MessageBatch struct {
	Requests      []Message
	DeploymentId  uint64
	SourceAddress string
	BinVer        uint32
}

func (*MessageBatch) Marshal

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

func (*MessageBatch) MarshalTo

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

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) Unmarshal

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

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

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
	// FIXME Reserved Quiesce            MessageType = 21
	SnapshotReceived   MessageType = 22
	LeaderTransfer     MessageType = 23
	TimeoutNow         MessageType = 24
	RateLimit          MessageType = 25
	RequestPreVote     MessageType = 26
	RequestPreVoteResp MessageType = 27
)

func (MessageType) String

func (x MessageType) String() string

type RaftDataStatus

type RaftDataStatus struct {
	Address             string
	BinVer              uint32
	HardHash            uint64
	LogdbType           string
	Hostname            string
	DeploymentId        uint64
	StepWorkerCount     uint64
	LogdbShardCount     uint64
	MaxSessionCount     uint64
	EntryBatchSize      uint64
	AddressByNodeHostId bool
}

func (*RaftDataStatus) Marshal

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

func (*RaftDataStatus) MarshalTo

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

func (*RaftDataStatus) Size

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

func (*RaftDataStatus) Unmarshal

func (m *RaftDataStatus) Unmarshal(dAtA []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 Snapshot

type Snapshot struct {
	Filepath    string
	FileSize    uint64
	Index       uint64
	Term        uint64
	Membership  Membership
	Files       []*SnapshotFile
	Checksum    []byte
	Dummy       bool
	ClusterId   uint64
	Type        StateMachineType
	Imported    bool
	OnDiskIndex uint64
	Witness     bool
	// contains filtered or unexported fields
}

func (*Snapshot) Load

func (m *Snapshot) Load(c ICompactor)

func (*Snapshot) Marshal

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

func (*Snapshot) MarshalTo

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

func (*Snapshot) Ref

func (m *Snapshot) Ref()

func (*Snapshot) Size

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

func (*Snapshot) Unmarshal

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

func (*Snapshot) Unref

func (m *Snapshot) Unref() error

func (*Snapshot) Validate

func (snapshot *Snapshot) Validate(fs vfs.IFS) bool

Validate validates the snapshot instance.

type SnapshotFile

type SnapshotFile struct {
	Filepath string
	FileSize uint64
	FileId   uint64
	Metadata []byte
}

func (*SnapshotFile) Filename

func (m *SnapshotFile) Filename() string

Filename returns the filename of the external snapshot file.

func (*SnapshotFile) Marshal

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

func (*SnapshotFile) MarshalTo

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

func (*SnapshotFile) Size

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

func (*SnapshotFile) Unmarshal

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

type SnapshotHeader

type SnapshotHeader struct {
	SessionSize     uint64
	DataStoreSize   uint64
	UnreliableTime  uint64
	GitVersion      string
	HeaderChecksum  []byte
	PayloadChecksum []byte
	ChecksumType    ChecksumType
	Version         uint64
	CompressionType CompressionType
}

func (*SnapshotHeader) Marshal

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

func (*SnapshotHeader) MarshalTo

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

func (*SnapshotHeader) Size

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

func (*SnapshotHeader) Unmarshal

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

type State

type State struct {
	Term   uint64
	Vote   uint64
	Commit 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) Size

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

func (*State) SizeUpperLimit

func (m *State) SizeUpperLimit() int

SizeUpperLimit returns the upper limit size of the state instance.

func (*State) Unmarshal

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

type StateMachineType

type StateMachineType int32
const (
	UnknownStateMachine    StateMachineType = 0
	RegularStateMachine    StateMachineType = 1
	ConcurrentStateMachine StateMachineType = 2
	OnDiskStateMachine     StateMachineType = 3
)

func (StateMachineType) String

func (x StateMachineType) String() string

type SystemCtx

type SystemCtx struct {
	Low  uint64
	High uint64
}

SystemCtx is used to identify a ReadIndex operation.

type Unmarshaler

type Unmarshaler interface {
	Unmarshal([]byte) error
}

Unmarshaler is the interface for instances that can be unmarshalled.

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
	// whether CommittedEntries can be applied without waiting for the Update
	// to be persisted to disk
	FastApply bool
	// 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
	// DroppedEntries is a list of entries dropped when no leader is available
	DroppedEntries []Entry
	// DroppedReadIndexes is a list of read index requests  dropped when no leader
	// is available.
	DroppedReadIndexes []SystemCtx
}

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 (u *Update) HasUpdate() bool

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

func (*Update) MarshalTo

func (u *Update) MarshalTo(buf []byte) (int, error)

MarshalTo encodes the fields that need to be persisted to the specified buffer.

func (*Update) SizeUpperLimit

func (u *Update) SizeUpperLimit() int

SizeUpperLimit returns the upper limit of the estimated size of marshalled Update instance.

func (*Update) Unmarshal

func (u *Update) Unmarshal(buf []byte) error

Unmarshal decodes the Update state from the input buf.

type UpdateCommit

type UpdateCommit struct {
	// the last index known to be pushed to rsm for execution.
	Processed uint64
	// the last index confirmed to be executed.
	LastApplied      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