forked from LArbys/Supera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.h
50 lines (37 loc) · 944 Bytes
/
db.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef CAFFE_UTIL_DB_HPP
#define CAFFE_UTIL_DB_HPP
#include <string>
#include "caffe.pb.h"
namespace db {
enum Mode { READ, WRITE, NEW };
class Cursor {
public:
Cursor() { }
virtual ~Cursor() { }
virtual void SeekToFirst() = 0;
virtual void Next() = 0;
virtual std::string key() = 0;
virtual std::string value() = 0;
virtual bool valid() = 0;
//DISABLE_COPY_AND_ASSIGN(Cursor);
};
class Transaction {
public:
Transaction() { }
virtual ~Transaction() { }
virtual void Put(const std::string& key, const std::string& value) = 0;
virtual void Commit() = 0;
//DISABLE_COPY_AND_ASSIGN(Transaction);
};
class DB {
public:
DB() { }
virtual ~DB() { }
virtual void Open(const std::string& source, Mode mode) = 0;
virtual void Close() = 0;
virtual Cursor* NewCursor() = 0;
virtual Transaction* NewTransaction() = 0;
//DISABLE_COPY_AND_ASSIGN(DB);
};
} // namespace db
#endif // CAFFE_UTIL_DB_HPP