diff options
Diffstat (limited to 'datastore-leveldb/src/db.cpp')
-rw-r--r-- | datastore-leveldb/src/db.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/datastore-leveldb/src/db.cpp b/datastore-leveldb/src/db.cpp index 58889dd..1ca8d50 100644 --- a/datastore-leveldb/src/db.cpp +++ b/datastore-leveldb/src/db.cpp @@ -21,14 +21,14 @@ static bool sensor_name_is_sane(std::string& name) { return true; } -std::string make_key(const uint64_t timestamp) { +std::string db_make_key(const uint64_t timestamp) { std::stringstream key; key << "ts-"; key << std::setfill('0') << std::setw(20) << timestamp; return key.str(); } -leveldb::DB *getDB(std::string& name) { +leveldb::DB *db_get(std::string& name) { getDBmutex.lock(); if (dbs.find(name) == dbs.end()) { if (not sensor_name_is_sane(name)) { @@ -55,14 +55,14 @@ leveldb::DB *getDB(std::string& name) { bool db_insert(std::string& name, const uint64_t timestamp, std::string& value) { - leveldb::DB *db = getDB(name); + leveldb::DB *db = db_get(name); if (db == nullptr) return false; - auto status = db->Put(leveldb::WriteOptions(), make_key(timestamp), value); + auto status = db->Put(leveldb::WriteOptions(), db_make_key(timestamp), value); return status.ok(); } -void closeDB() { +void db_close() { std::cout << "Close Databases: "; auto it = dbs.begin(); while (it != dbs.end()) { |