kubernetes/vendor/go.etcd.io/etcd/raft/v3/log.go

type raftLog

// newLog returns log using the given storage and default options. It
// recovers the log to the state that it just commits and applies the
// latest snapshot.
func newLog(storage Storage, logger Logger) *raftLog {}

// newLogWithSize returns a log using the given storage and max
// message size.
func newLogWithSize(storage Storage, logger Logger, maxNextEntsSize uint64) *raftLog {}

func (l *raftLog) String() string {}

// maybeAppend returns (0, false) if the entries cannot be appended. Otherwise,
// it returns (last index of new entries, true).
func (l *raftLog) maybeAppend(index, logTerm, committed uint64, ents ...pb.Entry) (lastnewi uint64, ok bool) {}

func (l *raftLog) append(ents ...pb.Entry) uint64 {}

// findConflict finds the index of the conflict.
// It returns the first pair of conflicting entries between the existing
// entries and the given entries, if there are any.
// If there is no conflicting entries, and the existing entries contains
// all the given entries, zero will be returned.
// If there is no conflicting entries, but the given entries contains new
// entries, the index of the first new entry will be returned.
// An entry is considered to be conflicting if it has the same index but
// a different term.
// The index of the given entries MUST be continuously increasing.
func (l *raftLog) findConflict(ents []pb.Entry) uint64 {}

// findConflictByTerm takes an (index, term) pair (indicating a conflicting log
// entry on a leader/follower during an append) and finds the largest index in
// log l with a term <= `term` and an index <= `index`. If no such index exists
// in the log, the log's first index is returned.
//
// The index provided MUST be equal to or less than l.lastIndex(). Invalid
// inputs log a warning and the input index is returned.
func (l *raftLog) findConflictByTerm(index uint64, term uint64) uint64 {}

func (l *raftLog) unstableEntries() []pb.Entry {}

// nextEnts returns all the available entries for execution.
// If applied is smaller than the index of snapshot, it returns all committed
// entries after the index of snapshot.
func (l *raftLog) nextEnts() (ents []pb.Entry) {}

// hasNextEnts returns if there is any available entries for execution. This
// is a fast check without heavy raftLog.slice() in raftLog.nextEnts().
func (l *raftLog) hasNextEnts() bool {}

// hasPendingSnapshot returns if there is pending snapshot waiting for applying.
func (l *raftLog) hasPendingSnapshot() bool {}

func (l *raftLog) snapshot() (pb.Snapshot, error) {}

func (l *raftLog) firstIndex() uint64 {}

func (l *raftLog) lastIndex() uint64 {}

func (l *raftLog) commitTo(tocommit uint64) {}

func (l *raftLog) appliedTo(i uint64) {}

func (l *raftLog) stableTo(i, t uint64) {}

func (l *raftLog) stableSnapTo(i uint64) {}

func (l *raftLog) lastTerm() uint64 {}

func (l *raftLog) term(i uint64) (uint64, error) {}

func (l *raftLog) entries(i, maxsize uint64) ([]pb.Entry, error) {}

// allEntries returns all entries in the log.
func (l *raftLog) allEntries() []pb.Entry {}

// isUpToDate determines if the given (lastIndex,term) log is more up-to-date
// by comparing the index and term of the last entries in the existing logs.
// If the logs have last entries with different terms, then the log with the
// later term is more up-to-date. If the logs end with the same term, then
// whichever log has the larger lastIndex is more up-to-date. If the logs are
// the same, the given log is up-to-date.
func (l *raftLog) isUpToDate(lasti, term uint64) bool {}

func (l *raftLog) matchTerm(i, term uint64) bool {}

func (l *raftLog) maybeCommit(maxIndex, term uint64) bool {}

func (l *raftLog) restore(s pb.Snapshot) {}

// slice returns a slice of log entries from lo through hi-1, inclusive.
func (l *raftLog) slice(lo, hi, maxSize uint64) ([]pb.Entry, error) {}

// l.firstIndex <= lo <= hi <= l.firstIndex + len(l.entries)
func (l *raftLog) mustCheckOutOfBounds(lo, hi uint64) error {}

func (l *raftLog) zeroTermOnErrCompacted(t uint64, err error) uint64 {}