Home | History | Annotate | Download | only in table
      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 
      5 #ifndef STORAGE_LEVELDB_TABLE_BLOCK_H_
      6 #define STORAGE_LEVELDB_TABLE_BLOCK_H_
      7 
      8 #include <stddef.h>
      9 #include <stdint.h>
     10 #include "leveldb/iterator.h"
     11 
     12 namespace leveldb {
     13 
     14 struct BlockContents;
     15 class Comparator;
     16 
     17 class Block {
     18  public:
     19   // Initialize the block with the specified contents.
     20   explicit Block(const BlockContents& contents);
     21 
     22   ~Block();
     23 
     24   size_t size() const { return size_; }
     25   Iterator* NewIterator(const Comparator* comparator);
     26 
     27  private:
     28   uint32_t NumRestarts() const;
     29 
     30   const char* data_;
     31   size_t size_;
     32   uint32_t restart_offset_;     // Offset in data_ of restart array
     33   bool owned_;                  // Block owns data_[]
     34 
     35   // No copying allowed
     36   Block(const Block&);
     37   void operator=(const Block&);
     38 
     39   class Iter;
     40 };
     41 
     42 }  // namespace leveldb
     43 
     44 #endif  // STORAGE_LEVELDB_TABLE_BLOCK_H_
     45