rocksdb

package
v0.0.0-...-b4e18d7 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

Compression types.

View Source
const (
	CompactionStyleLevel     = CompactionStyle(C.rocksdb_level_compaction)
	CompactionStyleUniversal = CompactionStyle(C.rocksdb_universal_compaction)
	CompactionStyleFIFO      = CompactionStyle(C.rocksdb_fifo_compaction)
)

Compaction styles.

View Source
const DefaultCompactionMemtableMemoryBudget uint64 = 512 * 1024 * 1024

DefaultCompactionMemtableMemoryBudget is the default for compaction memory usage (src/include/rocksdb/options.h).

View Source
const DefaultCompactionNumLevels int = 7

DefaultCompactionNumLevels is the default number of levels for level-style compaction

Variables

This section is empty.

Functions

func BoolToChar

func BoolToChar(b bool) C.uchar

BoolToChar is a helper to convert boolean value to C.uchar

func CharToBool

func CharToBool(cChar C.uchar) bool

CharToBool converts C.uchar to boolean

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) Clear

func (batch *Batch) Clear()

Clear clears batch content

func (*Batch) Delete

func (batch *Batch) Delete(key []byte)

Delete schedules a deletion of the operation in the batch

func (*Batch) DeleteRange

func (batch *Batch) DeleteRange(startKey []byte, endKey []byte)

DeleteRange deletes a range of keys.

func (*Batch) Destroy

func (batch *Batch) Destroy()

Destroy destroys a Batch object

func (*Batch) GetCount

func (batch *Batch) GetCount() int

GetCount returns the number of actions in the batch

func (*Batch) Put

func (batch *Batch) Put(key, value []byte)

Put schedules storing a binary key-value pair in the batch

func (*Batch) PutVector

func (batch *Batch) PutVector(key, value [][]byte)

PutVector stores key-value pair composed of multiple "chunks". If you just want to store more than one key-value pair, this is NOT what you are looking for.

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 CompactionStyle

type CompactionStyle uint

CompactionStyle specifies the compaction style.

type CompressionType

type CompressionType uint

CompressionType specifies the compression we use.

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) GetError

func (i *Iterator) GetError() error

GetError returns last error, or nil if there is none.

func (*Iterator) IsValid

func (i *Iterator) IsValid() bool

IsValid checks iterator validity. For invalid iterators the caller should check the error by calling GetError().

func (*Iterator) Key

func (i *Iterator) Key() []byte

Key returns the key at the current position. To advance position use Next() and Prev(). To obtain the value use Value().

func (*Iterator) Next

func (i *Iterator) Next()

Next moves iterator on the next key

func (*Iterator) Prev

func (i *Iterator) Prev()

Prev moves iterator on the previous key

func (*Iterator) Seek

func (i *Iterator) Seek(key []byte)

Seek positions iterator on this key. If this key does not exist - on the next key in order.

func (*Iterator) SeekForPrev

func (i *Iterator) SeekForPrev(key []byte)

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.

func (*Iterator) Value

func (i *Iterator) Value() []byte

Value returns the value at the current position. To obtain the key use Key().

type LRUCache

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

LRUCache is a box for rocksdb_cache_t

func NewLRUCache

func NewLRUCache(capacity int) *LRUCache

NewLRUCache creates a new instance of LRUCache

func (*LRUCache) FreeLRUCache

func (c *LRUCache) FreeLRUCache()

FreeLRUCache destroys an instance of LRUCache

func (*LRUCache) GetPinnedUsage

func (c *LRUCache) GetPinnedUsage() uint64

GetPinnedUsage returns pinned memory usage.

func (*LRUCache) GetUsage

func (c *LRUCache) GetUsage() uint64

GetUsage returns 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) GetCache

func (options *Options) GetCache() *LRUCache

GetCache provides access to block cache

func (*Options) GetStatisticsString

func (options *Options) GetStatisticsString() string

GetStatisticsString returns stats string

func (*Options) OptimizeLevelStyleCompaction

func (options *Options) OptimizeLevelStyleCompaction(memtableMemoryBudget uint64)

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

func (options *Options) OptimizeUniversalStyleCompaction(memtableMemoryBudget uint64)

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

func (options *Options) SetCompactOnDeletion(windowSize int, numDelsTrigger int)

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

func (options *Options) SetDeleteObsoleteFilesPeriodMicros(micros uint)

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

func (options *Options) SetDisableAutoCompactions(v bool)

SetDisableAutoCompactions enables/disables automatic compactions. Manual compactions can still be issued on this column family

func (*Options) SetFullBloomFilter

func (options *Options) SetFullBloomFilter(fullBloomBits int)

SetFullBloomFilter activates full Bloom filter

func (*Options) SetKeepLogFileNum

func (options *Options) SetKeepLogFileNum(num uint)

SetKeepLogFileNum sets maximal info log files to be kept.

func (*Options) SetLRUCacheSize

func (options *Options) SetLRUCacheSize(capacity int)

SetLRUCacheSize activates LRU Cache

func (*Options) SetLevel0FileNumCompactionTrigger

func (options *Options) SetLevel0FileNumCompactionTrigger(num int)

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

func (options *Options) SetMaxBytesForLevelBase(size int)

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

func (options *Options) SetMaxOpenFiles(numFiles int)

SetMaxOpenFiles sets the maximum number of open files. -1 - unlimited

func (*Options) SetMaxSubcompactions

func (options *Options) SetMaxSubcompactions(n int)

SetMaxSubcompactions sets the maximum number of subcompactions. See https://github.com/facebook/rocksdb/wiki/Subcompaction for details. 1 (default) means disabled

func (*Options) SetMaxWriteBufferNumber

func (options *Options) SetMaxWriteBufferNumber(num int)

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

func (options *Options) SetMinWriteBufferNumberToMerge(num int)

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

func (options *Options) SetNumLevels(numLevels int)

SetNumLevels sets number of compaction levels when level-based compaction is used.

func (*Options) SetParallelism

func (options *Options) SetParallelism(parallelism int)

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

func (options *Options) SetPrefixExtractorSize(prefixSize int)

SetPrefixExtractorSize sets prefix extractor of given prefixSize https://github.com/facebook/rocksdb/wiki/Prefix-Seek

func (*Options) SetTargetFileSizeBase

func (options *Options) SetTargetFileSizeBase(size int)

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

func (options *Options) SetWriteBufferSize(size int)

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

func OpenSecondary(name, secondaryPath string, options *Options) (*RocksDB, error)

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

func (db *RocksDB) CatchWithPrimary() error

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

func (db *RocksDB) Flush() error

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) GetOptions

func (db *RocksDB) GetOptions() *Options

GetOptions returns options

func (*RocksDB) GetProperty

func (db *RocksDB) GetProperty(prop string) string

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

func (db *RocksDB) IngestSSTFiles(fileNames []string, useHardlinks bool) error

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) NewBatch

func (db *RocksDB) NewBatch() *Batch

NewBatch creates a Batch

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

func NewSnapshot(db *RocksDB) *Snapshot

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

Jump to

Keyboard shortcuts

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