Skip to content

Commit

Permalink
[REDSTOR-940] Add low-prio write option
Browse files Browse the repository at this point in the history
  • Loading branch information
dforciea committed Feb 26, 2024
1 parent fba1951 commit 94e0447
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions options_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ func (opts *WriteOptions) DisableWAL(value bool) {
C.rocksdb_writeoptions_disable_WAL(opts.c, C.int(btoi(value)))
}

// SetLowPri if true, this write request is of lower priority if compaction is
// behind. In this case, no_slowdown = true, the request will be cancelled
// immediately with Status::Incomplete() returned. Otherwise, it will be
// slowed down. The slowdown value is determined by RocksDB to guarantee
// it introduces minimum impacts to high priority writes.
//
// Default: false
func (opts *WriteOptions) SetLowPri(value bool) {
C.rocksdb_writeoptions_set_low_pri(opts.c, boolToChar(value))
}

// IsLowPri returns if the write request is of lower priority if compaction is behind.
func (opts *WriteOptions) IsLowPri() bool {
return charToBool(C.rocksdb_writeoptions_get_low_pri(opts.c))
}

// Destroy deallocates the WriteOptions object.
func (opts *WriteOptions) Destroy() {
C.rocksdb_writeoptions_destroy(opts.c)
Expand Down

0 comments on commit 94e0447

Please sign in to comment.