Documentation
¶
Overview ¶
Package pebble is a backup.ObjectStore on a local pebble database, for caches that should hold little memory.
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.
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 pebble, keyed by ref. Each value is the object type, the length-prefixed object header and the stored bytes. Every object has a used key beside it holding its size and last use.
func New ¶
New opens or creates a Store at path. It fails with ErrLocked while another process has it open.