Documentation
¶
Index ¶
- Constants
- Variables
- type PeristentLogState
- 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 string = "log_entries" LogMetaFileName string = "logmetainfo" )
Variables ¶
var ErrIndexBelowStartIndex = errors.New("given index is below start index")
var Log *logger.ParanoidLogger
Functions ¶
This section is empty.
Types ¶
type PeristentLogState ¶
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 ¶
Used 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 ¶
func (*RaftLog) GetLogSizeBytes ¶
func (*RaftLog) GetMostRecentIndex ¶
GetMostRecentIndex returns the index of the last log entry
func (*RaftLog) GetMostRecentTerm ¶
GetMostRecentTerm returns the term of the last log entry