Documentation
¶
Index ¶
- Variables
- func Diff(ctx context.Context, s cadata.Store, leftIt, rightIt Iterator, span Span, ...) error
- func ForEach(ctx context.Context, it Iterator, fn func(ent Entry) error) error
- func KeyAfter(x []byte) []byte
- func PrefixEnd(prefix []byte) []byte
- type DiffFn
- type Entry
- type Iterator
- type Merger
- type Span
Constants ¶
This section is empty.
Variables ¶
View Source
var EOS = fmt.Errorf("end of stream")
EOS signals the end of a stream
Functions ¶
func Diff ¶
func Diff(ctx context.Context, s cadata.Store, leftIt, rightIt Iterator, span Span, fn DiffFn) error
Diff calls fn with all the keys and values that are different between the two Iterators
Types ¶
type Iterator ¶
type Iterator interface {
Next(ctx context.Context, ent *Entry) error
Seek(ctx context.Context, gteq []byte) error
Peek(ctx context.Context, ent *Entry) error
}
Iterator iterates over entries
e.g.
if err := it.Seek(ctx, key); err != nil {
return err
}
var ent Entry
for err := it.Next(ctx, &ent); err != EOS; err = it.Next(ctx, &ent) {
if err != nil {
return err
}
// use ent here. ent will be valid until the next call to it.Next
}
type Span ¶
type Span struct {
Start, End []byte
}
A span of keys [Start, End) If you want to include a specific end key, use the KeyAfter function. nil is interpretted as no bound, not as a 0 length key. This behaviour is only releveant for End.
func PrefixSpan ¶
PrefixSpan returns a Span that includes all keys with prefix p
func SingleItemSpan ¶
func (Span) GreaterThan ¶
GreaterThan returns true if every key in the span is greater than k
Click to show internal directories.
Click to hide internal directories.