C API: update options w/ convenience funcs & fifo compaction
This commit is contained in:
parent
01159aa802
commit
fd3fb4b0bf
44
db/c.cc
44
db/c.cc
@ -36,6 +36,7 @@ using rocksdb::ColumnFamilyHandle;
|
|||||||
using rocksdb::ColumnFamilyOptions;
|
using rocksdb::ColumnFamilyOptions;
|
||||||
using rocksdb::CompactionFilter;
|
using rocksdb::CompactionFilter;
|
||||||
using rocksdb::CompactionFilterFactory;
|
using rocksdb::CompactionFilterFactory;
|
||||||
|
using rocksdb::CompactionOptionsFIFO;
|
||||||
using rocksdb::Comparator;
|
using rocksdb::Comparator;
|
||||||
using rocksdb::CompressionType;
|
using rocksdb::CompressionType;
|
||||||
using rocksdb::DB;
|
using rocksdb::DB;
|
||||||
@ -73,6 +74,7 @@ struct rocksdb_iterator_t { Iterator* rep; };
|
|||||||
struct rocksdb_writebatch_t { WriteBatch rep; };
|
struct rocksdb_writebatch_t { WriteBatch rep; };
|
||||||
struct rocksdb_snapshot_t { const Snapshot* rep; };
|
struct rocksdb_snapshot_t { const Snapshot* rep; };
|
||||||
struct rocksdb_flushoptions_t { FlushOptions rep; };
|
struct rocksdb_flushoptions_t { FlushOptions rep; };
|
||||||
|
struct rocksdb_fifo_compaction_options_t { CompactionOptionsFIFO rep; };
|
||||||
struct rocksdb_readoptions_t { ReadOptions rep; };
|
struct rocksdb_readoptions_t { ReadOptions rep; };
|
||||||
struct rocksdb_writeoptions_t { WriteOptions rep; };
|
struct rocksdb_writeoptions_t { WriteOptions rep; };
|
||||||
struct rocksdb_options_t { Options rep; };
|
struct rocksdb_options_t { Options rep; };
|
||||||
@ -957,6 +959,26 @@ void rocksdb_options_destroy(rocksdb_options_t* options) {
|
|||||||
delete options;
|
delete options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rocksdb_options_increase_parallelism(
|
||||||
|
rocksdb_options_t* opt, int total_threads) {
|
||||||
|
opt->rep.IncreaseParallelism(total_threads);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rocksdb_options_optimize_for_point_lookup(
|
||||||
|
rocksdb_options_t* opt) {
|
||||||
|
opt->rep.OptimizeForPointLookup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void rocksdb_options_optimize_level_style_compaction(
|
||||||
|
rocksdb_options_t* opt, uint64_t memtable_memory_budget) {
|
||||||
|
opt->rep.OptimizeLevelStyleCompaction(memtable_memory_budget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rocksdb_options_optimize_universal_style_compaction(
|
||||||
|
rocksdb_options_t* opt, uint64_t memtable_memory_budget) {
|
||||||
|
opt->rep.OptimizeUniversalStyleCompaction(memtable_memory_budget);
|
||||||
|
}
|
||||||
|
|
||||||
void rocksdb_options_set_compaction_filter(
|
void rocksdb_options_set_compaction_filter(
|
||||||
rocksdb_options_t* opt,
|
rocksdb_options_t* opt,
|
||||||
rocksdb_compactionfilter_t* filter) {
|
rocksdb_compactionfilter_t* filter) {
|
||||||
@ -1445,6 +1467,12 @@ void rocksdb_options_set_universal_compaction_options(rocksdb_options_t *opt, ro
|
|||||||
opt->rep.compaction_options_universal = *(uco->rep);
|
opt->rep.compaction_options_universal = *(uco->rep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rocksdb_options_set_fifo_compaction_options(
|
||||||
|
rocksdb_options_t* opt,
|
||||||
|
rocksdb_fifo_compaction_options_t* fifo) {
|
||||||
|
opt->rep.compaction_options_fifo = fifo->rep;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO:
|
TODO:
|
||||||
DB::OpenForReadOnly
|
DB::OpenForReadOnly
|
||||||
@ -1803,6 +1831,22 @@ void rocksdb_universal_compaction_options_destroy(
|
|||||||
delete uco;
|
delete uco;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rocksdb_fifo_compaction_options_t* rocksdb_fifo_compaction_options_create() {
|
||||||
|
rocksdb_fifo_compaction_options_t* result = new rocksdb_fifo_compaction_options_t;
|
||||||
|
result->rep = CompactionOptionsFIFO();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rocksdb_fifo_compaction_options_set_max_table_files_size(
|
||||||
|
rocksdb_fifo_compaction_options_t* fifo_opts, uint64_t size) {
|
||||||
|
fifo_opts->rep.max_table_files_size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rocksdb_fifo_compaction_options_destroy(
|
||||||
|
rocksdb_fifo_compaction_options_t* fifo_opts) {
|
||||||
|
delete fifo_opts;
|
||||||
|
}
|
||||||
|
|
||||||
void rocksdb_options_set_min_level_to_compress(rocksdb_options_t* opt, int level) {
|
void rocksdb_options_set_min_level_to_compress(rocksdb_options_t* opt, int level) {
|
||||||
if (level >= 0) {
|
if (level >= 0) {
|
||||||
assert(level <= opt->rep.num_levels);
|
assert(level <= opt->rep.num_levels);
|
||||||
|
@ -63,6 +63,7 @@ typedef struct rocksdb_compactionfilterfactory_t
|
|||||||
rocksdb_compactionfilterfactory_t;
|
rocksdb_compactionfilterfactory_t;
|
||||||
typedef struct rocksdb_comparator_t rocksdb_comparator_t;
|
typedef struct rocksdb_comparator_t rocksdb_comparator_t;
|
||||||
typedef struct rocksdb_env_t rocksdb_env_t;
|
typedef struct rocksdb_env_t rocksdb_env_t;
|
||||||
|
typedef struct rocksdb_fifo_compaction_options_t rocksdb_fifo_compaction_options_t;
|
||||||
typedef struct rocksdb_filelock_t rocksdb_filelock_t;
|
typedef struct rocksdb_filelock_t rocksdb_filelock_t;
|
||||||
typedef struct rocksdb_filterpolicy_t rocksdb_filterpolicy_t;
|
typedef struct rocksdb_filterpolicy_t rocksdb_filterpolicy_t;
|
||||||
typedef struct rocksdb_flushoptions_t rocksdb_flushoptions_t;
|
typedef struct rocksdb_flushoptions_t rocksdb_flushoptions_t;
|
||||||
@ -345,6 +346,14 @@ extern const char* rocksdb_writebatch_data(rocksdb_writebatch_t*, size_t *size);
|
|||||||
|
|
||||||
extern rocksdb_options_t* rocksdb_options_create();
|
extern rocksdb_options_t* rocksdb_options_create();
|
||||||
extern void rocksdb_options_destroy(rocksdb_options_t*);
|
extern void rocksdb_options_destroy(rocksdb_options_t*);
|
||||||
|
extern void rocksdb_options_increase_parallelism(
|
||||||
|
rocksdb_options_t* opt, int total_threads);
|
||||||
|
extern void rocksdb_options_optimize_for_point_lookup(
|
||||||
|
rocksdb_options_t* opt);
|
||||||
|
extern void rocksdb_options_optimize_level_style_compaction(
|
||||||
|
rocksdb_options_t* opt, uint64_t memtable_memory_budget);
|
||||||
|
extern void rocksdb_options_optimize_universal_style_compaction(
|
||||||
|
rocksdb_options_t* opt, uint64_t memtable_memory_budget);
|
||||||
extern void rocksdb_options_set_compaction_filter(
|
extern void rocksdb_options_set_compaction_filter(
|
||||||
rocksdb_options_t*,
|
rocksdb_options_t*,
|
||||||
rocksdb_compactionfilter_t*);
|
rocksdb_compactionfilter_t*);
|
||||||
@ -518,10 +527,13 @@ extern void rocksdb_options_set_compression(rocksdb_options_t*, int);
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
rocksdb_level_compaction = 0,
|
rocksdb_level_compaction = 0,
|
||||||
rocksdb_universal_compaction = 1
|
rocksdb_universal_compaction = 1,
|
||||||
|
rocksdb_fifo_compaction = 2
|
||||||
};
|
};
|
||||||
extern void rocksdb_options_set_compaction_style(rocksdb_options_t*, int);
|
extern void rocksdb_options_set_compaction_style(rocksdb_options_t*, int);
|
||||||
extern void rocksdb_options_set_universal_compaction_options(rocksdb_options_t*, rocksdb_universal_compaction_options_t*);
|
extern void rocksdb_options_set_universal_compaction_options(rocksdb_options_t*, rocksdb_universal_compaction_options_t*);
|
||||||
|
extern void rocksdb_options_set_fifo_compaction_options(rocksdb_options_t* opt,
|
||||||
|
rocksdb_fifo_compaction_options_t* fifo);
|
||||||
|
|
||||||
/* Compaction Filter */
|
/* Compaction Filter */
|
||||||
|
|
||||||
@ -702,6 +714,12 @@ extern void rocksdb_universal_compaction_options_set_stop_style(
|
|||||||
extern void rocksdb_universal_compaction_options_destroy(
|
extern void rocksdb_universal_compaction_options_destroy(
|
||||||
rocksdb_universal_compaction_options_t*);
|
rocksdb_universal_compaction_options_t*);
|
||||||
|
|
||||||
|
extern rocksdb_fifo_compaction_options_t* rocksdb_fifo_compaction_options_create();
|
||||||
|
extern void rocksdb_fifo_compaction_options_set_max_table_files_size(
|
||||||
|
rocksdb_fifo_compaction_options_t* fifo_opts, uint64_t size);
|
||||||
|
extern void rocksdb_fifo_compaction_options_destroy(
|
||||||
|
rocksdb_fifo_compaction_options_t* fifo_opts);
|
||||||
|
|
||||||
extern int rocksdb_livefiles_count(
|
extern int rocksdb_livefiles_count(
|
||||||
const rocksdb_livefiles_t*);
|
const rocksdb_livefiles_t*);
|
||||||
extern const char* rocksdb_livefiles_name(
|
extern const char* rocksdb_livefiles_name(
|
||||||
|
Loading…
Reference in New Issue
Block a user