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

Public Member Functions

 MemTableConstructor (const Comparator *cmp)
 
 ~MemTableConstructor ()
 
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 Attributes

InternalKeyComparator internal_comparator_
 
MemTablememtable_
 

Detailed Description

Definition at line 316 of file table_test.cc.

Constructor & Destructor Documentation

§ MemTableConstructor()

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

Definition at line 318 of file table_test.cc.

319  : Constructor(cmp),
320  internal_comparator_(cmp) {
321  memtable_ = new MemTable(internal_comparator_);
322  memtable_->Ref();
323  }
Constructor(const Comparator *cmp)
Definition: table_test.cc:143
InternalKeyComparator internal_comparator_
Definition: table_test.cc:345

§ ~MemTableConstructor()

leveldb::MemTableConstructor::~MemTableConstructor ( )
inline

Definition at line 324 of file table_test.cc.

324  {
325  memtable_->Unref();
326  }

Member Function Documentation

§ FinishImpl()

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

Implements leveldb::Constructor.

Definition at line 327 of file table_test.cc.

327  {
328  memtable_->Unref();
329  memtable_ = new MemTable(internal_comparator_);
330  memtable_->Ref();
331  int seq = 1;
332  for (KVMap::const_iterator it = data.begin();
333  it != data.end();
334  ++it) {
335  memtable_->Add(seq, kTypeValue, it->first, it->second);
336  seq++;
337  }
338  return Status::OK();
339  }
static Status OK()
Definition: status.h:32
InternalKeyComparator internal_comparator_
Definition: table_test.cc:345
virtual const KVMap & data()
Definition: table_test.cc:173
void Add(SequenceNumber seq, ValueType type, const Slice &key, const Slice &value)
Definition: memtable.cc:82
Here is the call graph for this function:

§ NewIterator()

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

Implements leveldb::Constructor.

Definition at line 340 of file table_test.cc.

340  {
341  return new KeyConvertingIterator(memtable_->NewIterator());
342  }
Iterator * NewIterator()
Definition: memtable.cc:78

Member Data Documentation

§ internal_comparator_

InternalKeyComparator leveldb::MemTableConstructor::internal_comparator_
private

Definition at line 345 of file table_test.cc.

§ memtable_

MemTable* leveldb::MemTableConstructor::memtable_
private

Definition at line 346 of file table_test.cc.


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