Add rocksdb_property_int_cf (#5268)

Summary:
Adds the missing `rocksdb_property_int_cf` function to the C API to let consuming libraries avoid parsing strings.
Fixes https://github.com/facebook/rocksdb/issues/5249
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5268

Differential Revision: D15149461

Pulled By: maysamyabandeh

fbshipit-source-id: e9fe5f1ad7c64066d921dba8473507269b51d331
This commit is contained in:
David Palm 2019-04-30 10:08:13 -07:00 committed by Facebook Github Bot
parent b02d0c238d
commit a5debd7ed8
2 changed files with 17 additions and 0 deletions

12
db/c.cc
View File

@ -1070,6 +1070,18 @@ int rocksdb_property_int(
}
}
int rocksdb_property_int_cf(
rocksdb_t* db,
rocksdb_column_family_handle_t* column_family,
const char* propname,
uint64_t *out_val) {
if (db->rep->GetIntProperty(column_family->rep, Slice(propname), out_val)) {
return 0;
} else {
return -1;
}
}
char* rocksdb_property_value_cf(
rocksdb_t* db,
rocksdb_column_family_handle_t* column_family,

View File

@ -336,6 +336,11 @@ int rocksdb_property_int(
rocksdb_t* db,
const char* propname, uint64_t *out_val);
/* returns 0 on success, -1 otherwise */
int rocksdb_property_int_cf(
rocksdb_t* db, rocksdb_column_family_handle_t* column_family,
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,
const char* propname);