pebble

package
v0.0.0-...-ae24e80 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultListPageSize = 25

DefaultListPageSize is the default page size for listing items.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend[K comparable, V any] struct {
	// contains filtered or unexported fields
}

Backend is a storage backend that uses Pebble as the underlying storage engine.

Pebble can use an in-memory filesystem or a directory on disk for storage, depending on the options provided. By default, this application uses a directory on disk.

func NewBackend

func NewBackend[K comparable, V any](dirname string, opts *pebble.Options, codec storage.Codec[K, V]) (*Backend[K, V], error)

NewBackend creates a new Pebble storage backend.

func (*Backend[K, V]) Close

func (b *Backend[K, V]) Close(ctx context.Context) error

Close closes the storage backend.

func (*Backend[K, V]) Delete

func (b *Backend[K, V]) Delete(ctx context.Context, key K) error

Delete removes a key-value pair from the storage backend.

func (*Backend[K, V]) Flush

func (b *Backend[K, V]) Flush(ctx context.Context) error

Flush flushes the storage backend.

func (*Backend[K, V]) Get

func (b *Backend[K, V]) Get(ctx context.Context, key K) (V, bool, error)

Get retrieves a value from the storage backend by its key.

func (*Backend[K, V]) List

func (b *Backend[K, V]) List(ctx context.Context, pageSize *int, pageToken *K) (iter.Seq2[K, V], *K, error)

List retrieves a list of key-value pairs from the storage backend.

func (*Backend[K, V]) Set

func (b *Backend[K, V]) Set(ctx context.Context, key K, value V) error

Set stores a key-value pair in the storage backend.

Jump to

Keyboard shortcuts

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