rocksdb/cache
Levi Tamasi 6301dbe7a7 Use function objects as deleters in the block cache (#6545)
Summary:
As the first step of reintroducing eviction statistics for the block
cache, the patch switches from using simple function pointers as deleters
to function objects implementing an interface. This will enable using
deleters that have state, like a smart pointer to the statistics object
that is to be updated when an entry is removed from the cache. For now,
the patch adds a deleter template class `SimpleDeleter`, which simply
casts the `value` pointer to its original type and calls `delete` or
`delete[]` on it as appropriate. Note: to prevent object lifecycle
issues, deleters must outlive the cache entries referring to them;
`SimpleDeleter` ensures this by using the ("leaky") Meyers singleton
pattern.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6545

Test Plan: `make asan_check`

Reviewed By: siying

Differential Revision: D20475823

Pulled By: ltamasi

fbshipit-source-id: fe354c33dd96d9bafc094605462352305449a22a
2020-03-26 16:19:58 -07:00
..
cache_bench.cc Use function objects as deleters in the block cache (#6545) 2020-03-26 16:19:58 -07:00
cache_test.cc Use function objects as deleters in the block cache (#6545) 2020-03-26 16:19:58 -07:00
clock_cache.cc Use function objects as deleters in the block cache (#6545) 2020-03-26 16:19:58 -07:00
clock_cache.h Change RocksDB License 2017-07-15 16:11:23 -07:00
lru_cache.cc Use function objects as deleters in the block cache (#6545) 2020-03-26 16:19:58 -07:00
lru_cache.h Use function objects as deleters in the block cache (#6545) 2020-03-26 16:19:58 -07:00
lru_cache_test.cc Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
sharded_cache.cc Use function objects as deleters in the block cache (#6545) 2020-03-26 16:19:58 -07:00
sharded_cache.h Use function objects as deleters in the block cache (#6545) 2020-03-26 16:19:58 -07:00
simple_deleter.h Use function objects as deleters in the block cache (#6545) 2020-03-26 16:19:58 -07:00