storage

package
v0.0.0-...-fcadf4f Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound    = errors.New("key not found")
	ErrBucketNotFound = errors.New("bucket not found")
	ErrBucketExists   = errors.New("bucket already exists")
	ErrTxClosed       = errors.New("transaction closed")
	ErrDatabaseClosed = errors.New("database closed")
)

Functions

func GetRevision

func GetRevision(s Storage) (int64, error)

func ParseRevisionKey

func ParseRevisionKey(b []byte) (int64, error)

func PutRevision

func PutRevision(s Storage, revision int64) error

func RevisionKey

func RevisionKey(revision int64) []byte

Types

type BoltBackend

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

func NewBoltBackend

func NewBoltBackend(path string) *BoltBackend

func (*BoltBackend) Close

func (b *BoltBackend) Close() error

func (*BoltBackend) CreateBucket

func (b *BoltBackend) CreateBucket(name []byte) error

func (*BoltBackend) Delete

func (b *BoltBackend) Delete(bucket, key []byte) error

func (*BoltBackend) DeleteBucket

func (b *BoltBackend) DeleteBucket(name []byte) error

func (*BoltBackend) ForEach

func (b *BoltBackend) ForEach(bucket []byte, fn func(k, v []byte) error) error

ForEach iterates over all keys in a bucket

func (*BoltBackend) Get

func (b *BoltBackend) Get(bucket, key []byte) ([]byte, error)

func (*BoltBackend) Open

func (b *BoltBackend) Open() error

func (*BoltBackend) Put

func (b *BoltBackend) Put(bucket, key, value []byte) error

type OpType

type OpType int
const (
	OpPut OpType = iota
	OpDelete
)

type Storage

type Storage interface {
	Open() error

	Close() error

	Get(bucket, key []byte) ([]byte, error)

	Put(bucket, key, value []byte) error

	Delete(bucket, key []byte) error

	// CreateBucket creates a new bucket
	CreateBucket(name []byte) error

	DeleteBucket(name []byte) error

	ForEach(bucket []byte, fn func(k, v []byte) error) error
}

Storage defines the interface for persistent storage

Jump to

Keyboard shortcuts

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