Documentation
¶
Index ¶
- Variables
- func AppendConfState(b []byte, cs ConfState) []byte
- type ConfChange
- type ConfChangeType
- type ConfState
- type Config
- type Core
- func (c *Core) Advance(rd Ready)
- func (c *Core) AdvanceApply(rd Ready)
- func (c *Core) AdvancePersist(rd Ready)
- func (c *Core) ConfState() ConfState
- func (c *Core) DropLease()
- func (c *Core) HasReady() bool
- func (c *Core) Match(id NodeID) (uint64, bool)
- func (c *Core) Progress() map[NodeID]PeerProgress
- func (c *Core) Propose(data []byte) (index, term uint64, err error)
- func (c *Core) ProposeConfChange(cc ConfChange) (index, term uint64, err error)
- func (c *Core) ReadIndex() (uint64, error)
- func (c *Core) Ready() Ready
- func (c *Core) ReportSnapshot(id NodeID, failed bool)
- func (c *Core) ReportUnreachable(id NodeID)
- func (c *Core) Status() Status
- func (c *Core) Step(m Message) error
- func (c *Core) Tick()
- func (c *Core) TransferLeadership(to NodeID) error
- type Entry
- type EntryType
- type HardState
- type MemoryStorage
- func (s *MemoryStorage) Append(ents []Entry) error
- func (s *MemoryStorage) ApplySnapshot(snap SnapshotMeta) error
- func (s *MemoryStorage) Compact(i uint64) error
- func (s *MemoryStorage) CreateSnapshot(i uint64, cs ConfState) (SnapshotMeta, error)
- func (s *MemoryStorage) Entries(lo, hi, maxSize uint64) ([]Entry, error)
- func (s *MemoryStorage) FirstIndex() (uint64, error)
- func (s *MemoryStorage) InitialState() (HardState, ConfState, error)
- func (s *MemoryStorage) LastIndex() (uint64, error)
- func (s *MemoryStorage) SetConf(cs ConfState)
- func (s *MemoryStorage) SetHardState(hs HardState)
- func (s *MemoryStorage) Snapshot() (SnapshotMeta, error)
- func (s *MemoryStorage) Term(i uint64) (uint64, error)
- type Message
- type MessageType
- type NodeID
- type PeerProgress
- type Progress
- type ProgressState
- type ReadState
- type Ready
- type SnapshotMeta
- type SoftState
- type StateType
- type Status
- type Storage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrConfChangePending = errors.New("raft: a configuration change is in progress") ErrConfChangeInvalid = errors.New("raft: invalid configuration change") )
View Source
var ( ErrNotLeader = errors.New("raft: not leader") ErrCompacted = errors.New("raft: requested index is compacted") )
View Source
var ErrTransferTarget = errors.New("raft: leadership transfer target is not a voter")
Functions ¶
func AppendConfState ¶ added in v0.3.0
Types ¶
type ConfChange ¶ added in v0.3.0
type ConfChange struct {
Type ConfChangeType
Node NodeID
Addr string
}
type ConfChangeType ¶ added in v0.3.0
type ConfChangeType uint8
const ( ConfAddLearner ConfChangeType = iota + 1 ConfPromote ConfRemove )
type ConfState ¶
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
func (*Core) AdvanceApply ¶ added in v0.2.1
func (*Core) AdvancePersist ¶ added in v0.2.1
func (*Core) Progress ¶ added in v0.3.6
func (c *Core) Progress() map[NodeID]PeerProgress
func (*Core) ProposeConfChange ¶ added in v0.3.0
func (c *Core) ProposeConfChange(cc ConfChange) (index, term uint64, err error)
func (*Core) ReportSnapshot ¶
func (*Core) ReportUnreachable ¶
func (*Core) TransferLeadership ¶ added in v0.3.0
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
func NewMemoryStorage ¶
func NewMemoryStorage(cs ConfState) *MemoryStorage
func (*MemoryStorage) Append ¶
func (s *MemoryStorage) Append(ents []Entry) error
func (*MemoryStorage) ApplySnapshot ¶
func (s *MemoryStorage) ApplySnapshot(snap SnapshotMeta) error
func (*MemoryStorage) Compact ¶
func (s *MemoryStorage) Compact(i uint64) error
func (*MemoryStorage) CreateSnapshot ¶
func (s *MemoryStorage) CreateSnapshot(i uint64, cs ConfState) (SnapshotMeta, error)
func (*MemoryStorage) Entries ¶
func (s *MemoryStorage) Entries(lo, hi, maxSize uint64) ([]Entry, error)
func (*MemoryStorage) FirstIndex ¶
func (s *MemoryStorage) FirstIndex() (uint64, error)
func (*MemoryStorage) InitialState ¶
func (s *MemoryStorage) InitialState() (HardState, ConfState, error)
func (*MemoryStorage) LastIndex ¶
func (s *MemoryStorage) LastIndex() (uint64, error)
func (*MemoryStorage) SetConf ¶ added in v0.3.0
func (s *MemoryStorage) SetConf(cs ConfState)
func (*MemoryStorage) SetHardState ¶
func (s *MemoryStorage) SetHardState(hs HardState)
func (*MemoryStorage) Snapshot ¶
func (s *MemoryStorage) Snapshot() (SnapshotMeta, error)
type MessageType ¶
type MessageType uint8
const ( MsgApp MessageType = iota + 1 MsgAppResp MsgVote MsgVoteResp MsgPreVote MsgPreVoteResp MsgHeartbeat MsgHeartbeatResp MsgSnap MsgReadIndex MsgReadIndexResp MsgTimeoutNow )
func (MessageType) String ¶
func (t MessageType) String() string
type PeerProgress ¶ added in v0.3.6
type Progress ¶
type Progress struct {
Match, Next uint64
State ProgressState
PendingSnapshot uint64
RecentActive bool
IsLearner bool
// contains filtered or unexported fields
}
type ProgressState ¶
type ProgressState uint8
const ( ProgressProbe ProgressState = iota ProgressReplicate ProgressSnapshot )
func (ProgressState) String ¶ added in v0.3.6
func (s ProgressState) String() string
type SnapshotMeta ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.