Obsidian
Probabilistic Geophysical Joint Inversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
stateline::db::Database Class Reference

Public Member Functions

 Database (const DBSettings &s)
 Create a new database connection. More...
 
 ~Database ()
 Clean up and free resources used by the database connection.
 
uint cacheSize ()
 Get the cache size. More...
 
std::string get (const leveldb::Slice &key)
 Get the database entry for a particular key. More...
 
void put (const leveldb::Slice &key, const leveldb::Slice &value)
 Write an entry to the database. More...
 
void remove (const leveldb::Slice &key)
 Remove the entry for a particular key. More...
 
void batch (leveldb::WriteBatch &batch)
 Write to the database batched. More...
 
void swap (const std::vector< std::string > &keys1, const std::vector< std::string > &keys2)
 Swap the values for a set of keys with another. More...
 

Constructor & Destructor Documentation

stateline::db::Database::Database ( const DBSettings s)

Create a new database connection.

Parameters
sThe database settings.

Member Function Documentation

void stateline::db::Database::batch ( leveldb::WriteBatch &  batch)

Write to the database batched.

Parameters
batchThe batched keys and values to write.
uint stateline::db::Database::cacheSize ( )

Get the cache size.

Returns
The cache size in bytes.
std::string stateline::db::Database::get ( const leveldb::Slice &  key)

Get the database entry for a particular key.

Parameters
keyThe key for the entry.
Returns
String containing the value of the entry.
void stateline::db::Database::put ( const leveldb::Slice &  key,
const leveldb::Slice &  value 
)

Write an entry to the database.

Parameters
keyThe key for the entry.
valueThe value of the entry.
void stateline::db::Database::remove ( const leveldb::Slice &  key)

Remove the entry for a particular key.

Parameters
keyThe key for the entry.
void stateline::db::Database::swap ( const std::vector< std::string > &  keys1,
const std::vector< std::string > &  keys2 
)

Swap the values for a set of keys with another.

Parameters
keys1The first set of keys to swap.
keys2The second set of keys to swap. This must have the same length as keys1.

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