prefixeddb

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: AGPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrefixedDatabase

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

PrefixedDatabase wraps a db.Database prefixing all keys with `prefix`.

func NewPrefixedDatabase

func NewPrefixedDatabase(db db.Database, prefix []byte) *PrefixedDatabase

NewPrefixedDatabase creates a new PrefixedDatabase. If the db is already a PrefixedDatabase, instead of wrapping again, the prefixes are appended to avoid unnecessary layers.

func (*PrefixedDatabase) Close

func (d *PrefixedDatabase) Close() error

Close implements the db.Database.Close interface method. Notice that this method also closes the wrapped db.Database.

func (*PrefixedDatabase) Compact added in v1.9.0

func (d *PrefixedDatabase) Compact() error

Compact implements the db.Database.Compact interface method.

func (*PrefixedDatabase) Get added in v1.9.0

func (d *PrefixedDatabase) Get(key []byte) ([]byte, error)

Get implements the db.Database.Get interface method

func (*PrefixedDatabase) Iterate

func (d *PrefixedDatabase) Iterate(prefix []byte, callback func(key, value []byte) bool) error

Iterate implements the db.Database.Iterate interface method

func (*PrefixedDatabase) WriteTx

func (d *PrefixedDatabase) WriteTx() db.WriteTx

WriteTx returns a db.WriteTx

type PrefixedReader added in v1.9.0

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

PrefixedReader wraps a Reader tx prefixing all keys with `prefix`.

func NewPrefixedReader added in v1.9.0

func NewPrefixedReader(rd db.Reader, prefix []byte) *PrefixedReader

NewPrefixedReader creates a new PrefixedReader. If the rd is already a PrefixedReader, instead of wrapping again, the prefixes are appended to avoid unnecessary layers.

func (*PrefixedReader) Get added in v1.9.0

func (d *PrefixedReader) Get(key []byte) ([]byte, error)

func (*PrefixedReader) Iterate added in v1.9.0

func (d *PrefixedReader) Iterate(prefix []byte, callback func(key, value []byte) bool) error

Iterate implements the db.Database.Iterate interface method

type PrefixedWriteTx

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

PrefixedWriteTx wraps a WriteTx prefixing all keys with `prefix`.

func NewPrefixedWriteTx

func NewPrefixedWriteTx(tx db.WriteTx, prefix []byte) *PrefixedWriteTx

NewPrefixedWriteTx creates a new db.WriteTx. If the tx is already a PrefixedWriteTx, instead of wrapping again, the prefixes are appended to avoid unnecessary layers.

func (*PrefixedWriteTx) Apply

func (t *PrefixedWriteTx) Apply(other db.WriteTx) error

Apply implements the db.WriteTx.Apply interface method

func (*PrefixedWriteTx) Commit

func (t *PrefixedWriteTx) Commit() error

Commit implements the db.WriteTx.Commit interface method. Notice that this method also commits the wrapped db.WriteTx.

func (*PrefixedWriteTx) Delete

func (t *PrefixedWriteTx) Delete(key []byte) error

Delete implements the db.WriteTx.Delete interface method

func (*PrefixedWriteTx) Discard

func (t *PrefixedWriteTx) Discard()

Discard implements the db.WriteTx.Discard interface method. Notice that this method also discards the wrapped db.WriteTx.

func (*PrefixedWriteTx) Get

func (t *PrefixedWriteTx) Get(key []byte) ([]byte, error)

Get implements the db.WriteTx.Get interface method

func (*PrefixedWriteTx) Iterate added in v1.9.0

func (t *PrefixedWriteTx) Iterate(prefix []byte, callback func(key, value []byte) bool) error

func (*PrefixedWriteTx) Set

func (t *PrefixedWriteTx) Set(key, value []byte) error

Set implements the db.WriteTx.Set interface method

func (*PrefixedWriteTx) Unwrap

func (t *PrefixedWriteTx) Unwrap() db.WriteTx

Unwrap returns the wrapped WriteTx

Jump to

Keyboard shortcuts

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