Add cuckoo table options to the C interface
This commit is contained in:
parent
136b8583bf
commit
c44a292781
47
db/c.cc
47
db/c.cc
@ -56,6 +56,7 @@ using rocksdb::NewBloomFilterPolicy;
|
||||
using rocksdb::NewLRUCache;
|
||||
using rocksdb::Options;
|
||||
using rocksdb::BlockBasedTableOptions;
|
||||
using rocksdb::CuckooTableOptions;
|
||||
using rocksdb::RandomAccessFile;
|
||||
using rocksdb::Range;
|
||||
using rocksdb::ReadOptions;
|
||||
@ -83,6 +84,7 @@ struct rocksdb_readoptions_t { ReadOptions rep; };
|
||||
struct rocksdb_writeoptions_t { WriteOptions rep; };
|
||||
struct rocksdb_options_t { Options rep; };
|
||||
struct rocksdb_block_based_table_options_t { BlockBasedTableOptions rep; };
|
||||
struct rocksdb_cuckoo_table_options_t { CuckooTableOptions rep; };
|
||||
struct rocksdb_seqfile_t { SequentialFile* rep; };
|
||||
struct rocksdb_randomfile_t { RandomAccessFile* rep; };
|
||||
struct rocksdb_writablefile_t { WritableFile* rep; };
|
||||
@ -1121,6 +1123,51 @@ void rocksdb_options_set_block_based_table_factory(
|
||||
}
|
||||
|
||||
|
||||
rocksdb_cuckoo_table_options_t*
|
||||
rocksdb_cuckoo_options_create() {
|
||||
return new rocksdb_cuckoo_table_options_t;
|
||||
}
|
||||
|
||||
void rocksdb_cuckoo_options_destroy(
|
||||
rocksdb_cuckoo_table_options_t* options) {
|
||||
delete options;
|
||||
}
|
||||
|
||||
void rocksdb_cuckoo_options_set_hash_ratio(
|
||||
rocksdb_cuckoo_table_options_t* options, double v) {
|
||||
options->rep.hash_table_ratio = v;
|
||||
}
|
||||
|
||||
void rocksdb_cuckoo_options_set_max_search_depth(
|
||||
rocksdb_cuckoo_table_options_t* options, uint32_t v) {
|
||||
options->rep.max_search_depth = v;
|
||||
}
|
||||
|
||||
void rocksdb_cuckoo_options_set_cuckoo_block_size(
|
||||
rocksdb_cuckoo_table_options_t* options, uint32_t v) {
|
||||
options->rep.cuckoo_block_size = v;
|
||||
}
|
||||
|
||||
void rocksdb_cuckoo_options_set_identity_as_first_hash(
|
||||
rocksdb_cuckoo_table_options_t* options, unsigned char v) {
|
||||
options->rep.identity_as_first_hash = v;
|
||||
}
|
||||
|
||||
void rocksdb_cuckoo_options_set_use_module_hash(
|
||||
rocksdb_cuckoo_table_options_t* options, unsigned char v) {
|
||||
options->rep.use_module_hash = v;
|
||||
}
|
||||
|
||||
void rocksdb_options_set_cuckoo_table_factory(
|
||||
rocksdb_options_t *opt,
|
||||
rocksdb_cuckoo_table_options_t* table_options) {
|
||||
if (table_options) {
|
||||
opt->rep.table_factory.reset(
|
||||
rocksdb::NewCuckooTableFactory(table_options->rep));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rocksdb_options_t* rocksdb_options_create() {
|
||||
return new rocksdb_options_t;
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ typedef struct rocksdb_mergeoperator_t rocksdb_mergeoperator_t;
|
||||
typedef struct rocksdb_options_t rocksdb_options_t;
|
||||
typedef struct rocksdb_block_based_table_options_t
|
||||
rocksdb_block_based_table_options_t;
|
||||
typedef struct rocksdb_cuckoo_table_options_t
|
||||
rocksdb_cuckoo_table_options_t;
|
||||
typedef struct rocksdb_randomfile_t rocksdb_randomfile_t;
|
||||
typedef struct rocksdb_readoptions_t rocksdb_readoptions_t;
|
||||
typedef struct rocksdb_seqfile_t rocksdb_seqfile_t;
|
||||
@ -376,6 +378,25 @@ extern void rocksdb_block_based_options_set_whole_key_filtering(
|
||||
extern void rocksdb_options_set_block_based_table_factory(
|
||||
rocksdb_options_t *opt, rocksdb_block_based_table_options_t* table_options);
|
||||
|
||||
/* Cuckoo table options */
|
||||
|
||||
extern rocksdb_cuckoo_table_options_t*
|
||||
rocksdb_cuckoo_options_create();
|
||||
extern void rocksdb_cuckoo_options_destroy(
|
||||
rocksdb_cuckoo_table_options_t* options);
|
||||
extern void rocksdb_cuckoo_options_set_hash_ratio(
|
||||
rocksdb_cuckoo_table_options_t* options, double v);
|
||||
extern void rocksdb_cuckoo_options_set_max_search_depth(
|
||||
rocksdb_cuckoo_table_options_t* options, uint32_t v);
|
||||
extern void rocksdb_cuckoo_options_set_cuckoo_block_size(
|
||||
rocksdb_cuckoo_table_options_t* options, uint32_t v);
|
||||
extern void rocksdb_cuckoo_options_set_identity_as_first_hash(
|
||||
rocksdb_cuckoo_table_options_t* options, unsigned char v);
|
||||
extern void rocksdb_cuckoo_options_set_use_module_hash(
|
||||
rocksdb_cuckoo_table_options_t* options, unsigned char v);
|
||||
extern void rocksdb_options_set_cuckoo_table_factory(
|
||||
rocksdb_options_t *opt, rocksdb_cuckoo_table_options_t* table_options);
|
||||
|
||||
/* Options */
|
||||
|
||||
extern rocksdb_options_t* rocksdb_options_create();
|
||||
|
Loading…
Reference in New Issue
Block a user