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

Classes

class  ModelIter
 
class  ModelSnapshot
 

Public Member Functions

 ModelDB (const Options &options)
 
 ~ModelDB ()
 
virtual Status Put (const WriteOptions &o, const Slice &k, const Slice &v)
 
virtual Status Delete (const WriteOptions &o, const Slice &key)
 
virtual Status Get (const ReadOptions &options, const Slice &key, std::string *value)
 
virtual IteratorNewIterator (const ReadOptions &options)
 
virtual const SnapshotGetSnapshot ()
 
virtual void ReleaseSnapshot (const Snapshot *snapshot)
 
virtual Status Write (const WriteOptions &options, WriteBatch *batch)
 
virtual bool GetProperty (const Slice &property, std::string *value)
 
virtual void GetApproximateSizes (const Range *r, int n, uint64_t *sizes)
 
virtual void CompactRange (const Slice *start, const Slice *end)
 
- Public Member Functions inherited from leveldb::DB
 DB ()
 
virtual ~DB ()
 

Private Attributes

const Options options_
 
KVMap map_
 

Additional Inherited Members

- Static Public Member Functions inherited from leveldb::DB
static Status Open (const Options &options, const std::string &name, DB **dbptr)
 

Detailed Description

Definition at line 1860 of file db_test.cc.

Constructor & Destructor Documentation

§ ModelDB()

leveldb::ModelDB::ModelDB ( const Options options)
inlineexplicit

Definition at line 1867 of file db_test.cc.

1867 : options_(options) { }
const Options options_
Definition: db_test.cc:1958

§ ~ModelDB()

leveldb::ModelDB::~ModelDB ( )
inline

Definition at line 1868 of file db_test.cc.

1868 { }

Member Function Documentation

§ CompactRange()

virtual void leveldb::ModelDB::CompactRange ( const Slice start,
const Slice end 
)
inlinevirtual

Implements leveldb::DB.

Definition at line 1924 of file db_test.cc.

1924  {
1925  }

§ Delete()

virtual Status leveldb::ModelDB::Delete ( const WriteOptions o,
const Slice key 
)
inlinevirtual

Implements leveldb::DB.

Definition at line 1872 of file db_test.cc.

1872  {
1873  return DB::Delete(o, key);
1874  }
virtual Status Delete(const WriteOptions &options, const Slice &key)=0
Definition: db_impl.cc:1482
Here is the call graph for this function:
Here is the caller graph for this function:

§ Get()

virtual Status leveldb::ModelDB::Get ( const ReadOptions options,
const Slice key,
std::string *  value 
)
inlinevirtual

Implements leveldb::DB.

Definition at line 1875 of file db_test.cc.

1876  {
1877  assert(false); // Not implemented
1878  return Status::NotFound(key);
1879  }
static Status NotFound(const Slice &msg, const Slice &msg2=Slice())
Definition: status.h:35
Here is the call graph for this function:

§ GetApproximateSizes()

virtual void leveldb::ModelDB::GetApproximateSizes ( const Range r,
int  n,
uint64_t *  sizes 
)
inlinevirtual

Implements leveldb::DB.

Definition at line 1919 of file db_test.cc.

1919  {
1920  for (int i = 0; i < n; i++) {
1921  sizes[i] = 0;
1922  }
1923  }

§ GetProperty()

virtual bool leveldb::ModelDB::GetProperty ( const Slice property,
std::string *  value 
)
inlinevirtual

Implements leveldb::DB.

Definition at line 1916 of file db_test.cc.

1916  {
1917  return false;
1918  }

§ GetSnapshot()

virtual const Snapshot* leveldb::ModelDB::GetSnapshot ( )
inlinevirtual

Implements leveldb::DB.

Definition at line 1891 of file db_test.cc.

1891  {
1892  ModelSnapshot* snapshot = new ModelSnapshot;
1893  snapshot->map_ = map_;
1894  return snapshot;
1895  }
Here is the caller graph for this function:

§ NewIterator()

virtual Iterator* leveldb::ModelDB::NewIterator ( const ReadOptions options)
inlinevirtual

Implements leveldb::DB.

Definition at line 1880 of file db_test.cc.

1880  {
1881  if (options.snapshot == NULL) {
1882  KVMap* saved = new KVMap;
1883  *saved = map_;
1884  return new ModelIter(saved, true);
1885  } else {
1886  const KVMap* snapshot_state =
1887  &(reinterpret_cast<const ModelSnapshot*>(options.snapshot)->map_);
1888  return new ModelIter(snapshot_state, false);
1889  }
1890  }
std::map< std::string, std::string, STLLessThan > KVMap
Definition: table_test.cc:137

§ Put()

virtual Status leveldb::ModelDB::Put ( const WriteOptions o,
const Slice k,
const Slice v 
)
inlinevirtual

Implements leveldb::DB.

Definition at line 1869 of file db_test.cc.

1869  {
1870  return DB::Put(o, k, v);
1871  }
virtual Status Put(const WriteOptions &options, const Slice &key, const Slice &value)=0
Definition: db_impl.cc:1476
Here is the call graph for this function:
Here is the caller graph for this function:

§ ReleaseSnapshot()

virtual void leveldb::ModelDB::ReleaseSnapshot ( const Snapshot snapshot)
inlinevirtual

Implements leveldb::DB.

Definition at line 1897 of file db_test.cc.

1897  {
1898  delete reinterpret_cast<const ModelSnapshot*>(snapshot);
1899  }
Here is the caller graph for this function:

§ Write()

virtual Status leveldb::ModelDB::Write ( const WriteOptions options,
WriteBatch batch 
)
inlinevirtual

Implements leveldb::DB.

Definition at line 1900 of file db_test.cc.

1900  {
1901  class Handler : public WriteBatch::Handler {
1902  public:
1903  KVMap* map_;
1904  virtual void Put(const Slice& key, const Slice& value) {
1905  (*map_)[key.ToString()] = value.ToString();
1906  }
1907  virtual void Delete(const Slice& key) {
1908  map_->erase(key.ToString());
1909  }
1910  };
1911  Handler handler;
1912  handler.map_ = &map_;
1913  return batch->Iterate(&handler);
1914  }
virtual Status Put(const WriteOptions &o, const Slice &k, const Slice &v)
Definition: db_test.cc:1869
std::map< std::string, std::string, STLLessThan > KVMap
Definition: table_test.cc:137
std::string ToString() const
Definition: status.cc:36
virtual Status Delete(const WriteOptions &o, const Slice &key)
Definition: db_test.cc:1872
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

§ map_

KVMap leveldb::ModelDB::map_
private

Definition at line 1959 of file db_test.cc.

§ options_

const Options leveldb::ModelDB::options_
private

Definition at line 1958 of file db_test.cc.


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