leveldb
Public Member Functions | Private Member Functions | Private Attributes | List of all members
leveldb::BlockConstructor Class Reference
Inheritance diagram for leveldb::BlockConstructor:
Inheritance graph
[legend]
Collaboration diagram for leveldb::BlockConstructor:
Collaboration graph
[legend]

Public Member Functions

 BlockConstructor (const Comparator *cmp)
 
 ~BlockConstructor ()
 
virtual Status FinishImpl (const Options &options, const KVMap &data)
 
virtual IteratorNewIterator () const
 
- Public Member Functions inherited from leveldb::Constructor
 Constructor (const Comparator *cmp)
 
virtual ~Constructor ()
 
void Add (const std::string &key, const Slice &value)
 
void Finish (const Options &options, std::vector< std::string > *keys, KVMap *kvmap)
 
virtual const KVMapdata ()
 
virtual DBdb () const
 

Private Member Functions

 BlockConstructor ()
 

Private Attributes

const Comparatorcomparator_
 
std::string data_
 
Blockblock_
 

Detailed Description

Definition at line 181 of file table_test.cc.

Constructor & Destructor Documentation

§ BlockConstructor() [1/2]

leveldb::BlockConstructor::BlockConstructor ( const Comparator cmp)
inlineexplicit

Definition at line 183 of file table_test.cc.

184  : Constructor(cmp),
185  comparator_(cmp),
186  block_(NULL) { }
Constructor(const Comparator *cmp)
Definition: table_test.cc:143
const Comparator * comparator_
Definition: table_test.cc:214

§ ~BlockConstructor()

leveldb::BlockConstructor::~BlockConstructor ( )
inline

Definition at line 187 of file table_test.cc.

187  {
188  delete block_;
189  }

§ BlockConstructor() [2/2]

leveldb::BlockConstructor::BlockConstructor ( )
private

Member Function Documentation

§ FinishImpl()

virtual Status leveldb::BlockConstructor::FinishImpl ( const Options options,
const KVMap data 
)
inlinevirtual

Implements leveldb::Constructor.

Definition at line 190 of file table_test.cc.

190  {
191  delete block_;
192  block_ = NULL;
193  BlockBuilder builder(&options);
194 
195  for (KVMap::const_iterator it = data.begin();
196  it != data.end();
197  ++it) {
198  builder.Add(it->first, it->second);
199  }
200  // Open the block
201  data_ = builder.Finish().ToString();
202  BlockContents contents;
203  contents.data = data_;
204  contents.cachable = false;
205  contents.heap_allocated = false;
206  block_ = new Block(contents);
207  return Status::OK();
208  }
static Status OK()
Definition: status.h:32
virtual const KVMap & data()
Definition: table_test.cc:173
Here is the call graph for this function:

§ NewIterator()

virtual Iterator* leveldb::BlockConstructor::NewIterator ( ) const
inlinevirtual

Implements leveldb::Constructor.

Definition at line 209 of file table_test.cc.

209  {
210  return block_->NewIterator(comparator_);
211  }
Iterator * NewIterator(const Comparator *comparator)
Definition: block.cc:256
const Comparator * comparator_
Definition: table_test.cc:214

Member Data Documentation

§ block_

Block* leveldb::BlockConstructor::block_
private

Definition at line 216 of file table_test.cc.

§ comparator_

const Comparator* leveldb::BlockConstructor::comparator_
private

Definition at line 214 of file table_test.cc.

§ data_

std::string leveldb::BlockConstructor::data_
private

Definition at line 215 of file table_test.cc.


The documentation for this class was generated from the following file: