Help us shape the future of Go! Take the 2026 Go Developer Survey

pebble

package
v1.117.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package pebble is a backup.ObjectStore on a local pebble database, for caches that should hold little memory.

Index

Constants

This section is empty.

Variables

View Source
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

func WithCapacity(capacity int64) Option

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

func New(path string, with ...Option) (*Store, error)

New opens or creates a Store at path. It fails with ErrLocked while another process has it open.

func (*Store) Close

func (s *Store) Close() error

Close releases the database.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, ref *proto.Ref) error

Delete implements backup.ObjectStore.

func (*Store) Get

func (s *Store) Get(ctx context.Context, ref *proto.Ref) (*proto.Object, error)

Get implements backup.ObjectStore.

func (*Store) Has

func (s *Store) Has(ctx context.Context, ref *proto.Ref) (bool, error)

Has implements backup.ObjectStore.

func (*Store) Put

func (s *Store) Put(ctx context.Context, object *proto.Object) error

Put implements backup.ObjectStore.

func (*Store) Walk

func (s *Store) Walk(ctx context.Context, load bool, filterFor proto.ObjectType, receiver backup.ObjectReceiver) error

Walk implements backup.ObjectStore.

Jump to

Keyboard shortcuts

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