Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
NewStaticIterator returns a new writelog iterator that's backed by a static in-memory array.
type LogEntry ¶
LogEntry is a write log entry.
func (*LogEntry) MarshalJSON ¶
func (*LogEntry) Type ¶
func (k *LogEntry) Type() LogEntryType
Type returns the type of the write log entry.
func (*LogEntry) UnmarshalJSON ¶
type LogEntryAnnotation ¶
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)