diff --git a/db/c.cc b/db/c.cc index fc4e27cb7..2e4666648 100644 --- a/db/c.cc +++ b/db/c.cc @@ -901,6 +901,17 @@ char* rocksdb_property_value( } } +int rocksdb_property_int( + rocksdb_t* db, + const char* propname, + uint64_t *out_val) { + if (db->rep->GetIntProperty(Slice(propname), out_val)) { + return 0; + } else { + return -1; + } +} + char* rocksdb_property_value_cf( rocksdb_t* db, rocksdb_column_family_handle_t* column_family, @@ -1487,6 +1498,14 @@ void rocksdb_options_set_cuckoo_table_factory( } } +void rocksdb_set_options( + rocksdb_t* db, int count, const char* const keys[], const char* const values[], char** errptr) { + std::unordered_map options_map; + for (int i=0; irep->SetOptions(options_map)); + } rocksdb_options_t* rocksdb_options_create() { return new rocksdb_options_t; @@ -1871,6 +1890,14 @@ void rocksdb_options_set_hard_rate_limit(rocksdb_options_t* opt, double v) { opt->rep.hard_rate_limit = v; } +void rocksdb_options_set_soft_pending_compaction_bytes_limit(rocksdb_options_t* opt, size_t v) { + opt->rep.soft_pending_compaction_bytes_limit = v; +} + +void rocksdb_options_set_hard_pending_compaction_bytes_limit(rocksdb_options_t* opt, size_t v) { + opt->rep.hard_pending_compaction_bytes_limit = v; +} + void rocksdb_options_set_rate_limit_delay_max_milliseconds( rocksdb_options_t* opt, unsigned int v) { opt->rep.rate_limit_delay_max_milliseconds = v; @@ -1900,6 +1927,10 @@ void rocksdb_options_set_disable_auto_compactions(rocksdb_options_t* opt, int di opt->rep.disable_auto_compactions = disable; } +void rocksdb_options_set_optimize_filters_for_hits(rocksdb_options_t* opt, int v) { + opt->rep.optimize_filters_for_hits = v; +} + void rocksdb_options_set_delete_obsolete_files_period_micros( rocksdb_options_t* opt, uint64_t v) { opt->rep.delete_obsolete_files_period_micros = v; diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index a298928ff..0962fb75f 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -289,6 +289,10 @@ extern ROCKSDB_LIBRARY_API void rocksdb_release_snapshot( Else returns a pointer to a malloc()-ed null-terminated value. */ extern ROCKSDB_LIBRARY_API char* rocksdb_property_value(rocksdb_t* db, const char* propname); +/* returns 0 on success, -1 otherwise */ +int rocksdb_property_int( + rocksdb_t* db, + const char* propname, uint64_t *out_val); extern ROCKSDB_LIBRARY_API char* rocksdb_property_value_cf( rocksdb_t* db, rocksdb_column_family_handle_t* column_family, @@ -525,6 +529,8 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_cuckoo_table_factory( rocksdb_options_t* opt, rocksdb_cuckoo_table_options_t* table_options); /* Options */ +extern ROCKSDB_LIBRARY_API void rocksdb_set_options( + rocksdb_t* db, int count, const char* const keys[], const char* const values[], char** errptr); extern ROCKSDB_LIBRARY_API rocksdb_options_t* rocksdb_options_create(); extern ROCKSDB_LIBRARY_API void rocksdb_options_destroy(rocksdb_options_t*); @@ -634,6 +640,10 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_soft_rate_limit( rocksdb_options_t*, double); extern ROCKSDB_LIBRARY_API void rocksdb_options_set_hard_rate_limit( rocksdb_options_t*, double); +extern ROCKSDB_LIBRARY_API void rocksdb_options_set_soft_pending_compaction_bytes_limit( + rocksdb_options_t* opt, size_t v); +extern ROCKSDB_LIBRARY_API void rocksdb_options_set_hard_pending_compaction_bytes_limit( + rocksdb_options_t* opt, size_t v); extern ROCKSDB_LIBRARY_API void rocksdb_options_set_rate_limit_delay_max_milliseconds(rocksdb_options_t*, unsigned int); @@ -699,6 +709,8 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_disable_data_sync( rocksdb_options_t*, int); extern ROCKSDB_LIBRARY_API void rocksdb_options_set_disable_auto_compactions( rocksdb_options_t*, int); +extern ROCKSDB_LIBRARY_API void rocksdb_options_set_optimize_filters_for_hits( + rocksdb_options_t*, int); extern ROCKSDB_LIBRARY_API void rocksdb_options_set_delete_obsolete_files_period_micros(rocksdb_options_t*, uint64_t); diff --git a/include/rocksdb/db.h b/include/rocksdb/db.h index 07dab606f..b345fba38 100644 --- a/include/rocksdb/db.h +++ b/include/rocksdb/db.h @@ -464,7 +464,7 @@ class DB { static const std::string kNumDeletesImmMemTables; // "rocksdb.estimate-num-keys" - returns estimated number of total keys in - // the active and unflushed immutable memtables. + // the active and unflushed immutable memtables and storage. static const std::string kEstimateNumKeys; // "rocksdb.estimate-table-readers-mem" - returns estimated memory used for