作者: 谢瑞阳 10225101483 徐翔宇 10225101535
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

44 行
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();
  17. size_t size() const { return size_; }
  18. Iterator* NewIterator(const Comparator* comparator);
  19. private:
  20. uint32_t NumRestarts() const;
  21. const char* data_;
  22. size_t size_;
  23. uint32_t restart_offset_; // Offset in data_ of restart array
  24. bool owned_; // Block owns data_[]
  25. // No copying allowed
  26. Block(const Block&);
  27. void operator=(const Block&);
  28. class Iter;
  29. };
  30. } // namespace leveldb
  31. #endif // STORAGE_LEVELDB_TABLE_BLOCK_H_