log

package
v0.0.0-...-f429149 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Index raft.Index
	Entry *raft.LogEntry
}

Entry is an indexed Raft log entry

type Log

type Log interface {
	io.Closer

	// Writer returns the Raft log writer
	Writer() Writer

	// OpenReader opens a Raft log reader
	OpenReader(index raft.Index) Reader
}

Log provides for reading and writing entries in the Raft log

func NewMemoryLog

func NewMemoryLog() Log

NewMemoryLog creates a new in-memory Log

type Reader

type Reader interface {
	io.Closer

	// FirstIndex returns the first index in the log
	FirstIndex() raft.Index

	// LastIndex returns the last index in the log
	LastIndex() raft.Index

	// CurrentIndex returns the current index of the reader
	CurrentIndex() raft.Index

	// CurrentEntry returns the current Entry
	CurrentEntry() *Entry

	// NextIndex returns the next index in the log
	NextIndex() raft.Index

	// NextEntry advances the log index and returns the next entry in the log
	NextEntry() *Entry

	// Reset resets the log reader to the given index
	Reset(index raft.Index)
}

Reader supports reading of entries from the Raft log

type Writer

type Writer interface {
	io.Closer

	// LastIndex returns the last index written to the log
	LastIndex() raft.Index

	// LastEntry returns the last entry written to the log
	LastEntry() *Entry

	// Append appends the given entry to the log
	Append(entry *raft.LogEntry) *Entry

	// Reset resets the log writer to the given index
	Reset(index raft.Index)

	// Truncate truncates the tail of the log to the given index
	Truncate(index raft.Index)
}

Writer supports writing entries to the Raft log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL