logdb

package
v0.0.0-...-93a8726 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogDBCallback

type LogDBCallback func(LogDBInfo)

LogDBCallback is called by the LogDB layer whenever NodeHost is required to be notified for the status change of the LogDB.

type LogDBInfo

type LogDBInfo struct {
	Shard uint64
	Busy  bool
}

LogDBInfo is the info provided when LogDBCallback is invoked.

type LogReader

type LogReader struct {
	sync.Mutex
	// contains filtered or unexported fields
}

LogReader is the struct used to manage logs that have already been persisted into LogDB. This implementation is influenced by CockroachDB's replicaRaftStorage.

func NewLogReader

func NewLogReader(clusterID uint64,
	nodeID uint64, logdb raftio.ILogDB) *LogReader

NewLogReader creates and returns a new LogReader instance.

func (*LogReader) Append

func (lr *LogReader) Append(entries []pb.Entry) error

Append marks the specified entries as persisted and make them available from logreader.

func (*LogReader) ApplySnapshot

func (lr *LogReader) ApplySnapshot(snapshot pb.Snapshot) error

ApplySnapshot applies the specified snapshot.

func (*LogReader) Compact

func (lr *LogReader) Compact(index uint64) error

Compact compacts raft log entries up to index.

func (*LogReader) CreateSnapshot

func (lr *LogReader) CreateSnapshot(snapshot pb.Snapshot) error

CreateSnapshot keeps the metadata of the specified snapshot.

func (*LogReader) Entries

func (lr *LogReader) Entries(low uint64,
	high uint64, maxSize uint64) ([]pb.Entry, error)

Entries returns persisted entries between [low, high) with a total limit of up to maxSize bytes.

func (*LogReader) GetRange

func (lr *LogReader) GetRange() (uint64, uint64)

GetRange returns the index range of all logs managed by the LogReader instance.

func (*LogReader) NodeState

func (lr *LogReader) NodeState() (pb.State, pb.Membership)

NodeState returns the initial state.

func (*LogReader) SetCompactor

func (lr *LogReader) SetCompactor(c pb.ICompactor)

SetCompactor sets the compactor or the LogReader instance.

func (*LogReader) SetRange

func (lr *LogReader) SetRange(firstIndex uint64, length uint64)

SetRange updates the LogReader to reflect what is available in it.

func (*LogReader) SetState

func (lr *LogReader) SetState(s pb.State)

SetState sets the persistent state.

func (*LogReader) Snapshot

func (lr *LogReader) Snapshot() pb.Snapshot

Snapshot returns the metadata of the lastest snapshot.

func (*LogReader) Term

func (lr *LogReader) Term(index uint64) (uint64, error)

Term returns the term of the entry specified by the entry index.

Jump to

Keyboard shortcuts

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