summaryrefslogtreecommitdiff
path: root/datastore-leveldb/src/db.cpp
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2013-04-27 20:20:44 +0200
committerYves Fischer <yvesf-git@xapek.org>2013-04-27 20:21:07 +0200
commitb8677cb17b8c4fdf2af1fcd0ead311b9bf2cfead (patch)
tree473ebaa82a66f86f2a7544f2cfe6567b43c4675a /datastore-leveldb/src/db.cpp
parent705af77c2fef7a27150b741cde228e2fe55a029b (diff)
downloadebus-alt-b8677cb17b8c4fdf2af1fcd0ead311b9bf2cfead.tar.gz
ebus-alt-b8677cb17b8c4fdf2af1fcd0ead311b9bf2cfead.zip
datastore: name refactorings
Diffstat (limited to 'datastore-leveldb/src/db.cpp')
-rw-r--r--datastore-leveldb/src/db.cpp10
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()) {