Documentation ¶
Index ¶
- Variables
- func New(file string, cfg Config) (database.Database, error)
- type Config
- type Database
- func (db *Database) Close() error
- func (db *Database) Compact(start []byte, limit []byte) error
- func (db *Database) Delete(key []byte) error
- func (db *Database) Get(key []byte) ([]byte, error)
- func (db *Database) Has(key []byte) (bool, error)
- func (db *Database) HealthCheck(_ context.Context) (interface{}, error)
- func (db *Database) NewBatch() database.Batch
- func (db *Database) NewIterator() database.Iterator
- func (db *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator
- func (db *Database) NewIteratorWithStart(start []byte) database.Iterator
- func (db *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator
- func (db *Database) Put(key []byte, value []byte) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidOperation = errors.New("invalid operation")
)
Functions ¶
Types ¶
type Config ¶
type Config struct { CacheSize int // B BytesPerSync int // B WALBytesPerSync int // B (0 disables) MemTableStopWritesThreshold int // num tables MemTableSize int // B MaxOpenFiles int }
func NewDefaultConfig ¶
func NewDefaultConfig() Config
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func (*Database) HealthCheck ¶
func (*Database) NewBatch ¶
NewBatch creates a write/delete-only buffer that is atomically committed to the database when write is called
func (*Database) NewIterator ¶
NewIterator creates a lexicographically ordered iterator over the database
func (*Database) NewIteratorWithPrefix ¶
NewIteratorWithPrefix creates a lexicographically ordered iterator over the database ignoring keys that do not start with the provided prefix
func (*Database) NewIteratorWithStart ¶
NewIteratorWithStart creates a lexicographically ordered iterator over the database starting at the provided key
func (*Database) NewIteratorWithStartAndPrefix ¶
NewIteratorWithStartAndPrefix creates a lexicographically ordered iterator over the database starting at start and ignoring keys that do not start with the provided prefix.
Prefix should be some key contained within [start] or else the lower bound of the iteration will be overwritten with [start].