dodo  0.0.1
A C++ library to create containerized Linux services
dodo::persist::KVStore Class Reference

A persistent, multi-threaded key-value store backed by sqlite3 database (file). More...

#include <kvstore.hpp>

Collaboration diagram for dodo::persist::KVStore:

Data Structures

struct  MetaData
 Meta data concerning the key. More...
 

Public Member Functions

 KVStore (const std::filesystem::path &path)
 Create the KVStore object against the path. More...
 
 ~KVStore ()
 Destructor, cleanup sync and close the SQLLite database. More...
 
void checkpoint ()
 Sync all to disk - issue a SQLite full checkpoint. More...
 
void commitTransaction ()
 Commit a transaction. More...
 
bool deleteKey (const std::string &key)
 Delete the key or return false if the key does not exist. More...
 
std::string ensureWithDefault (const std::string &key, const std::string &def)
 If the key does not exist, create it with the default and return the default. More...
 
double ensureWithDefault (const std::string &key, double &def)
 If the key does not exist, create it with the default and return the default. More...
 
int64_t ensureWithDefault (const std::string &key, int64_t &def)
 If the key does not exist, create it with the default and return the default. More...
 
bool exists (const std::string &key) const
 Check if the key exists. More...
 
void filterKeys (std::list< std::string > &keys, const std::string &filter) const
 Return a list of keys that match the filter. More...
 
MetaData getMetaData (const std::string &key) const
 Get MetaData for the key. More...
 
bool getValue (const std::string &key, common::Bytes &value) const
 If the key exists, returns true and copies (overwrites) data to the Bytes. More...
 
bool getValue (const std::string &key, double &value) const
 If the key exists, returns true and sets the value parameter. More...
 
bool getValue (const std::string &key, int64_t &value) const
 If the key exists, returns true and sets the value parameter. More...
 
bool getValue (const std::string &key, std::string &value) const
 If the key exists, returns true and sets the value parameter. More...
 
bool insertKey (const std::string &key, const common::Bytes &value)
 Insert a (key, Bytes) pair. More...
 
bool insertKey (const std::string &key, const double &value)
 Insert a (key, double) pair. More...
 
bool insertKey (const std::string &key, const int64_t &value)
 Insert a (key, int64_t) pair. More...
 
bool insertKey (const std::string &key, const std::string &value)
 Insert a (key, string) pair. More...
 
void optimize ()
 Optimzime, preferably called after workload and implicitly called by the destructor. More...
 
void rollbackTransaction ()
 Rollback a transaction. More...
 
bool setKey (const std::string &key, const common::Bytes &value)
 Set the binary data/Bytes value of an existing key. More...
 
bool setKey (const std::string &key, const double &value)
 Set the double value of an existing key. More...
 
bool setKey (const std::string &key, const int64_t &value)
 Set the int64_t value of an existing key. More...
 
bool setKey (const std::string &key, const std::string &value)
 Set the string value of an existing key. More...
 
void startTransaction ()
 Start a transaction. More...
 
void vacuum ()
 Vaccum - clean and defragment, which may increase efficiency after heavy deletion and/or modification. More...
 

Protected Member Functions

void createSchema ()
 Create the SQLite schema. More...
 
void prepareSQL ()
 Prepare all SQL statements. More...
 

Protected Attributes

sqlite::Databasedb_
 The database handle. More...
 
std::filesystem::path path_
 The filesystem path to the kvstore. More...
 
sqlite::DMLstmt_delete_
 Delete key pair statement handle. More...
 
sqlite::Querystmt_exists_
 check key existence statement handle. More...
 
sqlite::Querystmt_getvalue_
 Get-value-for-key statement handle. More...
 
sqlite::DMLstmt_insert_
 Insert key pair statement handle. More...
 
sqlite::Querystmt_key_filter_
 Key filter statement handle. More...
 
sqlite::Querystmt_key_value_filter_
 Key + value filter statement handle. More...
 
sqlite::Querystmt_metadata_
 Get metadata statement handle. More...
 
sqlite::DMLstmt_update_
 Update key pair statement handle. More...
 

Detailed Description

A persistent, multi-threaded key-value store backed by sqlite3 database (file).

If each thread uses its own KVStore object, no explicit synchronization is required between the threads. Cluster filesystems are not supported - two processes can only write to a single SQLite file if the processes run on the same host.

The KVStore is backed by the kvstore table. In SQLite, values in the same column can have different data types, so the table can store values of any of the supported data types:

DataType C++ type SQLite type
dtInteger int64_t SQLITE_INTEGER
dtFloat double SQLITE_FLOAT
dtText std::string SQLITE3_TEXT
dtBlob common::Bytes SQLITE_BLOB
dtUnknown used to indicate the unknown dataType of a non-existing key

In typical use the code is aware of the datatype of a key, so typical use would be

persist::KVStore store("mystore.db");
store.insertKey( "pi", 3.14 ); // insert as a double value
double pi = store.asDouble( "pi" ); // retrieve as a double value as we know it is a double.

Moreover, SQLite will convert (CAST) between types where possible, but revert to defaults when it can't. For example,

store.insertKey( "key", "value" );
cout << store.asInteger( "key" ) << endl;

will output 0 as the string "value" does not convert to an integer. Use getMetaData to check if a key is of the expected DataType.

It is also possible to store dodo::common::Bytes (dtBlob / SQLITE_BLOB) types.

The SQLite database is initailized in WAL mode for performance. Make sure to use transactions to group bulk insertKey or setKey as that is much faster.

The examples/kvstore/kvstore.cpp is a simple speed test using a KVStore:

#include <iostream>
#include <dodo.hpp>
using namespace dodo;
using namespace std;
#define KEY_SPACE 160000
#define KEY_MAX_LENGTH 64
#define DATA_MAX_LENGTH 128
#define MAX_SETKEYS 1000
set<string> keys;
string random_string( size_t length ) {
auto randchar = []() -> char
{
const char charset[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
const size_t max_index = (sizeof(charset) - 1);
return charset[ rand() % max_index ];
};
string str(length,0);
generate_n( str.begin(), length, randchar );
return str;
}
void setupTestData() {
for ( size_t i = 0; i < KEY_SPACE; i++ ) {
keys.insert( random_string( rand() % KEY_MAX_LENGTH ) );
}
}
void insertKeys( persist::KVStore &store ) {
for ( const auto &k : keys ) {
store.insertKey( k, random_string( rand() % DATA_MAX_LENGTH ) );
}
}
void fetchKeys( persist::KVStore &store ) {
for ( const auto &k : keys ) {
string value = "";
if ( ! store.getValue( k, value ) ) throw runtime_error( "key not found - cannot be!" );
}
}
void updateKeys( persist::KVStore &store ) {
size_t count = 0;
for ( const auto &k : keys ) {
store.setKey( k, random_string( rand() % DATA_MAX_LENGTH ) );
if ( ++count > MAX_SETKEYS ) break;
}
}
int main() {
try {
persist::KVStore store( "kvstore.db" );
double time_setup = 0.0;
double time_insert = 0.0;
double time_checkpoint = 0.0;
double time_fetch = 0.0;
double time_update = 0.0;
sw.start();
setupTestData();
time_setup = sw.restart();
insertKeys( store );
time_insert = sw.restart();
store.checkpoint();
time_checkpoint = sw.restart();
fetchKeys( store );
time_fetch = sw.restart();
updateKeys( store );
time_update = sw.stop();
cout << "setup " << time_setup << "s" << endl;
cout << "insertKey (bulk) " << time_insert << "s" << endl;
cout << "checkpoint " << time_checkpoint << "s" << endl;
cout << "getValue " << time_fetch << "s" << endl;
cout << "setKey (single) " << time_update << "s" << endl;
cout << static_cast<double>(keys.size())/time_insert << " insertKey (bulk) per second" << endl;
cout << static_cast<double>(keys.size())/time_fetch << " getValue per second" << endl;
cout << static_cast<double>(MAX_SETKEYS)/time_update << " setKey (single) per second" << endl;
}
catch ( const runtime_error &e ) {
cerr << e.what() << endl;
}
std::remove( "kvstore.db" );
return 0;
}

Definition at line 77 of file kvstore.hpp.

Constructor & Destructor Documentation

◆ KVStore()

dodo::persist::KVStore::KVStore ( const std::filesystem::path &  path)

Create the KVStore object against the path.

If the KVStore does not exist yet, it is created. If it already exists, it is opened.

Parameters
pathThe filesystem path of the KVStore file.

Definition at line 34 of file kvstore.cpp.

References createSchema(), db_, path_, prepareSQL(), stmt_delete_, stmt_exists_, stmt_getvalue_, stmt_insert_, stmt_key_filter_, stmt_key_value_filter_, stmt_metadata_, and stmt_update_.

Here is the call graph for this function:

◆ ~KVStore()

dodo::persist::KVStore::~KVStore ( )

Destructor, cleanup sync and close the SQLLite database.

Definition at line 50 of file kvstore.cpp.

References checkpoint(), db_, optimize(), stmt_delete_, stmt_exists_, stmt_getvalue_, stmt_insert_, stmt_key_filter_, stmt_key_value_filter_, stmt_metadata_, and stmt_update_.

Here is the call graph for this function:

Member Function Documentation

◆ checkpoint()

void dodo::persist::KVStore::checkpoint ( )

Sync all to disk - issue a SQLite full checkpoint.

Definition at line 64 of file kvstore.cpp.

References dodo::persist::sqlite::Database::checkPointFull(), and db_.

Referenced by ~KVStore().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ commitTransaction()

void dodo::persist::KVStore::commitTransaction ( )

Commit a transaction.

Throws a dodo::common::Exception when no transaction has started.

Definition at line 68 of file kvstore.cpp.

References dodo::persist::sqlite::Database::commit(), and db_.

Here is the call graph for this function:

◆ createSchema()

void dodo::persist::KVStore::createSchema ( )
protected

Create the SQLite schema.

Definition at line 72 of file kvstore.cpp.

References db_, dodo::persist::sqlite::DDL::execute(), dodo::persist::sqlite::Statement::prepare(), and dodo::persist::sqlite::Query::step().

Referenced by KVStore().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteKey()

bool dodo::persist::KVStore::deleteKey ( const std::string &  key)

Delete the key or return false if the key does not exist.

Parameters
keyThe key.
Returns
True if the key existed.

Definition at line 90 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::DML::execute(), dodo::persist::sqlite::Statement::reset(), and stmt_delete_.

Here is the call graph for this function:

◆ ensureWithDefault() [1/3]

std::string dodo::persist::KVStore::ensureWithDefault ( const std::string &  key,
const std::string &  def 
)

If the key does not exist, create it with the default and return the default.

If the key exists, return its value (which may not be the default).

Parameters
keyThe key.
defThe string value for the key if it does not exist.
Returns
The key value.

Definition at line 97 of file kvstore.cpp.

References getValue(), and insertKey().

Here is the call graph for this function:

◆ ensureWithDefault() [2/3]

double dodo::persist::KVStore::ensureWithDefault ( const std::string &  key,
double &  def 
)

If the key does not exist, create it with the default and return the default.

If the key exists, return its value (which may not be the default).

Parameters
keyThe key.
defThe double value for the key if it does not exist.
Returns
The key value.

Definition at line 107 of file kvstore.cpp.

References getValue(), and insertKey().

Here is the call graph for this function:

◆ ensureWithDefault() [3/3]

int64_t dodo::persist::KVStore::ensureWithDefault ( const std::string &  key,
int64_t &  def 
)

If the key does not exist, create it with the default and return the default.

If the key exists, return its value (which may not be the default).

Parameters
keyThe key.
defThe int64_t value for the key if it does not exist.
Returns
The key value.

Definition at line 117 of file kvstore.cpp.

References getValue(), and insertKey().

Here is the call graph for this function:

◆ exists()

bool dodo::persist::KVStore::exists ( const std::string &  key) const

Check if the key exists.

Unless the value is not required , it is more efficient to get the value in one go by calling the getString(), getDouble(), getInt64() and getData() members, which return false if the key does not exist.

Parameters
keyThe key to check for.
Returns
False if the key does not exist.

Definition at line 127 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::Query::getInt(), dodo::persist::sqlite::Statement::reset(), dodo::persist::sqlite::Query::step(), and stmt_exists_.

Here is the call graph for this function:

◆ filterKeys()

void dodo::persist::KVStore::filterKeys ( std::list< std::string > &  keys,
const std::string &  filter 
) const

Return a list of keys that match the filter.

Parameters
keysThe list that receives the keys. The list is cleared before assigning keys so it may turn up empty if the filter matches no keys.
filterThe SQL-style case-sensitive filter as in 'match', 'match'

Definition at line 135 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::Query::getText(), dodo::persist::sqlite::Statement::reset(), dodo::persist::sqlite::Query::step(), and stmt_key_filter_.

Here is the call graph for this function:

◆ getMetaData()

◆ getValue() [1/4]

bool dodo::persist::KVStore::getValue ( const std::string &  key,
common::Bytes value 
) const

If the key exists, returns true and copies (overwrites) data to the Bytes.

Parameters
keyThe key to get the value for.
valueThe Bytes that will receive the data.
Returns
False if the key does not exist.

Definition at line 189 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::Query::getBytes(), dodo::persist::sqlite::Statement::reset(), dodo::persist::sqlite::Query::step(), and stmt_getvalue_.

Here is the call graph for this function:

◆ getValue() [2/4]

bool dodo::persist::KVStore::getValue ( const std::string &  key,
double &  value 
) const

If the key exists, returns true and sets the value parameter.

Parameters
keyThe key to get the value for.
valueThe destination value to set.
Returns
False if the key does not exist.

Definition at line 167 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::Query::getDouble(), dodo::persist::sqlite::Statement::reset(), dodo::persist::sqlite::Query::step(), and stmt_getvalue_.

Here is the call graph for this function:

◆ getValue() [3/4]

bool dodo::persist::KVStore::getValue ( const std::string &  key,
int64_t &  value 
) const

If the key exists, returns true and sets the value parameter.

Parameters
keyThe key to get the value for.
valueThe destination value to set.
Returns
False if the key does not exist.

Definition at line 178 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::Query::getInt64(), dodo::persist::sqlite::Statement::reset(), dodo::persist::sqlite::Query::step(), and stmt_getvalue_.

Here is the call graph for this function:

◆ getValue() [4/4]

bool dodo::persist::KVStore::getValue ( const std::string &  key,
std::string &  value 
) const

If the key exists, returns true and sets the value parameter.

Parameters
keyThe key to get the value for.
valueThe destination value to set.
Returns
False if the key does not exist.

Definition at line 156 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::Query::getText(), dodo::persist::sqlite::Statement::reset(), dodo::persist::sqlite::Query::step(), and stmt_getvalue_.

Referenced by ensureWithDefault().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertKey() [1/4]

bool dodo::persist::KVStore::insertKey ( const std::string &  key,
const common::Bytes value 
)

Insert a (key, Bytes) pair.

Note that the size of the data cannot exceed INT_MAX, and exception is thrown if the Bytes is larger.

Parameters
keyThe key.
valueThe Bytes to insert.
Returns
True if the key was created, false if the key already exists.

Definition at line 226 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::DML::execute(), dodo::persist::sqlite::Statement::reset(), and stmt_insert_.

Here is the call graph for this function:

◆ insertKey() [2/4]

bool dodo::persist::KVStore::insertKey ( const std::string &  key,
const double &  value 
)

Insert a (key, double) pair.

Parameters
keyThe key.
valueThe double value to set.
Returns
True if the key was created, false if the key already exists.

Definition at line 208 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::DML::execute(), dodo::persist::sqlite::Statement::reset(), and stmt_insert_.

Here is the call graph for this function:

◆ insertKey() [3/4]

bool dodo::persist::KVStore::insertKey ( const std::string &  key,
const int64_t &  value 
)

Insert a (key, int64_t) pair.

Parameters
keyThe key.
valueThe int64_t value to set.
Returns
True if the key was created, false if the key already exists.

Definition at line 217 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::DML::execute(), dodo::persist::sqlite::Statement::reset(), and stmt_insert_.

Here is the call graph for this function:

◆ insertKey() [4/4]

bool dodo::persist::KVStore::insertKey ( const std::string &  key,
const std::string &  value 
)

Insert a (key, string) pair.

Parameters
keyThe key.
valueThe string value to set.
Returns
True if the key was created, false if the key already exists.

Definition at line 200 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::DML::execute(), dodo::persist::sqlite::Statement::reset(), and stmt_insert_.

Referenced by ensureWithDefault().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ optimize()

void dodo::persist::KVStore::optimize ( )

Optimzime, preferably called after workload and implicitly called by the destructor.

Definition at line 235 of file kvstore.cpp.

References db_, dodo::persist::sqlite::DDL::execute(), and dodo::persist::sqlite::Statement::prepare().

Referenced by ~KVStore().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepareSQL()

void dodo::persist::KVStore::prepareSQL ( )
protected

Prepare all SQL statements.

Definition at line 241 of file kvstore.cpp.

References db_, dodo::persist::sqlite::DDL::execute(), dodo::persist::sqlite::Statement::prepare(), stmt_delete_, stmt_exists_, stmt_getvalue_, stmt_insert_, stmt_key_filter_, stmt_key_value_filter_, stmt_metadata_, and stmt_update_.

Referenced by KVStore().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rollbackTransaction()

void dodo::persist::KVStore::rollbackTransaction ( )

Rollback a transaction.

Throws a dodo::common::Exception when no transaction has started.

Definition at line 256 of file kvstore.cpp.

References db_, and dodo::persist::sqlite::Database::rollback().

Here is the call graph for this function:

◆ setKey() [1/4]

bool dodo::persist::KVStore::setKey ( const std::string &  key,
const common::Bytes value 
)

Set the binary data/Bytes value of an existing key.

The function returns false if the key does not exist.

Parameters
keyThe key.
valueThe Bytes to set.
Returns
True if the key exists, in which case it is also updated.

Definition at line 284 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::DML::execute(), dodo::persist::sqlite::Statement::reset(), and stmt_update_.

Here is the call graph for this function:

◆ setKey() [2/4]

bool dodo::persist::KVStore::setKey ( const std::string &  key,
const double &  value 
)

Set the double value of an existing key.

The function returns false if the key does not exist.

Parameters
keyThe key.
valueThe double value to set.
Returns
True if the key exists, in which case it is also updated.

Definition at line 268 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::DML::execute(), dodo::persist::sqlite::Statement::reset(), and stmt_update_.

Here is the call graph for this function:

◆ setKey() [3/4]

bool dodo::persist::KVStore::setKey ( const std::string &  key,
const int64_t &  value 
)

Set the int64_t value of an existing key.

The function returns false if the key does not exist.

Parameters
keyThe key.
valueThe int64_t value to set.
Returns
True if the key exists, in which case it is also updated.

Definition at line 276 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::DML::execute(), dodo::persist::sqlite::Statement::reset(), and stmt_update_.

Here is the call graph for this function:

◆ setKey() [4/4]

bool dodo::persist::KVStore::setKey ( const std::string &  key,
const std::string &  value 
)

Set the string value of an existing key.

The function returns false if the key does not exist.

Parameters
keyThe key.
valueThe string value to set.
Returns
True if the key exists, in which case it is also updated.

Definition at line 260 of file kvstore.cpp.

References dodo::persist::sqlite::DML::bind(), dodo::persist::sqlite::DML::execute(), dodo::persist::sqlite::Statement::reset(), and stmt_update_.

Here is the call graph for this function:

◆ startTransaction()

void dodo::persist::KVStore::startTransaction ( )

Start a transaction.

If insertKey or setKey calls are not inside a started transaction, each will commit automatically and indvidually, which is mach (much!) slower for bulk operations.

Definition at line 292 of file kvstore.cpp.

References db_, dodo::persist::sqlite::DDL::execute(), and dodo::persist::sqlite::Statement::prepare().

Here is the call graph for this function:

◆ vacuum()

void dodo::persist::KVStore::vacuum ( )

Vaccum - clean and defragment, which may increase efficiency after heavy deletion and/or modification.

Definition at line 298 of file kvstore.cpp.

References db_, dodo::persist::sqlite::DDL::execute(), and dodo::persist::sqlite::Statement::prepare().

Here is the call graph for this function:

Field Documentation

◆ db_

sqlite::Database* dodo::persist::KVStore::db_
protected

◆ path_

std::filesystem::path dodo::persist::KVStore::path_
protected

The filesystem path to the kvstore.

Definition at line 303 of file kvstore.hpp.

Referenced by KVStore().

◆ stmt_delete_

sqlite::DML* dodo::persist::KVStore::stmt_delete_
protected

Delete key pair statement handle.

Definition at line 318 of file kvstore.hpp.

Referenced by deleteKey(), KVStore(), prepareSQL(), and ~KVStore().

◆ stmt_exists_

sqlite::Query* dodo::persist::KVStore::stmt_exists_
protected

check key existence statement handle.

Definition at line 309 of file kvstore.hpp.

Referenced by exists(), KVStore(), prepareSQL(), and ~KVStore().

◆ stmt_getvalue_

sqlite::Query* dodo::persist::KVStore::stmt_getvalue_
protected

Get-value-for-key statement handle.

Definition at line 312 of file kvstore.hpp.

Referenced by getValue(), KVStore(), prepareSQL(), and ~KVStore().

◆ stmt_insert_

sqlite::DML* dodo::persist::KVStore::stmt_insert_
protected

Insert key pair statement handle.

Definition at line 315 of file kvstore.hpp.

Referenced by insertKey(), KVStore(), prepareSQL(), and ~KVStore().

◆ stmt_key_filter_

sqlite::Query* dodo::persist::KVStore::stmt_key_filter_
protected

Key filter statement handle.

Definition at line 324 of file kvstore.hpp.

Referenced by filterKeys(), KVStore(), prepareSQL(), and ~KVStore().

◆ stmt_key_value_filter_

sqlite::Query* dodo::persist::KVStore::stmt_key_value_filter_
protected

Key + value filter statement handle.

Definition at line 327 of file kvstore.hpp.

Referenced by KVStore(), prepareSQL(), and ~KVStore().

◆ stmt_metadata_

sqlite::Query* dodo::persist::KVStore::stmt_metadata_
protected

Get metadata statement handle.

Definition at line 330 of file kvstore.hpp.

Referenced by getMetaData(), KVStore(), prepareSQL(), and ~KVStore().

◆ stmt_update_

sqlite::DML* dodo::persist::KVStore::stmt_update_
protected

Update key pair statement handle.

Definition at line 321 of file kvstore.hpp.

Referenced by KVStore(), prepareSQL(), setKey(), and ~KVStore().


The documentation for this class was generated from the following files:
dodo::persist::KVStore
A persistent, multi-threaded key-value store backed by sqlite3 database (file).
Definition: kvstore.hpp:77
dodo::persist::KVStore::getValue
bool getValue(const std::string &key, std::string &value) const
If the key exists, returns true and sets the value parameter.
Definition: kvstore.cpp:156
dodo::common::StopWatch::start
void start()
Start the stopwatch.
Definition: util.hpp:69
dodo::persist::KVStore::startTransaction
void startTransaction()
Start a transaction.
Definition: kvstore.cpp:292
dodo::persist::KVStore::checkpoint
void checkpoint()
Sync all to disk - issue a SQLite full checkpoint.
Definition: kvstore.cpp:64
dodo::persist::KVStore::setKey
bool setKey(const std::string &key, const std::string &value)
Set the string value of an existing key.
Definition: kvstore.cpp:260
dodo::persist::KVStore::insertKey
bool insertKey(const std::string &key, const std::string &value)
Insert a (key, string) pair.
Definition: kvstore.cpp:200
dodo
A C++ platform interface to lean Linux services tailored for containerized deployment.
Definition: application.hpp:29
dodo.hpp
Includes all dodo headers.
dodo::common::StopWatch
StopWatch timing class.
Definition: util.hpp:54
dodo::persist::KVStore::commitTransaction
void commitTransaction()
Commit a transaction.
Definition: kvstore.cpp:68
dodo::common::StopWatch::stop
double stop()
Stop the stopwatch.
Definition: util.hpp:78
dodo::initLibrary
void initLibrary()
Initialize the dodo library.
Definition: dodo.hpp:41
dodo::closeLibrary
void closeLibrary()
Close the dodo library.
Definition: dodo.hpp:51
dodo::common::StopWatch::restart
double restart()
Stop the stopwatch, start the Stopwatch again and return the elapsed time since previous start.
Definition: util.hpp:84