Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional methods to C api for compactoptions #13271

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions db/c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5000,6 +5000,35 @@ int rocksdb_compactoptions_get_target_level(rocksdb_compactoptions_t* opt) {
return opt->rep.target_level;
}

void rocksdb_compactoptions_set_target_path_id(rocksdb_compactoptions_t* opt,
int n) {
opt->rep.target_path_id = n;
}

int rocksdb_compactoptions_get_target_path_id(rocksdb_compactoptions_t* opt) {
return opt->rep.target_path_id;
}

void rocksdb_compactoptions_set_allow_write_stall(rocksdb_compactoptions_t* opt,
unsigned char v) {
opt->rep.allow_write_stall = v;
}

unsigned char rocksdb_compactoptions_get_allow_write_stall(
rocksdb_compactoptions_t* opt) {
return opt->rep.allow_write_stall;
}

void rocksdb_compactoptions_set_max_subcompactions(
rocksdb_compactoptions_t* opt, int n) {
opt->rep.max_subcompactions = n;
}

int rocksdb_compactoptions_get_max_subcompactions(
rocksdb_compactoptions_t* opt) {
return opt->rep.max_subcompactions;
}

void rocksdb_compactoptions_set_full_history_ts_low(
rocksdb_compactoptions_t* opt, char* ts, size_t tslen) {
if (ts == nullptr) {
Expand Down
9 changes: 9 additions & 0 deletions db/c_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2938,6 +2938,15 @@ int main(int argc, char** argv) {
rocksdb_compactoptions_set_target_level(co, 1);
CheckCondition(1 == rocksdb_compactoptions_get_target_level(co));

rocksdb_compactoptions_set_target_path_id(co, 1);
CheckCondition(1 == rocksdb_compactoptions_get_target_path_id(co));

rocksdb_compactoptions_set_allow_write_stall(co, 1);
CheckCondition(1 == rocksdb_compactoptions_get_allow_write_stall(co));

rocksdb_compactoptions_set_max_subcompactions(co, 1);
CheckCondition(1 == rocksdb_compactoptions_get_max_subcompactions(co));

rocksdb_compactoptions_destroy(co);
}

Expand Down
12 changes: 12 additions & 0 deletions include/rocksdb/c.h
Original file line number Diff line number Diff line change
Expand Up @@ -2129,6 +2129,18 @@ extern ROCKSDB_LIBRARY_API void rocksdb_compactoptions_set_target_level(
rocksdb_compactoptions_t*, int);
extern ROCKSDB_LIBRARY_API int rocksdb_compactoptions_get_target_level(
rocksdb_compactoptions_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_compactoptions_set_target_path_id(
rocksdb_compactoptions_t*, int);
extern ROCKSDB_LIBRARY_API int rocksdb_compactoptions_get_target_path_id(
rocksdb_compactoptions_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_compactoptions_set_allow_write_stall(
rocksdb_compactoptions_t*, unsigned char);
extern ROCKSDB_LIBRARY_API unsigned char
rocksdb_compactoptions_get_allow_write_stall(rocksdb_compactoptions_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_compactoptions_set_max_subcompactions(
rocksdb_compactoptions_t*, int);
extern ROCKSDB_LIBRARY_API int rocksdb_compactoptions_get_max_subcompactions(
rocksdb_compactoptions_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_compactoptions_set_full_history_ts_low(
rocksdb_compactoptions_t*, char* ts, size_t tslen);

Expand Down
Loading