Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithRegistryKeyLen ¶
func WithRegistryKeyLen(keyLen int) func(*NameRegistry)
WithRegistryKeyLen sets the key length for the NameRegistry.
func WithRegistryPrefix ¶
func WithRegistryPrefix(prefix []byte) func(*NameRegistry)
WithRegistryPrefix sets the prefix for the NameRegistry.
Types ¶
type BadgerIterator ¶
type BadgerIterator interface {
Close()
Item() *badger.Item
Next()
Rewind()
Seek(key []byte)
Valid() bool
}
BadgerIterator is the interface that represents a badger iterator.
type BadgerStore ¶
type BadgerStore interface {
StoreInstance[[]byte, *badger.Item, []byte, *badger.Iterator]
SetEntry(e *badger.Entry) error
}
BadgerStore is an store instance that is compatible with *badger.Txn
type Instantiator ¶
Instantiator is an interface that creates a new instance of something from a badger transaction.
type Iterator ¶
type Iterator[K, V any] interface { ValueIterator[V] Key() (K, error) }
Iterator is an interface that extends ValueIterator with a Key method.
type NameRegistry ¶
type NameRegistry struct {
// contains filtered or unexported fields
}
NameRegistry associates a long string name with a unique sized byte slice.
func NewNameRegistry ¶
func NewNameRegistry(db *badger.DB, opts ...func(*NameRegistry)) (*NameRegistry, error)
NewNameRegistry creates a new NameRegistry.
func (*NameRegistry) MustName ¶
func (nreg *NameRegistry) MustName(name string) []byte
MustName is like Name but panics if an error occurs.
type RawKVPair ¶
RawKVPair is a key-value pair with both key and value as byte slices.
func NewRawKVPair ¶
NewRawKVPair creates a new RawKVPair.
type StoreInstance ¶
type StoreInstance[K, G, S any, I BadgerIterator] interface { Delete(key K) error Get(key K) (v G, err error) NewIterator(opts badger.IteratorOptions) I Set(key K, value S) error }
StoreInstance is a store that works with serialized values.
type ValueIterator ¶
type ValueIterator[V any] interface { BadgerIterator Value() (V, error) }
ValueIterator is an interface that extends BadgerIterator with a Value method.