kv

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultComparer = &pebble.Comparer{
	Compare: func(a, b []byte) int {
		an := encoding.Split(a)
		bn := encoding.Split(b)
		if prefixCmp := bytes.Compare(a[:an], b[:bn]); prefixCmp != 0 {
			return prefixCmp
		}
		return encoding.Compare(a[an:], b[bn:])
	},
	Equal:          encoding.Equal,
	AbbreviatedKey: encoding.AbbreviatedKey,
	FormatKey:      pebble.DefaultComparer.FormatKey,
	Separator:      encoding.Separator,
	Successor: func(dst, a []byte) []byte {
		return a
	},
	Split:                encoding.Split,
	ComparePointSuffixes: encoding.Compare,
	CompareRangeSuffixes: encoding.Compare,

	Name: "leveldb.BytewiseComparator",
}

DefaultComparer is the default implementation of the Comparer interface for chai.

Functions

This section is empty.

Types

type BatchSession

type BatchSession struct {
	Store *PebbleEngine
	DB    *pebble.DB
	Batch *pebble.Batch
	// contains filtered or unexported fields
}

func (*BatchSession) Close

func (s *BatchSession) Close() error

func (*BatchSession) Commit

func (s *BatchSession) Commit() error

func (*BatchSession) Delete

func (s *BatchSession) Delete(k []byte) error

Delete a record by key. If the key doesn't exist, it doesn't do anything.

func (*BatchSession) DeleteRange

func (s *BatchSession) DeleteRange(start []byte, end []byte) error

DeleteRange deletes all keys in the given range. This implementation deletes all keys one by one to simplify the rollback.

func (*BatchSession) Exists

func (s *BatchSession) Exists(k []byte) (bool, error)

Exists returns whether a key exists and is visible by the current session.

func (*BatchSession) Get

func (s *BatchSession) Get(k []byte) ([]byte, error)

Get returns a value associated with the given key. If not found, returns ErrKeyNotFound.

func (*BatchSession) Insert

func (s *BatchSession) Insert(k, v []byte) error

Insert inserts a key-value pair. If it already exists, it returns ErrKeyAlreadyExists.

func (*BatchSession) Iterator

func (s *BatchSession) Iterator(opts *engine.IterOptions) (engine.Iterator, error)

func (*BatchSession) Put

func (s *BatchSession) Put(k, v []byte) error

Put stores a key value pair. If it already exists, it overrides it.

type Options

type Options struct {
	RollbackSegmentNamespace int64
	MaxBatchSize             int
	MaxTransientBatchSize    int
	MinTransientNamespace    uint64
	MaxTransientNamespace    uint64
}

type PebbleEngine added in v0.17.0

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

func NewEngine

func NewEngine(path string, opts Options) (*PebbleEngine, error)

func NewEngineWith

func NewEngineWith(path string, opts Options, popts *pebble.Options) (*PebbleEngine, error)

func NewStore

func NewStore(db *pebble.DB, opts Options) *PebbleEngine

func (*PebbleEngine) CleanupTransientNamespaces added in v0.17.0

func (s *PebbleEngine) CleanupTransientNamespaces() error

func (*PebbleEngine) Close added in v0.17.0

func (s *PebbleEngine) Close() error

func (*PebbleEngine) DB added in v0.17.0

func (s *PebbleEngine) DB() *pebble.DB

func (*PebbleEngine) LockSharedSnapshot added in v0.17.0

func (s *PebbleEngine) LockSharedSnapshot()

func (*PebbleEngine) NewBatchSession added in v0.17.0

func (s *PebbleEngine) NewBatchSession() engine.Session

func (*PebbleEngine) NewSnapshotSession added in v0.17.0

func (s *PebbleEngine) NewSnapshotSession() engine.Session

func (*PebbleEngine) NewTransientSession added in v0.17.0

func (s *PebbleEngine) NewTransientSession() engine.Session

func (*PebbleEngine) Recover added in v0.17.0

func (s *PebbleEngine) Recover() error

func (*PebbleEngine) Rollback added in v0.17.0

func (s *PebbleEngine) Rollback() error

func (*PebbleEngine) UnlockSharedSnapshot added in v0.17.0

func (s *PebbleEngine) UnlockSharedSnapshot()

type RollbackSegment

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

func NewRollbackSegment

func NewRollbackSegment(db *pebble.DB, namespace int64) *RollbackSegment

func (*RollbackSegment) Apply

func (s *RollbackSegment) Apply(b *pebble.Batch) error

func (*RollbackSegment) Clear

func (s *RollbackSegment) Clear(b *pebble.Batch) error

func (*RollbackSegment) Reset

func (s *RollbackSegment) Reset() error

func (*RollbackSegment) Rollback

func (s *RollbackSegment) Rollback() error

type SnapshotSession

type SnapshotSession struct {
	Store    *PebbleEngine
	Snapshot *snapshot
	// contains filtered or unexported fields
}

func (*SnapshotSession) Close

func (s *SnapshotSession) Close() error

func (*SnapshotSession) Commit

func (s *SnapshotSession) Commit() error

func (*SnapshotSession) Delete

func (s *SnapshotSession) Delete(k []byte) error

Delete a record by key. If not found, returns ErrKeyNotFound.

func (*SnapshotSession) DeleteRange

func (s *SnapshotSession) DeleteRange(start []byte, end []byte) error

func (*SnapshotSession) Exists

func (s *SnapshotSession) Exists(k []byte) (bool, error)

Exists returns whether a key exists and is visible by the current session.

func (*SnapshotSession) Get

func (s *SnapshotSession) Get(k []byte) ([]byte, error)

Get returns a value associated with the given key. If not found, returns ErrKeyNotFound.

func (*SnapshotSession) Insert

func (s *SnapshotSession) Insert(k, v []byte) error

func (*SnapshotSession) Iterator

func (s *SnapshotSession) Iterator(opts *engine.IterOptions) (engine.Iterator, error)

func (*SnapshotSession) Put

func (s *SnapshotSession) Put(k, v []byte) error

type TransientSession

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

func (*TransientSession) Close

func (s *TransientSession) Close() error

func (*TransientSession) Commit

func (s *TransientSession) Commit() error

func (*TransientSession) Delete

func (s *TransientSession) Delete(k []byte) error

Delete a record by key. If not found, returns ErrKeyNotFound.

func (*TransientSession) DeleteRange

func (s *TransientSession) DeleteRange(start []byte, end []byte) error

func (*TransientSession) Exists

func (s *TransientSession) Exists(k []byte) (bool, error)

Exists returns whether a key exists and is visible by the current session.

func (*TransientSession) Get

func (s *TransientSession) Get(k []byte) ([]byte, error)

Get returns a value associated with the given key. If not found, returns ErrKeyNotFound.

func (*TransientSession) Insert

func (s *TransientSession) Insert(k, v []byte) error

func (*TransientSession) Iterator

func (s *TransientSession) Iterator(opts *engine.IterOptions) (engine.Iterator, error)

func (*TransientSession) Put

func (s *TransientSession) Put(k, v []byte) error

Put stores a key value pair. If it already exists, it overrides it.

Jump to

Keyboard shortcuts

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