diff options
author | Sanjay Ghemawat <sanjay@google.com> | 2012-04-17 08:36:46 -0700 |
---|---|---|
committer | Sanjay Ghemawat <sanjay@google.com> | 2012-04-17 08:36:46 -0700 |
commit | 85584d497e7b354853b72f450683d59fcf6b9c5c (patch) | |
tree | b6aad4f973f87487c3caa5600e7596219c79f645 /table/format.h | |
parent | bc1ee4d25e09b04e074db330a41f54ef4af0e31b (diff) | |
download | leveldb-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 'table/format.h')
-rw-r--r-- | table/format.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/table/format.h b/table/format.h index 66a15da..6c0b80c 100644 --- a/table/format.h +++ b/table/format.h @@ -83,16 +83,18 @@ static const uint64_t kTableMagicNumber = 0xdb4775248b80fb57ull; // 1-byte type + 32-bit crc static const size_t kBlockTrailerSize = 5; -// Read the block identified by "handle" from "file". On success, -// store a pointer to the heap-allocated result in *block and return -// OK. On failure store NULL in *block and return non-OK. -// On success, stores true in *may_cache if the result may be -// cached, false if it must not be cached. +struct BlockContents { + Slice data; // Actual contents of data + bool cachable; // True iff data can be cached + bool heap_allocated; // True iff caller should delete[] data.data() +}; + +// Read the block identified by "handle" from "file". On failure +// return non-OK. On success fill *result and return OK. extern Status ReadBlock(RandomAccessFile* file, const ReadOptions& options, const BlockHandle& handle, - Block** block, - bool* may_cache); + BlockContents* result); // Implementation details follow. Clients should ignore, |