Documentation ¶
Index ¶
- Constants
- Variables
- type PersistentLogState
- type RaftLog
- func (rl *RaftLog) AppendEntry(en *pb.LogEntry) (index uint64, err error)
- func (rl *RaftLog) DiscardAllLogEntries(snapshotIndex, snapshotTerm uint64)
- func (rl *RaftLog) DiscardLogEntriesAfter(startIndex uint64) error
- func (rl *RaftLog) DiscardLogEntriesBefore(endIndex, endTerm uint64)
- func (rl *RaftLog) GetEntriesSince(index uint64) (entries []*pb.Entry, err error)
- func (rl *RaftLog) GetLogEntries(index, maxCount uint64) (entries []*pb.Entry, err error)
- func (rl *RaftLog) GetLogEntry(index uint64) (entry *pb.LogEntry, err error)
- func (rl *RaftLog) GetLogEntryUnsafe(index uint64) (entry *pb.LogEntry, err error)
- func (rl *RaftLog) GetLogSizeBytes() uint64
- func (rl *RaftLog) GetMostRecentIndex() uint64
- func (rl *RaftLog) GetMostRecentTerm() uint64
- func (rl *RaftLog) GetStartIndex() uint64
- func (rl *RaftLog) GetStartTerm() uint64
Constants ¶
const ( LogEntryDirectoryName = "log_entries" LogMetaFileName = "logmetainfo" )
Constants used by the raftlog
Variables ¶
var ErrIndexBelowStartIndex = errors.New("given index is below start index")
ErrIndexBelowStartIndex is returned if the given index is below start index.
Functions ¶
This section is empty.
Types ¶
type PersistentLogState ¶
type PersistentLogState struct { LogSizeBytes uint64 `json:"logsizebytes"` StartIndex uint64 `json:"startindex"` StartTerm uint64 `json:"startterm"` }
PersistentLogState stores the state information
type RaftLog ¶
type RaftLog struct {
// contains filtered or unexported fields
}
RaftLog is the structure through which logging functinality can be accessed
func (*RaftLog) AppendEntry ¶
AppendEntry will write the entry provided and return the index of the entry and an error object if somethign went wrong
func (*RaftLog) DiscardAllLogEntries ¶
DiscardAllLogEntries once a new snapshot has been reverted to
func (*RaftLog) DiscardLogEntriesAfter ¶
DiscardLogEntriesAfter discards an entry in the logs at startIndex and all logs after it
func (*RaftLog) DiscardLogEntriesBefore ¶
DiscardLogEntriesBefore discards an entry in the logs at endIndex and all logs before it
func (*RaftLog) GetEntriesSince ¶
GetEntriesSince returns a list of entries including and after the one at the given index, and an error object if something went wrong
func (*RaftLog) GetLogEntries ¶
GetLogEntries gets maxCount log entries starting from index. If there are less entries than maxCount it gets all of them until the end.
func (*RaftLog) GetLogEntry ¶
GetLogEntry will read an entry at the given index returning the protobuf and an error if something went wrong
func (*RaftLog) GetLogEntryUnsafe ¶
GetLogEntryUnsafe returns an unsafe log entry
func (*RaftLog) GetLogSizeBytes ¶
GetLogSizeBytes returns the side of the log in bytes
func (*RaftLog) GetMostRecentIndex ¶
GetMostRecentIndex returns the index of the last log entry
func (*RaftLog) GetMostRecentTerm ¶
GetMostRecentTerm returns the term of the last log entry
func (*RaftLog) GetStartIndex ¶
GetStartIndex returns the starting index
func (*RaftLog) GetStartTerm ¶
GetStartTerm returns start term