summaryrefslogtreecommitdiff
path: root/db/table_cache.h
diff options
context:
space:
mode:
authorSanjay Ghemawat <sanjay@google.com>2012-04-17 08:36:46 -0700
committerSanjay Ghemawat <sanjay@google.com>2012-04-17 08:36:46 -0700
commit85584d497e7b354853b72f450683d59fcf6b9c5c (patch)
treeb6aad4f973f87487c3caa5600e7596219c79f645 /db/table_cache.h
parentbc1ee4d25e09b04e074db330a41f54ef4af0e31b (diff)
downloadleveldb-85584d497e7b354853b72f450683d59fcf6b9c5c.tar.gz
Added bloom filter support.v1.4
In particular, we add a new FilterPolicy class. An instance of this class can be supplied in Options when opening a database. If supplied, the instance is used to generate summaries of keys (e.g., a bloom filter) which are placed in sstables. These summaries are consulted by DB::Get() so we can avoid reading sstable blocks that are guaranteed to not contain the key we are looking for. This change provides one implementation of FilterPolicy based on bloom filters. Other changes: - Updated version number to 1.4. - Some build tweaks. - C binding for CompactRange. - A few more benchmarks: deleteseq, deleterandom, readmissing, seekrandom. - Minor .gitignore update.
Diffstat (limited to 'db/table_cache.h')
-rw-r--r--db/table_cache.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/db/table_cache.h b/db/table_cache.h
index 0f3c73b..8cf4aaf 100644
--- a/db/table_cache.h
+++ b/db/table_cache.h
@@ -35,6 +35,15 @@ class TableCache {
uint64_t file_size,
Table** tableptr = NULL);
+ // If a seek to internal key "k" in specified file finds an entry,
+ // call (*handle_result)(arg, found_key, found_value).
+ Status Get(const ReadOptions& options,
+ uint64_t file_number,
+ uint64_t file_size,
+ const Slice& k,
+ void* arg,
+ void (*handle_result)(void*, const Slice&, const Slice&));
+
// Evict any entry for the specified file number
void Evict(uint64_t file_number);
@@ -43,6 +52,8 @@ class TableCache {
const std::string dbname_;
const Options* options_;
Cache* cache_;
+
+ Status FindTable(uint64_t file_number, uint64_t file_size, Cache::Handle**);
};
} // namespace leveldb