Mercurial > lbo > hg > sstable
changeset 107:ee818e157e3c
Allow to set the block cache size manually.
While the other configuration options are marked as public an can be tuned manually,
the Cache type is not public and therefore can't be constructed from outside the crate.
This adds a "with_cache_capacity" function which allows to change the options
to use a block cache with a custom size.
author | Thomas Krause <krauseto@hu-berlin.de> |
---|---|
date | Mon, 15 Nov 2021 16:57:48 +0100 |
parents | f76c3689831a |
children | 84e886a16dca |
files | src/options.rs |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/options.rs Sun Apr 26 10:15:39 2020 +0200 +++ b/src/options.rs Mon Nov 15 16:57:48 2021 +0100 @@ -42,6 +42,15 @@ pub filter_policy: filter::BoxedFilterPolicy, } +impl Options { + /// Returns Options with a custom block cache capacity. + /// The capacity is given as number of items in the cache. + pub fn with_cache_capacity(mut self, capacity: usize) -> Options { + self.block_cache = share(Cache::new(capacity)); + self + } +} + impl Default for Options { fn default() -> Options { Options {