8 namespace swarm {
namespace log {
10 struct primary_cursor_t;
15 bdb_database(DbEnv* e):
24 static DbEnv* createDefaultEnv();
25 void openEnv(
const std::string& basedir);
26 void openForReading(
const std::string& fileName);
27 void create(
const std::string& fileName);
28 void createEmpty(
const std::string& fileName);
30 void put(gpulog::logrecord& lr);
36 shared_ptr<primary_cursor_t> primary_cursor();
39 void addMetaData(
const std::string name,
const std::string value);
40 std::string getMetaData(
const std::string name) ;
41 void fillVersionInfo() ;
42 bool validateVersionInfo() ;
46 void openInternal(
const std::string& fileName,
int open_mode);
58 typedef uint32_t sysid_t;
59 typedef uint8_t evtid_t;
62 uint32_t system_event_id;
64 pkey_t(
const float& t = 0.0,
const int&
sysid = 0,
const int& evid = 0)
65 :time(t),system_event_id((uint32_t)evid << 24 |
sysid){}
67 sysid_t system_id()
const{
return (system_event_id & ~ (255 << 24)); }
68 evtid_t event_id()
const{
return (evtid_t) (system_event_id >> 24); }
74 gpulog::logrecord lr() {
return gpulog::logrecord(ptr); }
75 lrw_t(
const int len):ptr(new char[len]),len(len){
81 struct primary_cursor_t {
88 bool get(pkey_t& key,lrw_t& lr, uint32_t flags);
89 bool first(pkey_t& key,lrw_t& lr){
return get(key,lr,DB_FIRST); }
90 bool position_at(pkey_t& key,lrw_t& lr);
91 bool prev(pkey_t& key,lrw_t& lr){
return get(key,lr,DB_PREV); }
92 bool next(pkey_t& key,lrw_t& lr){
return get(key,lr,DB_NEXT); }
93 bool current(pkey_t& key,lrw_t& lr){
return get(key,lr,DB_CURRENT); }
95 typedef shared_ptr<primary_cursor_t> Pprimary_cursor_t;