Documentation
¶
Index ¶
- Variables
- type Option
- type Store
- func (s *Store) Close() error
- func (s *Store) Delete(ctx context.Context, ref *proto.Ref) error
- func (s *Store) Get(ctx context.Context, ref *proto.Ref) (*proto.Object, error)
- func (s *Store) Has(ctx context.Context, ref *proto.Ref) (bool, error)
- func (s *Store) Put(ctx context.Context, object *proto.Object) error
- func (s *Store) Walk(ctx context.Context, load bool, filterFor proto.ObjectType, ...) error
Constants ¶
This section is empty.
Variables ¶
var ErrLocked = errors.New("another process has the store open")
ErrLocked is returned by New when another process has the Store open.
var Logger badger.Logger = slogLogger{}
Logger is a badger.Logger that writes through the default slog logger, so badger's lines come out in the program's log format.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Store)
Option configures a Store.
func WithCapacity ¶
WithCapacity bounds the bytes of objects a Store keeps: past capacity, the objects least recently read or written are deleted. Only a cache should use it, since an evicted object is gone. 0 leaves the store unbounded. The order of last use survives a reopen, to within ten minutes after a crash.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store keeps objects in badger, keyed by ref. Each value is the object header, length-prefixed, followed by the stored bytes; the entry's user meta byte carries the object type so Walk can filter without loading.
func New ¶
New opens or creates a Store at path. It fails with ErrLocked while another process has it open.