Documentation
¶
Index ¶
- func ToDB(db *pebble.DB) storage.DB
- func ToReader(db *pebble.DB) storage.Reader
- func WithReaderBatchWriter(db *pebble.DB, fn func(storage.ReaderBatchWriter) error) error
- type ReaderBatchWriter
- func (b *ReaderBatchWriter) AddCallback(callback func(error))
- func (b *ReaderBatchWriter) Commit() error
- func (b *ReaderBatchWriter) Delete(key []byte) error
- func (b *ReaderBatchWriter) DeleteByRange(globalReader storage.Reader, startPrefix, endPrefix []byte) error
- func (b *ReaderBatchWriter) GlobalReader() storage.Reader
- func (b *ReaderBatchWriter) PebbleWriterBatch() *pebble.Batch
- func (b *ReaderBatchWriter) Set(key, value []byte) error
- func (b *ReaderBatchWriter) Writer() storage.Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithReaderBatchWriter ¶
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.