Documentation
¶
Index ¶
- Constants
- func BoolToChar(b bool) C.uchar
- func CharToBool(cChar C.uchar) bool
- type BackupEngine
- func (e *BackupEngine) BackupDatabase(db *RocksDB, flushMemtable bool) error
- func (e *BackupEngine) FreeBackupEngine()
- func (e *BackupEngine) GetInfo() *BackupEngineInfo
- func (e *BackupEngine) PurgeOldBackups(numBackupsToKeep uint32) error
- func (e *BackupEngine) RestoreFromLastBackup(destPath string, keepLogFiles bool) error
- type BackupEngineInfo
- func (bi *BackupEngineInfo) Free()
- func (bi *BackupEngineInfo) GetBackupID(index int) int64
- func (bi *BackupEngineInfo) GetCount() int
- func (bi *BackupEngineInfo) GetNumFiles(index int) int32
- func (bi *BackupEngineInfo) GetSize(index int) int64
- func (bi *BackupEngineInfo) GetTimestamp(index int) int64
- type Batch
- type BlockBasedOptions
- type CompactionStyle
- type CompressionType
- type FilterPolicy
- type Iterator
- func (i *Iterator) FreeIterator()
- func (i *Iterator) GetError() error
- func (i *Iterator) IsValid() bool
- func (i *Iterator) Key() []byte
- func (i *Iterator) Next()
- func (i *Iterator) Prev()
- func (i *Iterator) Seek(key []byte)
- func (i *Iterator) SeekForPrev(key []byte)
- func (i *Iterator) SeekToFirst()
- func (i *Iterator) Value() []byte
- type LRUCache
- type Options
- func (options *Options) EnableCreateIfMissing()
- func (options *Options) EnableErrorIfExists()
- func (options *Options) EnableStatistics()
- func (options *Options) FreeOptions()
- func (options *Options) GetCache() *LRUCache
- func (options *Options) GetStatisticsString() string
- func (options *Options) OptimizeLevelStyleCompaction(memtableMemoryBudget uint64)
- func (options *Options) OptimizeUniversalStyleCompaction(memtableMemoryBudget uint64)
- func (options *Options) PrepareForBulkLoad()
- func (options *Options) SetBottommostCompression(compression CompressionType)
- func (options *Options) SetCompactOnDeletion(windowSize int, numDelsTrigger int)
- func (options *Options) SetCompactionStyle(style CompactionStyle)
- func (options *Options) SetCompression(compression CompressionType)
- func (options *Options) SetCompressionPerLevel(levelValues []CompressionType)
- func (options *Options) SetDeleteObsoleteFilesPeriodMicros(micros uint)
- func (options *Options) SetDisableAutoCompactions(v bool)
- func (options *Options) SetFullBloomFilter(fullBloomBits int)
- func (options *Options) SetKeepLogFileNum(num uint)
- func (options *Options) SetLRUCacheSize(capacity int)
- func (options *Options) SetLevel0FileNumCompactionTrigger(num int)
- func (options *Options) SetMaxBytesForLevelBase(size int)
- func (options *Options) SetMaxOpenFiles(numFiles int)
- func (options *Options) SetMaxSubcompactions(n int)
- func (options *Options) SetMaxWriteBufferNumber(num int)
- func (options *Options) SetMinWriteBufferNumberToMerge(num int)
- func (options *Options) SetNumLevels(numLevels int)
- func (options *Options) SetParallelism(parallelism int)
- func (options *Options) SetPrefixExtractorSize(prefixSize int)
- func (options *Options) SetTargetFileSizeBase(size int)
- func (options *Options) SetWriteBufferSize(size int)
- type ReadOptions
- func (readOptions *ReadOptions) FreeReadOptions()
- func (readOptions *ReadOptions) SetFillCache(fillCache bool)
- func (readOptions *ReadOptions) SetIterateLowerBound(key []byte)
- func (readOptions *ReadOptions) SetIterateUpperBound(key []byte)
- func (readOptions *ReadOptions) SetSnapshot(snapshot *Snapshot)
- func (readOptions *ReadOptions) SetVerifyChecksums(verifyChecksum bool)
- func (readOptions *ReadOptions) UnsetSnapshot()
- type RocksDB
- func (db *RocksDB) CatchWithPrimary() error
- func (db *RocksDB) CloseDatabase()
- func (db *RocksDB) CompactRangeAll()
- func (db *RocksDB) CreateIterator(readOptions *ReadOptions) *Iterator
- func (db *RocksDB) Delete(writeOptions *WriteOptions, key []byte) error
- func (db *RocksDB) DeleteStr(writeOptions *WriteOptions, key string) error
- func (db *RocksDB) ExecuteBatch(batch *Batch, writeOptions *WriteOptions) error
- func (db *RocksDB) Flush() error
- func (db *RocksDB) Get(readOptions *ReadOptions, key []byte) ([]byte, error)
- func (db *RocksDB) GetMulti(readOptions *ReadOptions, keys [][]byte) ([][]byte, []error)
- func (db *RocksDB) GetOptions() *Options
- func (db *RocksDB) GetProperty(prop string) string
- func (db *RocksDB) GetStr(readOptions *ReadOptions, key string) (string, error)
- func (db *RocksDB) IngestSSTFiles(fileNames []string, useHardlinks bool) error
- func (db *RocksDB) NewBatch() *Batch
- func (db *RocksDB) Put(writeOptions *WriteOptions, key, value []byte) error
- func (db *RocksDB) PutStr(writeOptions *WriteOptions, key, value string) error
- func (db *RocksDB) WaitForCompact(options *WaitForCompactOptions) error
- type SSTFileWriter
- type Snapshot
- type WaitForCompactOptions
- func (options *WaitForCompactOptions) GetAbortOnPause() bool
- func (options *WaitForCompactOptions) GetCloseDB() bool
- func (options *WaitForCompactOptions) GetFlush() bool
- func (options *WaitForCompactOptions) GetTimeout() time.Duration
- func (options *WaitForCompactOptions) SetAbortOnPause(v bool)
- func (options *WaitForCompactOptions) SetCloseDB(v bool)
- func (options *WaitForCompactOptions) SetFlush(v bool)
- func (options *WaitForCompactOptions) SetTimeout(d time.Duration)
- type WriteOptions
Constants ¶
const ( CompressionDisabled = CompressionType(C.rocksdb_no_compression) CompressionSnappy = CompressionType(C.rocksdb_snappy_compression) CompressionZLib = CompressionType(C.rocksdb_zlib_compression) CompressionBz2 = CompressionType(C.rocksdb_bz2_compression) CompressionLZ4 = CompressionType(C.rocksdb_lz4_compression) CompressionLZ4HC = CompressionType(C.rocksdb_lz4hc_compression) CompressionXpress = CompressionType(C.rocksdb_xpress_compression) CompressionZSTD = CompressionType(C.rocksdb_zstd_compression) )
Compression types.
const ( CompactionStyleLevel = CompactionStyle(C.rocksdb_level_compaction) CompactionStyleUniversal = CompactionStyle(C.rocksdb_universal_compaction) CompactionStyleFIFO = CompactionStyle(C.rocksdb_fifo_compaction) )
Compaction styles.
const DefaultCompactionMemtableMemoryBudget uint64 = 512 * 1024 * 1024
DefaultCompactionMemtableMemoryBudget is the default for compaction memory usage (src/include/rocksdb/options.h).
const DefaultCompactionNumLevels int = 7
DefaultCompactionNumLevels is the default number of levels for level-style compaction
Variables ¶
This section is empty.
Functions ¶
func BoolToChar ¶
BoolToChar is a helper to convert boolean value to C.uchar
Types ¶
type BackupEngine ¶
type BackupEngine struct {
// contains filtered or unexported fields
}
BackupEngine is a front-end for backup / restore operations
func NewBackupEngine ¶
func NewBackupEngine(backupPath string) (*BackupEngine, error)
NewBackupEngine creates an instance of BackupEngine
func (*BackupEngine) BackupDatabase ¶
func (e *BackupEngine) BackupDatabase(db *RocksDB, flushMemtable bool) error
BackupDatabase will backup the database; flushMemtable parameter will force flushing memtable before starting the backup, so the log files will not be necessary for restore (and will not be copied to the backup directory). If flushMemtable is not set, then the log files will be copied to the backup directory.
func (*BackupEngine) FreeBackupEngine ¶
func (e *BackupEngine) FreeBackupEngine()
FreeBackupEngine frees up the memory allocated by NewBackupEngine()
func (*BackupEngine) GetInfo ¶
func (e *BackupEngine) GetInfo() *BackupEngineInfo
GetInfo gets an object that gives information about the backups that have already been taken
func (*BackupEngine) PurgeOldBackups ¶
func (e *BackupEngine) PurgeOldBackups(numBackupsToKeep uint32) error
PurgeOldBackups removes all but the last numBackupsToKeep from the backup directory
func (*BackupEngine) RestoreFromLastBackup ¶
func (e *BackupEngine) RestoreFromLastBackup(destPath string, keepLogFiles bool) error
RestoreFromLastBackup restores the last created backup to destPath directory, if keepLogFiles is true - it will not overwrite WAL in destPath (which is most of a time a strange thing to do)
type BackupEngineInfo ¶
type BackupEngineInfo struct {
// contains filtered or unexported fields
}
BackupEngineInfo represents the information about the backups
func (*BackupEngineInfo) Free ¶
func (bi *BackupEngineInfo) Free()
Free frees up memory allocated by BackupEngine.GetInfo().
func (*BackupEngineInfo) GetBackupID ¶
func (bi *BackupEngineInfo) GetBackupID(index int) int64
GetBackupID gets an id that uniquely identifies a backup
func (*BackupEngineInfo) GetCount ¶
func (bi *BackupEngineInfo) GetCount() int
GetCount gets the number backups available.
func (*BackupEngineInfo) GetNumFiles ¶
func (bi *BackupEngineInfo) GetNumFiles(index int) int32
GetNumFiles gets the number of files in the backup.
func (*BackupEngineInfo) GetSize ¶
func (bi *BackupEngineInfo) GetSize(index int) int64
GetSize get the size of the backup in bytes.
func (*BackupEngineInfo) GetTimestamp ¶
func (bi *BackupEngineInfo) GetTimestamp(index int) int64
GetTimestamp gets the timestamp at which the backup was taken.
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch is a wrapper for WriteBatch. It allows to implement "transactions" in RocksDB sense, by grouping a number of operations together. According to https://github.com/facebook/rocksdb/wiki/Transactions : "Note that RocksDB provides Atomicity by default when writing multiple keys via WriteBatch. Transactions provide a way to guarantee that a batch of writes will only be written if there are no conflicts. Similar to a WriteBatch, no other threads can see the changes in a transaction until it has been written (committed)."
func (*Batch) DeleteRange ¶
DeleteRange deletes a range of keys.
type BlockBasedOptions ¶
type BlockBasedOptions struct {
// contains filtered or unexported fields
}
BlockBasedOptions is a box for rocksdb_block_based_table_options_t
func NewBlockBasedOptions ¶
func NewBlockBasedOptions() *BlockBasedOptions
NewBlockBasedOptions creates an instance of BlockBasedOptions
func (*BlockBasedOptions) FreeBlockBasedOptions ¶
func (b *BlockBasedOptions) FreeBlockBasedOptions()
FreeBlockBasedOptions frees up the memory occupied by BlockBasedOptions
func (*BlockBasedOptions) SetFullBloomFilter ¶
func (b *BlockBasedOptions) SetFullBloomFilter(fullBloomBits int)
SetFullBloomFilter creates Bloom filter of the certain size
func (*BlockBasedOptions) SetLRUCache ¶
func (b *BlockBasedOptions) SetLRUCache(capacity int)
SetLRUCache creates LRU cache of the given size
type FilterPolicy ¶
type FilterPolicy struct {
// contains filtered or unexported fields
}
FilterPolicy is a box for policy filter. Bloom Filters and policy filters: https://github.com/facebook/rocksdb/wiki/RocksDB-Bloom-Filter
func NewFilterPolicyBloom ¶
func NewFilterPolicyBloom(bitsPerKey int) *FilterPolicy
NewFilterPolicyBloom creates a new filter policy with block-based Bloom Filter
func NewFilterPolicyBloomFull ¶
func NewFilterPolicyBloomFull(bitsPerKey int) *FilterPolicy
NewFilterPolicyBloomFull creates a new filter policy with new Bloom Filter
func (*FilterPolicy) FreeFilterPolicy ¶
func (p *FilterPolicy) FreeFilterPolicy()
FreeFilterPolicy frees up memory for FilterPolicy
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator is a box for RocksDB iterator
func (*Iterator) FreeIterator ¶
func (i *Iterator) FreeIterator()
FreeIterator frees up memory for the iterator
func (*Iterator) IsValid ¶
IsValid checks iterator validity. For invalid iterators the caller should check the error by calling GetError().
func (*Iterator) Key ¶
Key returns the key at the current position. To advance position use Next() and Prev(). To obtain the value use Value().
func (*Iterator) Seek ¶
Seek positions iterator on this key. If this key does not exist - on the next key in order.
func (*Iterator) SeekForPrev ¶
SeekForPrev positions iterator on this key. If this key does not exist - on the previous key in order.
func (*Iterator) SeekToFirst ¶
func (i *Iterator) SeekToFirst()
SeekToFirst positions iterator on the first key.
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
LRUCache is a box for rocksdb_cache_t
func NewLRUCache ¶
NewLRUCache creates a new instance of LRUCache
func (*LRUCache) FreeLRUCache ¶
func (c *LRUCache) FreeLRUCache()
FreeLRUCache destroys an instance of LRUCache
func (*LRUCache) GetPinnedUsage ¶
GetPinnedUsage returns pinned memory usage.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options represents DB-level connection options
func NewOptions ¶
func NewOptions() *Options
NewOptions creates and returns default Options structure. (old) Parameters:
- createIfMissing: create the DB if it does not exist (otherwise - throw error if exists)
- errorIfExits: throw error if the DB already exists
func (*Options) EnableCreateIfMissing ¶
func (options *Options) EnableCreateIfMissing()
EnableCreateIfMissing flags that the database should be created if it doesn't exist. The default behaviour is to fail in that situation.
func (*Options) EnableErrorIfExists ¶
func (options *Options) EnableErrorIfExists()
EnableErrorIfExists flags that an existing database is not expected and opening it should not succeed. By default, opening an existing database is allowed.
func (*Options) EnableStatistics ¶
func (options *Options) EnableStatistics()
EnableStatistics enables collecting and exporting statistics https://github.com/facebook/rocksdb/wiki/Statistics
func (*Options) FreeOptions ¶
func (options *Options) FreeOptions()
FreeOptions frees up the memory previously allocated by NewOptions
func (*Options) GetStatisticsString ¶
GetStatisticsString returns stats string
func (*Options) OptimizeLevelStyleCompaction ¶
OptimizeLevelStyleCompaction - read more about Level Style compaction at https://github.com/facebook/rocksdb/wiki/Leveled-Compaction , or about compactions in general https://github.com/facebook/rocksdb/wiki/Compaction memtableMemoryBudget = 0 will set the default value
func (*Options) OptimizeUniversalStyleCompaction ¶
OptimizeUniversalStyleCompaction - read more at https://github.com/facebook/rocksdb/wiki/Universal-Compaction memtableMemoryBudget = 0 will set the default value
func (*Options) PrepareForBulkLoad ¶
func (options *Options) PrepareForBulkLoad()
PrepareForBulkLoad switches to the bulk load mode (no compaction, etc)
func (*Options) SetBottommostCompression ¶
func (options *Options) SetBottommostCompression(compression CompressionType)
SetBottommostCompression sets compression type to be used on bottom-most level on compaction.
func (*Options) SetCompactOnDeletion ¶
SetCompactOnDeletion activates compaction on deletion https://github.com/facebook/rocksdb/blob/59673e299951b96c35ebf4acef15e90da10ed0eb/include/rocksdb/utilities/table_properties_collectors.h#L14
func (*Options) SetCompactionStyle ¶
func (options *Options) SetCompactionStyle(style CompactionStyle)
SetCompactionStyle sets compaction style.
func (*Options) SetCompression ¶
func (options *Options) SetCompression(compression CompressionType)
SetCompression sets global compression type to be used.
func (*Options) SetCompressionPerLevel ¶
func (options *Options) SetCompressionPerLevel(levelValues []CompressionType)
SetCompressionPerLevel sets different compression algorithm per level. When this option is used, number of compaction levels is set to len(levelValues), and specified compression type is set for each level, i.e. levelValues[0] compression is applied to level0/
func (*Options) SetDeleteObsoleteFilesPeriodMicros ¶
SetDeleteObsoleteFilesPeriodMicros sets the periodicity when obsolete files get deleted. The default value is 6 hours. The files that get out of scope by compaction process will still get automatically delete on every compaction, regardless of this setting
func (*Options) SetDisableAutoCompactions ¶
SetDisableAutoCompactions enables/disables automatic compactions. Manual compactions can still be issued on this column family
func (*Options) SetFullBloomFilter ¶
SetFullBloomFilter activates full Bloom filter
func (*Options) SetKeepLogFileNum ¶
SetKeepLogFileNum sets maximal info log files to be kept.
func (*Options) SetLRUCacheSize ¶
SetLRUCacheSize activates LRU Cache
func (*Options) SetLevel0FileNumCompactionTrigger ¶
SetLevel0FileNumCompactionTrigger sets level0_file_num_compaction_trigger option. Once level 0 reaches this number of files, L0->L1 compaction is triggered. One ca estimate level 0 size in stable state as write_buffer_size * min_write_buffer_number_to_merge * level0_file_num_compaction_trigger
func (*Options) SetMaxBytesForLevelBase ¶
SetMaxBytesForLevelBase sets max_bytes_for_level_base option. max_bytes_for_level_base is total size of level 1. It's recommended that this be around the size of level 0.
func (*Options) SetMaxOpenFiles ¶
SetMaxOpenFiles sets the maximum number of open files. -1 - unlimited
func (*Options) SetMaxSubcompactions ¶
SetMaxSubcompactions sets the maximum number of subcompactions. See https://github.com/facebook/rocksdb/wiki/Subcompaction for details. 1 (default) means disabled
func (*Options) SetMaxWriteBufferNumber ¶
SetMaxWriteBufferNumber sets maximum number of memtables, both active and immutable. If the active memtable fills up and the total number of memtables is larger than max_write_buffer_number we stall further writes. This may happen if the flush process is slower than the write rate.
func (*Options) SetMinWriteBufferNumberToMerge ¶
SetMinWriteBufferNumberToMerge sets min_write_buffer_number_to_merge option. min_write_buffer_number_to_merge is the minimum number of memtables to be merged before flushing to storage. For example, if this option is set to 2 (default is 1), immutable memtables are only flushed when there are two of them - a single immutable memtable will never be flushed. If multiple memtables are merged together, less data may be written to storage since two updates are merged to a single key. However, every Get() must traverse all immutable memtables linearly to check if the key is there. Setting this option too high may hurt read performance.
func (*Options) SetNumLevels ¶
SetNumLevels sets number of compaction levels when level-based compaction is used.
func (*Options) SetParallelism ¶
SetParallelism sets the number of background threads for flush and compaction processes, recommended to set to the number of cores. You almost definitely want to call this function if your system is bottlenecked by RocksDB
func (*Options) SetPrefixExtractorSize ¶
SetPrefixExtractorSize sets prefix extractor of given prefixSize https://github.com/facebook/rocksdb/wiki/Prefix-Seek
func (*Options) SetTargetFileSizeBase ¶
SetTargetFileSizeBase sets target_file_size_base option. Files in level 1 will have target_file_size_base bytes. Each next level's file size will be target_file_size_multiplier bigger than previous one. Increasing target_file_size_base will reduce total number of database files, which is generally a good thing. It's recommended setting target_file_size_base to be max_bytes_for_level_base / 10, so that there are 10 files in level 1.
func (*Options) SetWriteBufferSize ¶
SetWriteBufferSize sets the write_buffer_size option which sets the size of a single memtable. Once memtable exceeds this size, it is marked immutable and a new one is created.
type ReadOptions ¶
type ReadOptions struct {
// contains filtered or unexported fields
}
ReadOptions is a set of options for read operations
func NewDefaultReadOptions ¶
func NewDefaultReadOptions() *ReadOptions
NewDefaultReadOptions creates ReadOptions object with default properties
func NewReadOptions ¶
func NewReadOptions(verifyChecksum, fillCache bool) *ReadOptions
NewReadOptions creates ReadOptions object Parameters:
- verifyChecksum: all data read from underlying storage will be verified against corresponding checksums
- fillCache: Should the "data block"/"index block"" read for this iteration be placed in block cache?
func (*ReadOptions) FreeReadOptions ¶
func (readOptions *ReadOptions) FreeReadOptions()
FreeReadOptions frees up the memory previously allocated by NewReadOptions
func (*ReadOptions) SetFillCache ¶
func (readOptions *ReadOptions) SetFillCache(fillCache bool)
SetFillCache sets fill_cache flag https://github.com/facebook/rocksdb/wiki/Block-Cache
func (*ReadOptions) SetIterateLowerBound ¶
func (readOptions *ReadOptions) SetIterateLowerBound(key []byte)
SetIterateLowerBound sets lower bound for key seek https://github.com/facebook/rocksdb/wiki/Iterator
func (*ReadOptions) SetIterateUpperBound ¶
func (readOptions *ReadOptions) SetIterateUpperBound(key []byte)
SetIterateUpperBound sets upper bound for key seek https://github.com/facebook/rocksdb/wiki/Iterator
func (*ReadOptions) SetSnapshot ¶
func (readOptions *ReadOptions) SetSnapshot(snapshot *Snapshot)
SetSnapshot forces using previously made 'snapshot' for read operations
func (*ReadOptions) SetVerifyChecksums ¶
func (readOptions *ReadOptions) SetVerifyChecksums(verifyChecksum bool)
SetVerifyChecksums sets verify_checksums flag https://github.com/facebook/rocksdb/wiki/basic-operations#checksums
func (*ReadOptions) UnsetSnapshot ¶
func (readOptions *ReadOptions) UnsetSnapshot()
UnsetSnapshot turns off using the snapshot. The caller should dispose previously allocated Snapshot object
type RocksDB ¶
type RocksDB struct {
// contains filtered or unexported fields
}
RocksDB is a connection instance
func OpenDatabase ¶
func OpenDatabase(name string, readOnly, readOnlyErrorIfLogExist bool, options *Options) (*RocksDB, error)
OpenDatabase opens the database directory with provided options, returns RocksDB instance or error. Parameters:
- name: path to db (directory)
- readOnly: open in read-only mode
- readOnlyErrorIfLogExists: for read-only mode will throw error if logfile exists
func OpenSecondary ¶
OpenSecondary opens the database in "secondary" read-only mode, returns RocksDB instance or error. The secondary_path argument points to a directory where the secondary instance stores its info log.
func (*RocksDB) CatchWithPrimary ¶
CatchWithPrimary makes the best effort to catch up with all the latest updates from the primary database.
func (*RocksDB) CloseDatabase ¶
func (db *RocksDB) CloseDatabase()
CloseDatabase frees the memory and closes the connection
func (*RocksDB) CompactRangeAll ¶
func (db *RocksDB) CompactRangeAll()
CompactRangeAll runs compaction on all DB
func (*RocksDB) CreateIterator ¶
func (db *RocksDB) CreateIterator(readOptions *ReadOptions) *Iterator
CreateIterator creates an instance of Iterator
func (*RocksDB) Delete ¶
func (db *RocksDB) Delete(writeOptions *WriteOptions, key []byte) error
Delete removes the binary key from the database
func (*RocksDB) DeleteStr ¶
func (db *RocksDB) DeleteStr(writeOptions *WriteOptions, key string) error
DeleteStr removes the string key from the database
func (*RocksDB) ExecuteBatch ¶
func (db *RocksDB) ExecuteBatch(batch *Batch, writeOptions *WriteOptions) error
ExecuteBatch executes operations from the batch with provided options
func (*RocksDB) Flush ¶
Flush flushes in-memory WAL to disk. It's important to know that Flush can trigger background operations like compaction, which may be interrupted if Close is called immediately after flush. Such operations can be waited upon by checking DB properties like 'rocksdb.num-running-compactions' via GetProperty call.
func (*RocksDB) Get ¶
func (db *RocksDB) Get(readOptions *ReadOptions, key []byte) ([]byte, error)
Get retrieves the binary value associated with the byte key
func (*RocksDB) GetMulti ¶
func (db *RocksDB) GetMulti(readOptions *ReadOptions, keys [][]byte) ([][]byte, []error)
GetMulti retrieves multiple binary values associated with multiple byte keys; returns two arrays of corresponding size - one with results, and another with errors (or nil's)
func (*RocksDB) GetProperty ¶
GetProperty returns value of db property
func (*RocksDB) GetStr ¶
func (db *RocksDB) GetStr(readOptions *ReadOptions, key string) (string, error)
GetStr retrieves the string value associated with the string key
func (*RocksDB) IngestSSTFiles ¶
IngestSSTFiles ingests provided files into the database. More details: https://github.com/facebook/rocksdb/wiki/Creating-and-Ingesting-SST-files useHardlinks allows to use 'link' syscall while moving files instead of copying them, set it to 'true' if the filesystem supports it.
func (*RocksDB) Put ¶
func (db *RocksDB) Put(writeOptions *WriteOptions, key, value []byte) error
Put stores a binary key-value
func (*RocksDB) PutStr ¶
func (db *RocksDB) PutStr(writeOptions *WriteOptions, key, value string) error
PutStr stores a string key-value
func (*RocksDB) WaitForCompact ¶
func (db *RocksDB) WaitForCompact(options *WaitForCompactOptions) error
WaitForCompact waits for all currently running compactions to finish, optionally closing the DB afterwards
type SSTFileWriter ¶
type SSTFileWriter struct {
// contains filtered or unexported fields
}
SSTFileWriter allows batch creation of SST files, https://github.com/facebook/rocksdb/wiki/Creating-and-Ingesting-SST-files
func CreateSSTFileWriter ¶
func CreateSSTFileWriter(path string) (*SSTFileWriter, error)
CreateSSTFileWriter creates SSTFileWriter object using provided file path
func (*SSTFileWriter) CloseWriter ¶
func (w *SSTFileWriter) CloseWriter()
CloseWriter frees memory structures associated with the object
func (*SSTFileWriter) Finish ¶
func (w *SSTFileWriter) Finish() error
Finish finishes writing to SST, and returns error (if any)
func (*SSTFileWriter) GetFileSize ¶
func (w *SSTFileWriter) GetFileSize() uint64
GetFileSize returns the size of SST file
func (*SSTFileWriter) Put ¶
func (w *SSTFileWriter) Put(key, value []byte) error
Put stores a binary key-value
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot represents a snapshot-in-time; useful for having a consistent view between multiple read operations
func NewSnapshot ¶
NewSnapshot creates a snapshot for the database
func (*Snapshot) FreeSnapshot ¶
func (snapshot *Snapshot) FreeSnapshot()
FreeSnapshot releases the snapshot, should be explicitly called to free up the memory
type WaitForCompactOptions ¶
type WaitForCompactOptions struct {
// contains filtered or unexported fields
}
WaitForCompactOptions is a set of options for WaitForCompact call
func NewWaitForCompactOptions ¶
func NewWaitForCompactOptions() *WaitForCompactOptions
NewWaitForCompactOptions creates new WaitForCompactOptions
func (*WaitForCompactOptions) GetAbortOnPause ¶
func (options *WaitForCompactOptions) GetAbortOnPause() bool
GetAbortOnPause returns value of AbortOnPause option
func (*WaitForCompactOptions) GetCloseDB ¶
func (options *WaitForCompactOptions) GetCloseDB() bool
GetCloseDB returns value of CloseDB option
func (*WaitForCompactOptions) GetFlush ¶
func (options *WaitForCompactOptions) GetFlush() bool
GetFlush returns value of Flush option
func (*WaitForCompactOptions) GetTimeout ¶
func (options *WaitForCompactOptions) GetTimeout() time.Duration
GetTimeout returns value of Timeout option
func (*WaitForCompactOptions) SetAbortOnPause ¶
func (options *WaitForCompactOptions) SetAbortOnPause(v bool)
SetAbortOnPause sets option to abort waiting in case of a pause (PauseBackgroundWork() called, see https://github.com/facebook/rocksdb/blob/2648e0a747303e63796315049b9005c7320356c0/include/rocksdb/options.h#L2165
func (*WaitForCompactOptions) SetCloseDB ¶
func (options *WaitForCompactOptions) SetCloseDB(v bool)
SetCloseDB sets option to call Close() after waiting is done, see https://github.com/facebook/rocksdb/blob/2648e0a747303e63796315049b9005c7320356c0/include/rocksdb/options.h#L2165
func (*WaitForCompactOptions) SetFlush ¶
func (options *WaitForCompactOptions) SetFlush(v bool)
SetFlush sets option to flush all column families before starting to wait, see https://github.com/facebook/rocksdb/blob/2648e0a747303e63796315049b9005c7320356c0/include/rocksdb/options.h#L2165
func (*WaitForCompactOptions) SetTimeout ¶
func (options *WaitForCompactOptions) SetTimeout(d time.Duration)
SetTimeout sets timeout for waiting for compaction to complete. When timeout == 0, WaitForCompact() will wait as long as there's background work to finish. See https://github.com/facebook/rocksdb/blob/2648e0a747303e63796315049b9005c7320356c0/include/rocksdb/options.h#L2165
type WriteOptions ¶
type WriteOptions struct {
// contains filtered or unexported fields
}
WriteOptions is a set of options for write operations
func NewDefaultWriteOptions ¶
func NewDefaultWriteOptions() *WriteOptions
NewDefaultWriteOptions creates WriteOptions object with default properties
func NewWriteOptions ¶
func NewWriteOptions( syncOnWrite, disableWAL, ignoreMissingColumnFamilies, failOnSlowDown, lowPriority bool, ) *WriteOptions
NewWriteOptions creates WriteOptions object Parameters: - syncOnWrite forces OS buffer flush on each write (slow!) - disableWAL disables write-ahead-log (possible data loss in case of a crash) - ignoreMissingColumnFamilies do not fail, and just ignore writes to non-existing column families (if the WriteBatch contains multiple writes - some of them will succeed) - failOnSlowDown forces failure with Status::Incomplete() if a write request will cause a wait or sleep - lowPriority will cause an error with Status::Incomplete() if compaction is ongoing during write request; this will guarantee minimum impact on high-pri writes
func (*WriteOptions) FreeWriteOptions ¶
func (writeOptions *WriteOptions) FreeWriteOptions()
FreeWriteOptions frees up the memory previously allocated by NewWriteOptions