pebbleimpl

package
v0.38.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToDB

func ToDB(db *pebble.DB) storage.DB

func ToReader

func ToReader(db *pebble.DB) storage.Reader

ToReader is a helper function to convert a *pebble.DB to a Reader

func WithReaderBatchWriter

func WithReaderBatchWriter(db *pebble.DB, fn func(storage.ReaderBatchWriter) error) error

Types

type ReaderBatchWriter

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

func NewReaderBatchWriter

func NewReaderBatchWriter(db *pebble.DB) *ReaderBatchWriter

func (*ReaderBatchWriter) AddCallback

func (b *ReaderBatchWriter) AddCallback(callback func(error))

AddCallback adds a callback to execute after the batch has been flush regardless the batch update is succeeded or failed. The error parameter is the error returned by the batch update.

func (*ReaderBatchWriter) Commit

func (b *ReaderBatchWriter) Commit() error

Commit flushes the batch to the database. No errors expected during normal operation

func (*ReaderBatchWriter) Delete

func (b *ReaderBatchWriter) Delete(key []byte) error

Delete deletes the value for the given key. Deletes are blind all will succeed even if the given key does not exist.

It is safe to modify the contents of the arguments after Delete returns. No errors expected during normal operation

func (*ReaderBatchWriter) DeleteByRange

func (b *ReaderBatchWriter) DeleteByRange(globalReader storage.Reader, startPrefix, endPrefix []byte) error

DeleteByRange removes all keys with a prefix that falls within the range [start, end], both inclusive. It returns error if endPrefix < startPrefix no other errors are expected during normal operation

func (*ReaderBatchWriter) GlobalReader

func (b *ReaderBatchWriter) GlobalReader() storage.Reader

GlobalReader returns a database-backed reader which reads the latest committed global database state ("read-committed isolation"). This reader will not read writes written to ReaderBatchWriter.Writer until the write batch is committed. This reader may observe different values for the same key on subsequent reads.

func (*ReaderBatchWriter) PebbleWriterBatch

func (b *ReaderBatchWriter) PebbleWriterBatch() *pebble.Batch

func (*ReaderBatchWriter) Set

func (b *ReaderBatchWriter) Set(key, value []byte) error

Set sets the value for the given key. It overwrites any previous value for that key; a DB is not a multi-map.

It is safe to modify the contents of the arguments after Set returns. No errors expected during normal operation

func (*ReaderBatchWriter) Writer

func (b *ReaderBatchWriter) Writer() storage.Writer

Writer returns a writer associated with a batch of writes. The batch is pending until it is committed. When we `Write` into the batch, that write operation is added to the pending batch, but not committed. The commit operation is atomic w.r.t. the batch; either all writes are applied to the database, or no writes are. Note: - The writer cannot be used concurrently for writing.

Jump to

Keyboard shortcuts

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