Documentation
¶
Index ¶
- type Database
- func (p *Database) Backup(w io.Writer, since uint64) (uint64, error)
- func (p *Database) Close() error
- func (p *Database) Compact(start, limit []byte) error
- func (p *Database) Delete(key []byte) error
- func (p *Database) Get(key []byte) ([]byte, error)
- func (p *Database) Has(key []byte) (bool, error)
- func (p *Database) HealthCheck(ctx context.Context) (interface{}, error)
- func (p *Database) Load(r io.Reader) error
- func (p *Database) NewBatch() database.Batch
- func (p *Database) NewIterator() database.Iterator
- func (p *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator
- func (p *Database) NewIteratorWithStart(start []byte) database.Iterator
- func (p *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator
- func (p *Database) Put(key, value []byte) error
- func (p *Database) Sync() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database partitions a database into a sub-database by prefixing all keys with a unique value.
func (*Database) HealthCheck ¶
HealthCheck implements the database.Database interface.
func (*Database) NewIterator ¶
NewIterator implements the database.Database interface.
func (*Database) NewIteratorWithPrefix ¶
NewIteratorWithPrefix implements the database.Database interface.
func (*Database) NewIteratorWithStart ¶
NewIteratorWithStart implements the database.Database interface.
func (*Database) NewIteratorWithStartAndPrefix ¶
NewIteratorWithStartAndPrefix implements the database.Database interface.
prefixedStart MUST be derived only when the caller supplied a start: a nil start means "begin at the prefix", and the underlying store seeks to the prefix itself. Synthesizing start = p.prefix for a nil start would seek the underlying iterator to the FRONT of this partition (p.prefix), which sorts BEFORE p.prefix+prefix; with intervening keys under other sub-prefixes a store that stops at the first non-matching key after a start-seek (zapdb) then returns zero rows for a prefix that does exist. Each prefixed key is also built in its OWN buffer (prefixKey) so the two never alias p.prefix's backing array.