Documentation ¶
Overview ¶
Package rocksdb provides an implementation of the Database interface that is backed by a local RocksDB Key/Value store
Index ¶
- func New(args database.FactoryArgs) (database.DB, error)
- func NewWithDir(dir string, cfg *config.DiskView) (database.DB, error)
- type RocksConfig
- type RocksDB
- func (db *RocksDB) BulkWrite() database.BulkWriter
- func (db *RocksDB) Close() error
- func (db *RocksDB) Compact()
- func (db *RocksDB) Read(key []byte) ([]byte, error)
- func (db *RocksDB) Snapshot() database.Snapshot
- func (db *RocksDB) Write(key []byte, value []byte) error
- func (db *RocksDB) Writes(writes []database.KV) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RocksConfig ¶
type RocksConfig struct { // BlockBasedTableOptions BlockSizeKB int CacheIndexAndFilterBlocks bool PinL0Cache bool BloomFilterBitsPerKey int BlockCacheSizeMB int CompressedBlockCacheSizeMB int // Options IncreaseParallelism *int // explict 0 will use NumCPU AllowConcurrentMemtableWrite bool BytesPerSyncKB uint64 Compression string // "none", "snappy", "zlib", "bz2", "lz4", "lz4hc" [uses "none" if not set] AdviseRandomOnOpen bool AllowMmapReads bool UseDirectReads bool UseAdaptiveMutex bool WriteBufferSizeMB int MaxWriteBuffers int MinWriteBuffersToMerge int TargetFileSizeBaseKB uint64 TargetFileSizeMultiplier int // Stats Logging StatsIntervalMinutes float32 // Metrics collection interval. Can't use time.Duration type as JSON // decoding in Go cannot populate a time.Duration and require extra code // effort. MetricsIntervalMinutes float32 // Write Options DisableWAL bool }
RocksConfig contains all the settings that are configurable. These are used to configure the underlying RocksDB instance.
func DefaultRocksConfig ¶
func DefaultRocksConfig() *RocksConfig
DefaultRocksConfig returns a new RocksConfig instance configured with the recommened defaults.
type RocksDB ¶
type RocksDB struct {
// contains filtered or unexported fields
}
RocksDB provides an implementation of the database.DB interface. Its is backed by an embeded rocksDB key/value store.
func (*RocksDB) BulkWrite ¶
func (db *RocksDB) BulkWrite() database.BulkWriter
BulkWrite returns a new BulkWriter which can be used to buffer up a series of Puts & Deletes, which are applied in chunks. You must call Close() to ensure the last chunk is flushed to the database
func (*RocksDB) Close ¶
Close will close the database, freeing up any memory used by the underlying rocks cache
func (*RocksDB) Compact ¶
func (db *RocksDB) Compact()
Compact runs a manual compaction on the entire keyspace. This is not likely to be needed for typical usage. (unless you've done a significant number of writes)
func (*RocksDB) Read ¶
Read returns the value currently stored for the provided key, if the key doesn't exist nil is returned [is this right?]
func (*RocksDB) Snapshot ¶
Snapshot returns a snapshot of the database at the current point in time it can be used to perform consistent iterations of the database. You must call Close() when you're finished with it to release any related resources.