Documentation
¶
Index ¶
Constants ¶
const IdealBatchSize = 100 * 1024
Code using batches should try to add this much data to the batch. The value was determined empirically.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch interface {
Putter
Deleter
Referencer
Dereferencer
ValueSize() int // amount of data in the batch
Write() error
// Reset resets the batch for reuse
Reset()
}
Batch is a write-only database that commits changes to its host database when Write is called. Batch cannot be used concurrently.
type Database ¶
type Database interface {
Putter
Deleter
Referencer
Dereferencer
Get(key []byte) ([]byte, error)
Has(key []byte) (bool, error)
CountReference(key []byte) (int, error)
Close()
NewBatch() Batch
}
Database wraps all database operations. All methods are safe for concurrent use.
type Deleter ¶
Deleter wraps the database delete operation supported by both batches and regular databases.
type Dereferencer ¶
Dereferencer wraps the database dereference operation supported by both batches and regular databases.
type Putter ¶
Putter wraps the database write operation supported by both batches and regular databases.
type Referencer ¶
Referencer wraps the database reference operation supported by both batches and regular databases.