writelog

package
v0.2202.5 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrIteratorInvalid is raised when Value() is called on an iterator that finished already or hasn't started yet.
	ErrIteratorInvalid = errors.New("mkvs: write log iterator invalid")
)

Functions

func DrainIterator

func DrainIterator(it Iterator) error

DrainIterator drains the iterator, discarding all values.

Types

type Annotations

type Annotations []LogEntryAnnotation

Annotations are extra metadata about write log entries.

This should always be passed alongside a WriteLog.

type Iterator

type Iterator interface {
	// Next advances the iterator to the next element and returns false if there are no more elements.
	Next() (bool, error)
	// Value returns the log entry the iterator is currently pointing to.
	Value() (LogEntry, error)
}

Iterator iterates over MKVS write log entries between two different storage instances.

func NewStaticIterator

func NewStaticIterator(writeLog WriteLog) Iterator

NewStaticIterator returns a new writelog iterator that's backed by a static in-memory array.

type LogEntry

type LogEntry struct {
	Key   []byte
	Value []byte
	// contains filtered or unexported fields
}

LogEntry is a write log entry.

func (*LogEntry) Equal

func (k *LogEntry) Equal(cmp *LogEntry) bool

Equal compares vs another log entry for equality.

func (*LogEntry) MarshalJSON

func (k *LogEntry) MarshalJSON() ([]byte, error)

func (*LogEntry) Type

func (k *LogEntry) Type() LogEntryType

Type returns the type of the write log entry.

func (*LogEntry) UnmarshalJSON

func (k *LogEntry) UnmarshalJSON(src []byte) error

type LogEntryAnnotation

type LogEntryAnnotation struct {
	InsertedNode *node.Pointer
}

LogEntryAnnotation is an annotation for a single write log entry.

Entries in a WriteLogAnnotation correspond to WriteLog entries at their respective indexes.

type LogEntryType

type LogEntryType int

LogEntryType is a type of a write log entry.

const (
	LogInsert LogEntryType = iota
	LogDelete
)

type PipeIterator

type PipeIterator struct {
	// contains filtered or unexported fields
}

PipeIterator is a queue-backed writelog iterator which can be asynchronously both pushed into and read from.

func NewPipeIterator

func NewPipeIterator(ctx context.Context) PipeIterator

NewPipeIterator returns a new PipeIterator.

func (*PipeIterator) Close

func (i *PipeIterator) Close()

Close signals an end of the log entry stream to the iterator's read side.

func (*PipeIterator) Next

func (i *PipeIterator) Next() (bool, error)

func (*PipeIterator) Put

func (i *PipeIterator) Put(logEntry *LogEntry) error

func (*PipeIterator) PutError

func (i *PipeIterator) PutError(err error) error

PutError pushed an error to the iterator's read side.

func (*PipeIterator) Value

func (i *PipeIterator) Value() (LogEntry, error)

type WriteLog

type WriteLog []LogEntry

WriteLog is a write log.

The keys in the write log must be unique.

func (WriteLog) Equal

func (wl WriteLog) Equal(cmp WriteLog) bool

Equal compares vs another write log for equality.

Jump to

Keyboard shortcuts

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