tdb/iteration.go
2020-04-15 23:53:50 -05:00

28 lines
632 B
Go

package tdb
import (
"github.com/golang/protobuf/proto"
bolt "go.etcd.io/bbolt"
)
var (
ContinueIteration IterationSignal = true
StopIteration IterationSignal = false
)
type IterationSignal bool
type Iterable interface {
Iterate(Iterator, ...*Tx) error
IterateKeys(KeyIterator, ...*Tx) error
}
type rawIterable interface {
iterateRaw(rawIterator, ...*Tx) error
}
type rawIterator func(dbPtrValue) (IterationSignal, error)
type Iterator func(proto.Message) (IterationSignal, error)
type KeyIterator func([]byte) (IterationSignal, error)
type keyIteratorWithBucket func([]byte, *bolt.Bucket) (IterationSignal, error)