Help us shape the future of Go! Take the 2026 Go Developer Survey

metadata

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default block cache size in bytes
	DefaultRocksDBBlockCacheSize = 1 << 30 // 1GB

	// DefaultRocksDBMaxBackgroundJobs is the default number of concurrent
	// RocksDB background jobs (compactions + flushes) for the lifetime of the DB.
	DefaultRocksDBMaxBackgroundJobs = 8
)

Variables

This section is empty.

Functions

func CreateBlockBasedTableOptions

func CreateBlockBasedTableOptions(config *RocksDBConfig) *grocksdb.BlockBasedTableOptions

CreateBlockBasedTableOptions creates optimized table options for 4KB values with prefixes

func CreateOptions

func CreateOptions(config *RocksDBConfig, mergeOp grocksdb.MergeOperator) *grocksdb.Options

CreateOptions creates optimized RocksDB options for 4KB values with prefixes

func CreatePrefixExtractor

func CreatePrefixExtractor(prefixLength int) grocksdb.SliceTransform

CreatePrefixExtractor creates a prefix extractor for the given prefix length

func CreateReadOptions

func CreateReadOptions(prefixSeek bool, cacheBlocks bool) *grocksdb.ReadOptions

CreateReadOptions creates optimized read options for prefix-based queries

func LogConfiguration

func LogConfiguration(config *RocksDBConfig)

LogConfiguration logs the RocksDB configuration for debugging

Types

type MetaDB

type MetaDB struct {
	// contains filtered or unexported fields
}

func NewMetaDB

func NewMetaDB(diskPath string, ttl int, mergeOp grocksdb.MergeOperator, config *RocksDBConfig) (*MetaDB, error)

NewMetaDB creates a new isolated MetaDB instance with custom configuration. The caller is responsible for calling Close() on the returned instance.

func (*MetaDB) Close

func (m *MetaDB) Close()

Close closes this MetaDB instance. This is safe to call on isolated instances.

func (*MetaDB) Handle

func (m *MetaDB) Handle() *grocksdb.DB

Handle returns the underlying RocksDB handle.

type RocksDBConfig

type RocksDBConfig struct {
	// Block cache size in bytes
	BlockCacheSize int64
	// Write buffer size in bytes
	WriteBufferSize int
	// Maximum number of write buffers
	MaxWriteBufferNumber int
	// Minimum write buffers to merge
	MinWriteBufferNumberToMerge int
	// Total write buffer size limit
	DbWriteBufferSize int64
	// Block size in bytes
	BlockSize int
	// Bloom filter bits per key
	BloomBitsPerKey int
	// Enable statistics collection
	EnableStatistics bool
	// Target file size base in bytes
	TargetFileSizeBase int64
	// Maximum background jobs
	MaxBackgroundJobs int
	// Level0 file number compaction trigger
	Level0FileNumCompactionTrigger int
	// Level0 slowdown writes trigger
	Level0SlowdownWritesTrigger int
	// Level0 stop writes trigger
	Level0StopWritesTrigger int
}

RocksDBConfig holds all RocksDB-specific configuration parameters

func DefaultRocksDBConfig

func DefaultRocksDBConfig() *RocksDBConfig

DefaultRocksDBConfig returns the default configuration optimized for 4KB values with prefixes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL