From b8677cb17b8c4fdf2af1fcd0ead311b9bf2cfead Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Sat, 27 Apr 2013 20:20:44 +0200 Subject: datastore: name refactorings --- datastore-leveldb/src/db.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'datastore-leveldb/src/db.cpp') 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()) { -- cgit v1.2.1