Documentation ¶
Index ¶
- type PrefixedDatabase
- type PrefixedReader
- type PrefixedWriteTx
- func (t *PrefixedWriteTx) Apply(other db.WriteTx) error
- func (t *PrefixedWriteTx) Commit() error
- func (t *PrefixedWriteTx) Delete(key []byte) error
- func (t *PrefixedWriteTx) Discard()
- func (t *PrefixedWriteTx) Get(key []byte) ([]byte, error)
- func (t *PrefixedWriteTx) Iterate(prefix []byte, callback func(key, value []byte) bool) error
- func (t *PrefixedWriteTx) Set(key, value []byte) error
- func (t *PrefixedWriteTx) Unwrap() db.WriteTx
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.
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