mirror of https://github.com/facebook/rocksdb.git
C-API: Constify cache functions where possible (#11243)
Summary: Makes it easier to use generated Rust bindings. Constness of these is already part of the C++ API. Pull Request resolved: https://github.com/facebook/rocksdb/pull/11243 Reviewed By: hx235 Differential Revision: D44840394 Pulled By: ajkr fbshipit-source-id: bcd1aeb8c959c304148d25b00043bb8c4cd3e0a4
This commit is contained in:
parent
c8552d8c63
commit
d5a9c0c937
10
db/c.cc
10
db/c.cc
|
@ -4679,7 +4679,7 @@ rocksdb_cache_t* rocksdb_cache_create_lru_with_strict_capacity_limit(
|
|||
}
|
||||
|
||||
rocksdb_cache_t* rocksdb_cache_create_lru_opts(
|
||||
rocksdb_lru_cache_options_t* opt) {
|
||||
const rocksdb_lru_cache_options_t* opt) {
|
||||
rocksdb_cache_t* c = new rocksdb_cache_t;
|
||||
c->rep = NewLRUCache(opt->rep);
|
||||
return c;
|
||||
|
@ -4726,7 +4726,7 @@ rocksdb_cache_t* rocksdb_cache_create_hyper_clock(
|
|||
}
|
||||
|
||||
rocksdb_cache_t* rocksdb_cache_create_hyper_clock_opts(
|
||||
rocksdb_hyper_clock_cache_options_t* opts) {
|
||||
const rocksdb_hyper_clock_cache_options_t* opts) {
|
||||
rocksdb_cache_t* c = new rocksdb_cache_t;
|
||||
c->rep = opts->rep.MakeSharedCache();
|
||||
return c;
|
||||
|
@ -4742,15 +4742,15 @@ void rocksdb_cache_set_capacity(rocksdb_cache_t* cache, size_t capacity) {
|
|||
cache->rep->SetCapacity(capacity);
|
||||
}
|
||||
|
||||
size_t rocksdb_cache_get_capacity(rocksdb_cache_t* cache) {
|
||||
size_t rocksdb_cache_get_capacity(const rocksdb_cache_t* cache) {
|
||||
return cache->rep->GetCapacity();
|
||||
}
|
||||
|
||||
size_t rocksdb_cache_get_usage(rocksdb_cache_t* cache) {
|
||||
size_t rocksdb_cache_get_usage(const rocksdb_cache_t* cache) {
|
||||
return cache->rep->GetUsage();
|
||||
}
|
||||
|
||||
size_t rocksdb_cache_get_pinned_usage(rocksdb_cache_t* cache) {
|
||||
size_t rocksdb_cache_get_pinned_usage(const rocksdb_cache_t* cache) {
|
||||
return cache->rep->GetPinnedUsage();
|
||||
}
|
||||
|
||||
|
|
|
@ -2006,7 +2006,7 @@ extern ROCKSDB_LIBRARY_API rocksdb_cache_t* rocksdb_cache_create_lru(
|
|||
extern ROCKSDB_LIBRARY_API rocksdb_cache_t*
|
||||
rocksdb_cache_create_lru_with_strict_capacity_limit(size_t capacity);
|
||||
extern ROCKSDB_LIBRARY_API rocksdb_cache_t* rocksdb_cache_create_lru_opts(
|
||||
rocksdb_lru_cache_options_t*);
|
||||
const rocksdb_lru_cache_options_t*);
|
||||
|
||||
extern ROCKSDB_LIBRARY_API void rocksdb_cache_destroy(rocksdb_cache_t* cache);
|
||||
extern ROCKSDB_LIBRARY_API void rocksdb_cache_disown_data(
|
||||
|
@ -2014,11 +2014,11 @@ extern ROCKSDB_LIBRARY_API void rocksdb_cache_disown_data(
|
|||
extern ROCKSDB_LIBRARY_API void rocksdb_cache_set_capacity(
|
||||
rocksdb_cache_t* cache, size_t capacity);
|
||||
extern ROCKSDB_LIBRARY_API size_t
|
||||
rocksdb_cache_get_capacity(rocksdb_cache_t* cache);
|
||||
rocksdb_cache_get_capacity(const rocksdb_cache_t* cache);
|
||||
extern ROCKSDB_LIBRARY_API size_t
|
||||
rocksdb_cache_get_usage(rocksdb_cache_t* cache);
|
||||
rocksdb_cache_get_usage(const rocksdb_cache_t* cache);
|
||||
extern ROCKSDB_LIBRARY_API size_t
|
||||
rocksdb_cache_get_pinned_usage(rocksdb_cache_t* cache);
|
||||
rocksdb_cache_get_pinned_usage(const rocksdb_cache_t* cache);
|
||||
extern ROCKSDB_LIBRARY_API size_t
|
||||
rocksdb_cache_get_table_address_count(const rocksdb_cache_t* cache);
|
||||
extern ROCKSDB_LIBRARY_API size_t
|
||||
|
@ -2046,7 +2046,8 @@ rocksdb_hyper_clock_cache_options_set_memory_allocator(
|
|||
extern ROCKSDB_LIBRARY_API rocksdb_cache_t* rocksdb_cache_create_hyper_clock(
|
||||
size_t capacity, size_t estimated_entry_charge);
|
||||
extern ROCKSDB_LIBRARY_API rocksdb_cache_t*
|
||||
rocksdb_cache_create_hyper_clock_opts(rocksdb_hyper_clock_cache_options_t*);
|
||||
rocksdb_cache_create_hyper_clock_opts(
|
||||
const rocksdb_hyper_clock_cache_options_t*);
|
||||
|
||||
/* DBPath */
|
||||
|
||||
|
|
Loading…
Reference in New Issue