10225501448 李度 10225101546 陈胤遒 10215501422 高宇菲
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

44 lignes
1.0 KiB

  1. // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file. See the AUTHORS file for names of contributors.
  4. #ifndef STORAGE_LEVELDB_TABLE_BLOCK_H_
  5. #define STORAGE_LEVELDB_TABLE_BLOCK_H_
  6. #include <stddef.h>
  7. #include <stdint.h>
  8. #include "leveldb/iterator.h"
  9. namespace leveldb {
  10. struct BlockContents;
  11. class Comparator;
  12. class Block {
  13. public:
  14. // Initialize the block with the specified contents.
  15. explicit Block(const BlockContents& contents);
  16. Block(const Block&) = delete;
  17. Block& operator=(const Block&) = delete;
  18. ~Block();
  19. size_t size() const { return size_; }
  20. Iterator* NewIterator(const Comparator* comparator);
  21. private:
  22. class Iter;
  23. uint32_t NumRestarts() const;
  24. const char* data_;
  25. size_t size_;
  26. uint32_t restart_offset_; // Offset in data_ of restart array
  27. bool owned_; // Block owns data_[]
  28. };
  29. } // namespace leveldb
  30. #endif // STORAGE_LEVELDB_TABLE_BLOCK_H_