ref

package
v0.0.0-...-f7bad0d Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RefEntry

type RefEntry struct {
	Prefix        []byte
	OptionalValue []byte // Value stored as the value of index record that can be used in index only queries
	TTL           time.Duration
}

RefEntry is an index that is generated by an Indexer

func NewRefEntry

func NewRefEntry(prefix []byte) RefEntry

NewRefEntry creates a new RefEntry

func (RefEntry) WithTTL

func (e RefEntry) WithTTL(ttl time.Duration) RefEntry

WithTTL sets the TTL of the RefEntry

func (RefEntry) WithValue

func (e RefEntry) WithValue(value []byte) RefEntry

WithValue sets the value of the RefEntry

type Store

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

Store is a store that works with serialized values and also keeps track of multiple secondary indexes.

func New

func New(base badgerutils.BadgerStore) *Store

New creates a new RefStore

func (*Store) Delete

func (s *Store) Delete(prefix []byte) error

Delete deletes all items from the store that have the given prefix

func (*Store) Get

func (s *Store) Get(prefix []byte) ([]byte, error)

Get gets a Ref given its whole key

func (*Store) GetWithItem

func (s *Store) GetWithItem(prefix []byte) (*badger.Item, []byte, error)

GetWithItem gets a Ref given its whole key and also returns the *badger.Item

func (*Store) NewIterator

func (s *Store) NewIterator(opts badger.IteratorOptions) badgerutils.Iterator[[]byte]

NewIterator creates a new reference iterator

func (*Store) Prefix

func (s *Store) Prefix() []byte

Prefix returns the prefix of the store.

func (*Store) Set

func (s *Store) Set(key []byte, e RefEntry) error

Set sets a Ref in the store

Jump to

Keyboard shortcuts

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