// Copyright (c) 2011 The LevelDB Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. See the AUTHORS file for names of contributors. // // Decodes the blocks generated by block_builder.cc. #include "table/block.h" #include <algorithm> #include <cstdint> #include <vector> #include "leveldb/comparator.h" #include "table/format.h" #include "util/coding.h" #include "util/logging.h" namespace leveldb { inline uint32_t Block::NumRestarts() const { … } Block::Block(const BlockContents& contents) : … { … } Block::~Block() { … } // Helper routine: decode the next block entry starting at "p", // storing the number of shared key bytes, non_shared key bytes, // and the length of the value in "*shared", "*non_shared", and // "*value_length", respectively. Will not dereference past "limit". // // If any errors are detected, returns nullptr. Otherwise, returns a // pointer to the key delta (just past the three decoded values). static inline const char* DecodeEntry(const char* p, const char* limit, uint32_t* shared, uint32_t* non_shared, uint32_t* value_length) { … } class Block::Iter : public Iterator { … }; Iterator* Block::NewIterator(const Comparator* comparator) { … } } // namespace leveldb