Commit 70d4314a authored by lw's avatar lw

*** empty log message ***

parent 7d56f504
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include "co_dcli.h"
#include "db_cxx.h" #include "db_cxx.h"
#include "wb_ldh.h" #include "wb_ldh.h"
#include "wb_destination.h" #include "wb_destination.h"
...@@ -12,12 +13,19 @@ ...@@ -12,12 +13,19 @@
wb_db_class::wb_db_class(wb_db *db, wb_db_txn *txn, pwr_tCid cid) : wb_db_class::wb_db_class(wb_db *db, wb_db_txn *txn, pwr_tCid cid) :
m_db(db), m_key(&m_k, sizeof(m_k)) m_db(db), m_key(&m_k, sizeof(m_k)), m_data(0, 0), m_dbc(0)
{ {
m_k.oid = pwr_cNOid; m_k.oid = pwr_cNOid;
m_k.cid = cid; m_k.cid = cid;
m_db->m_class->cursor(txn, &m_dbc, 0); m_db->m_t_class->cursor(txn, &m_dbc, 0);
}
wb_db_class::wb_db_class(wb_db *db, pwr_tCid cid, pwr_tOid oid) :
m_db(db), m_key(&m_k, sizeof(m_k)), m_data(0, 0), m_dbc(0)
{
m_k.oid = oid;
m_k.cid = cid;
} }
bool wb_db_class::succ(pwr_tOid oid) bool wb_db_class::succ(pwr_tOid oid)
...@@ -25,7 +33,7 @@ bool wb_db_class::succ(pwr_tOid oid) ...@@ -25,7 +33,7 @@ bool wb_db_class::succ(pwr_tOid oid)
m_k.oid = oid; m_k.oid = oid;
m_k.oid.oix += 1; m_k.oid.oix += 1;
int ret = m_dbc->get(&m_key, 0, DB_SET_RANGE); int ret = m_dbc->get(&m_key, &m_data, DB_SET_RANGE);
return ret == 0; return ret == 0;
} }
...@@ -33,25 +41,26 @@ bool wb_db_class::pred(pwr_tOid oid) ...@@ -33,25 +41,26 @@ bool wb_db_class::pred(pwr_tOid oid)
{ {
m_k.oid = oid; m_k.oid = oid;
int ret = m_dbc->get(&m_key, 0, DB_SET_RANGE); int ret = m_dbc->get(&m_key, &m_data, DB_SET_RANGE);
if (ret != 0) if (ret != 0)
return false; return false;
ret = m_dbc->get(&m_key, 0, DB_PREV); ret = m_dbc->get(&m_key, &m_data, DB_PREV);
return ret == 0; return ret == 0;
} }
void wb_db_class::put(wb_db_txn *txn) void wb_db_class::put(wb_db_txn *txn)
{ {
m_db->m_class->put(txn, &m_key, 0, 0); m_db->m_t_class->put(txn, &m_key, &m_data, 0);
} }
void wb_db_class::del(wb_db_txn *txn) void wb_db_class::del(wb_db_txn *txn)
{ {
m_db->m_class->del(txn, &m_key, 0); m_db->m_t_class->del(txn, &m_key, 0);
} }
wb_db_class::~wb_db_class() wb_db_class::~wb_db_class()
{ {
if (m_dbc)
m_dbc->close(); m_dbc->close();
} }
...@@ -59,12 +68,47 @@ wb_db_name::wb_db_name(wb_db *db, wb_db_txn *txn) : ...@@ -59,12 +68,47 @@ wb_db_name::wb_db_name(wb_db *db, wb_db_txn *txn) :
m_db(db), m_key(&m_k, sizeof(m_k)), m_data(&m_d, sizeof(m_d)) m_db(db), m_key(&m_k, sizeof(m_k)), m_data(&m_d, sizeof(m_d))
{ {
m_k.poid = pwr_cNOid; m_k.poid = pwr_cNOid;
}
wb_db_name::wb_db_name(wb_db *db, wb_db_ohead &o) :
m_db(db), m_key(&m_k, sizeof(m_k)), m_data(&m_d, sizeof(m_d))
{
m_k.poid = o.poid();
strcpy(m_k.normname, o.normname());
m_d.oid = o.oid();
}
wb_db_name::wb_db_name(wb_db *db, pwr_tOid oid, pwr_tOid poid, const char *name) :
m_db(db), m_key(&m_k, sizeof(m_k)), m_data(&m_d, sizeof(m_d))
{
m_k.poid = poid;
strcpy(m_k.normname, name);
m_d.oid = oid;
} }
//wb_db_name::wb_db_name(wb_db *db, pwr_tOid, char *name) :
// m_db(db), m_key(&m_k, sizeof(m_k)), m_data(&m_d, sizeof(m_d))
//{
//}
//wb_db_name::wb_db_name(wb_db *db, pwr_tOid poid, const char *name) :
// m_db(db), m_key(&m_k, sizeof(m_k)), m_data(&m_d, sizeof(m_d))
//{
// m_k.poid = poid();
// strcpy(m_k.normname, name);
// m_d.oid = ?;
//}
//wb_db_name::wb_db_name(wb_db *db, wb_db_txn *txn, pwr_tOid poid, wb_name name) :
// m_db(db), m_key(&m_k, sizeof(m_k)), m_data(&m_d, sizeof(m_d))
//{
//}
void wb_db_name::put(wb_db_txn *txn) void wb_db_name::put(wb_db_txn *txn)
{ {
m_db->m_name->put(txn, &m_key, 0, 0); m_db->m_t_name->put(txn, &m_key, &m_data, 0);
} }
wb_db_ohead::wb_db_ohead(wb_db *db) : wb_db_ohead::wb_db_ohead(wb_db *db) :
...@@ -85,47 +129,110 @@ wb_db_ohead::wb_db_ohead(wb_db *db, wb_db_txn *txn, pwr_tOid oid) : ...@@ -85,47 +129,110 @@ wb_db_ohead::wb_db_ohead(wb_db *db, wb_db_txn *txn, pwr_tOid oid) :
get(txn); get(txn);
} }
wb_db_ohead::wb_db_ohead(wb_db *db, pwr_tOid oid, pwr_tCid cid,
pwr_tOid poid, pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid, pwr_tOid loid,
const char *name, const char *normname,
pwr_tTime ohTime, pwr_tTime rbTime, pwr_tTime dbTime,
size_t rbSize, size_t dbSize) :
m_db(db), m_key(&m_o.oid, sizeof(m_o.oid)), m_data(&m_o, sizeof(m_o))
{
m_o.oid = oid;
m_o.cid = cid;
m_o.poid = poid;
strcpy(m_o.name, name);
strcpy(m_o.normname, normname);
m_o.time = ohTime;
m_o.boid = boid;
m_o.aoid = aoid;
m_o.foid = foid;
m_o.loid =loid;
m_o.flags.m = 0;
m_o.body[0].time = rbTime;
m_o.body[0].size = rbSize;
m_o.body[1].time = dbTime;
m_o.body[1].size = dbSize;
}
wb_db_ohead &wb_db_ohead::get(wb_db_txn *txn) wb_db_ohead &wb_db_ohead::get(wb_db_txn *txn)
{ {
m_db->m_ohead->get(txn, &m_key, &m_data, 0); m_db->m_t_ohead->get(txn, &m_key, &m_data, 0);
return *this; return *this;
} }
void wb_db_ohead::put(wb_db_txn *txn) void wb_db_ohead::put(wb_db_txn *txn)
{ {
m_db->m_ohead->put(txn, &m_key, &m_data, 0); m_db->m_t_ohead->put(txn, &m_key, &m_data, 0);
} }
wb_db_ohead &wb_db_ohead::get(wb_db_txn *txn, pwr_tOid oid) wb_db_ohead &wb_db_ohead::get(wb_db_txn *txn, pwr_tOid oid)
{ {
m_o.oid = oid; m_o.oid = oid;
m_db->m_ohead->get(txn, &m_key, &m_data, 0); m_db->m_t_ohead->get(txn, &m_key, &m_data, 0);
return *this; return *this;
} }
wb_db_ohead &wb_db_ohead::get(pwr_tOid oid) void wb_db_ohead::del(wb_db_txn *txn)
{ {
m_o.oid = oid; m_db->m_t_ohead->del(txn, &m_key, 0);
m_db->m_ohead->get(m_db->m_txn, &m_key, &m_data, 0);
return *this;
} }
void wb_db_ohead::del(wb_db_txn *txn) wb_db_rbody::wb_db_rbody(wb_db *db, pwr_tOid oid, size_t size, void *p) :
m_db(db), m_oid(oid), m_size(size), m_p(p), m_key(&m_oid, sizeof(m_oid)), m_data(p, size)
{
}
void wb_db_rbody::put(wb_db_txn *txn)
{
m_db->m_t_rbody->put(txn, &m_key, &m_data, 0);
}
wb_db_dbody::wb_db_dbody(wb_db *db, pwr_tOid oid, size_t size, void *p) :
m_db(db), m_oid(oid), m_size(size), m_p(p), m_key(&m_oid, sizeof(m_oid)), m_data(p, size)
{
}
void wb_db_dbody::put(wb_db_txn *txn)
{
m_db->m_t_dbody->put(txn, &m_key, &m_data, 0);
}
wb_db::wb_db()
{
}
wb_db::wb_db(pwr_tVid vid) :
m_vid(vid)
{ {
m_db->m_ohead->del(txn, &m_key, 0);
} }
void wb_db::close() void wb_db::close()
{ {
m_ohead->close(0); m_t_ohead->close(0);
m_obody->close(0); m_t_rbody->close(0);
m_class->close(0); m_t_dbody->close(0);
m_name->close(0); m_t_class->close(0);
m_info->close(0); m_t_name->close(0);
m_t_info->close(0);
m_env->close(0); m_env->close(0);
} }
void wb_db::create(pwr_tVid vid, pwr_tCid cid, const char *volumeName, const char *fileName)
{
m_vid = vid;
m_cid = cid;
strcpy(m_volumeName, volumeName);
dcli_translate_filename(m_fileName, fileName);
open(m_fileName);
}
void wb_db::open(char *name) void wb_db::open(char *name)
{ {
struct stat sb; struct stat sb;
...@@ -146,17 +253,19 @@ void wb_db::open(char *name) ...@@ -146,17 +253,19 @@ void wb_db::open(char *name)
DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_RECOVER, DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_RECOVER,
S_IRUSR | S_IWUSR); S_IRUSR | S_IWUSR);
m_ohead = new Db(m_env, 0); m_t_ohead = new Db(m_env, 0);
m_obody = new Db(m_env, 0); m_t_rbody = new Db(m_env, 0);
m_class = new Db(m_env, 0); m_t_dbody = new Db(m_env, 0);
m_name = new Db(m_env, 0); m_t_class = new Db(m_env, 0);
m_info = new Db(m_env, 0); m_t_name = new Db(m_env, 0);
m_t_info = new Db(m_env, 0);
m_ohead->open("ohead", NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR); m_t_ohead->open("ohead", NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR);
m_obody->open("obody", NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR); m_t_rbody->open("rbody", NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR);
m_class->open("class", NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR); m_t_dbody->open("dbody", NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR);
m_name->open("name", NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR); m_t_class->open("class", NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR);
m_info->open("info", NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR); m_t_name->open("name", NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR);
m_t_info->open("info", NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR);
} }
...@@ -170,9 +279,9 @@ pwr_tOid wb_db::new_oid(wb_db_txn *txn) ...@@ -170,9 +279,9 @@ pwr_tOid wb_db::new_oid(wb_db_txn *txn)
pwr_tOid oid; pwr_tOid oid;
Dbt data(&oid, sizeof(oid)); Dbt data(&oid, sizeof(oid));
ret = m_info->get(txn, &key, &data, 0); ret = m_t_info->get(txn, &key, &data, 0);
oid.oix++; oid.oix++;
ret = m_info->put(txn, &key, &data, 0); ret = m_t_info->put(txn, &key, &data, 0);
return oid; return oid;
} }
...@@ -279,18 +388,25 @@ bool wb_db::deleteOset(pwr_tStatus *sts, wb_oset *o) ...@@ -279,18 +388,25 @@ bool wb_db::deleteOset(pwr_tStatus *sts, wb_oset *o)
#endif #endif
bool wb_db::importVolume(wb_export *e) bool wb_db::importVolume(wb_export &e)
{ {
try {
m_env->txn_begin(0, (DbTxn **)&m_txn, 0); m_env->txn_begin(0, (DbTxn **)&m_txn, 0);
e->exportHead(*this); e.exportHead(*this);
e->exportRbody(*this); e.exportRbody(*this);
e->exportDbody(*this); e.exportDbody(*this);
e->exportMeta(*this); e.exportMeta(*this);
m_txn->commit(0); m_txn->commit(0);
m_env->txn_checkpoint(0, 0, 0); m_env->txn_checkpoint(0, 0, 0);
return true; return true;
}
catch (DbException &e) {
m_txn->abort();
printf("exeption: %s\n", e.what());
return false;
}
} }
bool wb_db::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, bool wb_db::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
...@@ -301,7 +417,7 @@ bool wb_db::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, ...@@ -301,7 +417,7 @@ bool wb_db::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
{ {
wb_db_ohead o(this, oid, cid, poid, boid, aoid, foid, loid, name, normname, ohTime, rbTime, dbTime, rbSize, dbSize); wb_db_ohead o(this, oid, cid, poid, boid, aoid, foid, loid, name, normname, ohTime, rbTime, dbTime, rbSize, dbSize);
o.put(m_txn); o.put(m_txn);
wb_db_name n(this, poid, normname); wb_db_name n(this, oid, poid, normname);
n.put(m_txn); n.put(m_txn);
wb_db_class c(this, cid, oid); wb_db_class c(this, cid, oid);
c.put(m_txn); c.put(m_txn);
...@@ -311,19 +427,19 @@ bool wb_db::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, ...@@ -311,19 +427,19 @@ bool wb_db::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
bool wb_db::importRbody(pwr_tOid oid, size_t size, void *body) bool wb_db::importRbody(pwr_tOid oid, size_t size, void *body)
{ {
wb_db_body rb(this, oid, size, body); wb_db_rbody rb(this, oid, size, body);
rb.put(m_txn); rb.put(m_txn);
return true; return true;
} }
bool wb_db::importDbody(pwr_tOid oid, size_t size, void *body) bool wb_db::importDbody(pwr_tOid oid, size_t size, void *body)
{ {
wb_db_body db(this, oid, size, body); wb_db_dbody db(this, oid, size, body);
db.put(m_txn); db.put(m_txn);
return true; return true;
} }
bool wb_db::importMeta(const char *fileName) bool wb_db::importMeta(dbs_sEnv *ep)
{ {
return true; return true;
} }
...@@ -34,13 +34,17 @@ class wb_db : public wb_import ...@@ -34,13 +34,17 @@ class wb_db : public wb_import
{ {
public: public:
pwr_tVid m_vid; pwr_tVid m_vid;
pwr_tCid m_cid;
pwr_tObjName m_volumeName;
char m_fileName[512];
DbEnv *m_env; DbEnv *m_env;
Db *m_ohead; Db *m_t_ohead;
Db *m_obody; Db *m_t_rbody;
Db *m_class; Db *m_t_dbody;
Db *m_name; Db *m_t_class;
Db *m_info; Db *m_t_name;
Db *m_t_info;
wb_db_txn *m_txn; wb_db_txn *m_txn;
...@@ -52,12 +56,14 @@ public: ...@@ -52,12 +56,14 @@ public:
public: public:
wb_db(); wb_db();
wb_db(pwr_tVid vid);
//~wb_db(); //~wb_db();
pwr_tOid new_oid(wb_db_txn *txn); pwr_tOid new_oid(wb_db_txn *txn);
void close(); void close();
void open(char *name); void open(char *fileName);
void create(pwr_tVid vid, pwr_tCid cid, const char *volumeName, const char *fileName);
int del_family(wb_db_txn *txn, Dbc *cp, pwr_tOid poid); int del_family(wb_db_txn *txn, Dbc *cp, pwr_tOid poid);
...@@ -67,15 +73,15 @@ public: ...@@ -67,15 +73,15 @@ public:
bool abort(wb_db_txn *txn); bool abort(wb_db_txn *txn);
void adopt(wb_db_txn *txn, wb_db_ohead &o, wb_destination &dest); //void adopt(wb_db_txn *txn, wb_db_ohead &o, wb_destination &dest);
void unadopt(wb_db_txn *txn, wb_db_ohead &o); //void unadopt(wb_db_txn *txn, wb_db_ohead &o);
bool deleteFamily(pwr_tStatus *sts, wb_db_ohead *o); bool deleteFamily(pwr_tStatus *sts, wb_db_ohead *o);
//bool deleteOset(pwr_tStatus *sts, wb_oset *o); //bool deleteOset(pwr_tStatus *sts, wb_oset *o);
bool importVolume(wb_export *e); bool importVolume(wb_export &e);
bool importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid, bool importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid,
pwr_tOid loid, const char *name, const char *normname, pwr_tTime ohTime, pwr_tOid loid, const char *name, const char *normname, pwr_tTime ohTime,
...@@ -85,7 +91,7 @@ public: ...@@ -85,7 +91,7 @@ public:
bool importDbody(pwr_tOid oid, size_t size, void *body); bool importDbody(pwr_tOid oid, size_t size, void *body);
bool importMeta(const char *fileName); bool importMeta(dbs_sEnv *ep);
}; };
...@@ -110,7 +116,6 @@ public: ...@@ -110,7 +116,6 @@ public:
size_t rbSize, size_t dbSize); size_t rbSize, size_t dbSize);
wb_db_ohead &get(wb_db_txn *txn); wb_db_ohead &get(wb_db_txn *txn);
wb_db_ohead &get(pwr_tOid oid);
wb_db_ohead &get(wb_db_txn *txn, pwr_tOid oid); wb_db_ohead &get(wb_db_txn *txn, pwr_tOid oid);
void put(wb_db_txn *txn); void put(wb_db_txn *txn);
...@@ -124,7 +129,10 @@ public: ...@@ -124,7 +129,10 @@ public:
pwr_tOid boid() { return m_o.boid;} pwr_tOid boid() { return m_o.boid;}
pwr_tOid aoid() { return m_o.aoid;} pwr_tOid aoid() { return m_o.aoid;}
char *name(); char *name() { return m_o.name;}
char *normname() {return m_o.normname;}
void name(wb_name &name); void name(wb_name &name);
void poid(pwr_tOid oid) { m_o.poid = oid;} void poid(pwr_tOid oid) { m_o.poid = oid;}
...@@ -159,6 +167,7 @@ public: ...@@ -159,6 +167,7 @@ public:
wb_db_name(wb_db *db, wb_db_ohead &o); wb_db_name(wb_db *db, wb_db_ohead &o);
wb_db_name(wb_db *db, pwr_tOid, char *name); wb_db_name(wb_db *db, pwr_tOid, char *name);
wb_db_name(wb_db *db, pwr_tOid poid, const char *name); wb_db_name(wb_db *db, pwr_tOid poid, const char *name);
wb_db_name(wb_db *db, pwr_tOid oid, pwr_tOid poid, const char *name);
wb_db_name(wb_db *db, wb_db_txn *txn, pwr_tOid poid, wb_name name); wb_db_name(wb_db *db, wb_db_txn *txn, pwr_tOid poid, wb_name name);
void get(wb_db_txn *txn); void get(wb_db_txn *txn);
...@@ -182,6 +191,7 @@ public: ...@@ -182,6 +191,7 @@ public:
wb_db *m_db; wb_db *m_db;
Dbt m_key; Dbt m_key;
Dbt m_data;
Dbc *m_dbc; Dbc *m_dbc;
wb_db_class(wb_db *db, pwr_tCid cid); wb_db_class(wb_db *db, pwr_tCid cid);
...@@ -204,15 +214,57 @@ public: ...@@ -204,15 +214,57 @@ public:
class wb_db_body class wb_db_body
{ {
public: public:
wb_db *m_db;
pwr_tOid m_oid;
size_t m_size;
void *m_p;
Dbt m_key;
Dbt m_data;
wb_db_body(wb_db *db, pwr_tOid oid, size_t size, void *p); wb_db_body(wb_db *db, pwr_tOid oid, size_t size, void *p);
void put(wb_db_txn *txn); void put(wb_db_txn *txn);
}; };
class wb_db_txn : public DbTxn class wb_db_rbody
{
public:
wb_db *m_db;
pwr_tOid m_oid;
size_t m_size;
void *m_p;
Dbt m_key;
Dbt m_data;
wb_db_rbody(wb_db *db, pwr_tOid oid, size_t size, void *p);
void put(wb_db_txn *txn);
};
class wb_db_dbody
{ {
public:
wb_db *m_db;
pwr_tOid m_oid;
size_t m_size;
void *m_p;
Dbt m_key;
Dbt m_data;
wb_db_dbody(wb_db *db, pwr_tOid oid, size_t size, void *p);
void put(wb_db_txn *txn);
}; };
class wb_db_txn : public DbTxn
{
};
#endif #endif
...@@ -39,14 +39,14 @@ bool wb_vrepdb::abort(pwr_tStatus *sts) ...@@ -39,14 +39,14 @@ bool wb_vrepdb::abort(pwr_tStatus *sts)
wb_orep* wb_vrepdb::object(pwr_tStatus *sts) wb_orep* wb_vrepdb::object(pwr_tStatus *sts)
{ {
// m_ohead.get(m_txn, wb_oid(m_vid, 0)); // m_ohead.get(m_txn, wb_oid(m_vid, 0));
m_ohead.get(m_ohead.foid()); m_ohead.get(m_txn, m_ohead.foid());
return new (this) wb_orepdb(&m_ohead.m_o); return new (this) wb_orepdb(&m_ohead.m_o);
} }
wb_orep* wb_vrepdb::object(pwr_tStatus *sts, pwr_tOid oid) wb_orep* wb_vrepdb::object(pwr_tStatus *sts, pwr_tOid oid)
{ {
m_ohead.get(oid); m_ohead.get(m_txn, oid);
return new (this) wb_orepdb(&m_ohead.m_o); return new (this) wb_orepdb(&m_ohead.m_o);
} }
...@@ -54,7 +54,7 @@ wb_orep* wb_vrepdb::object(pwr_tStatus *sts, pwr_tOid oid) ...@@ -54,7 +54,7 @@ wb_orep* wb_vrepdb::object(pwr_tStatus *sts, pwr_tOid oid)
wb_orep* wb_vrepdb::object(pwr_tStatus *sts, wb_orep *parent, wb_name name) wb_orep* wb_vrepdb::object(pwr_tStatus *sts, wb_orep *parent, wb_name name)
{ {
wb_db_name n(m_db, m_txn, parent->oid(), name); wb_db_name n(m_db, m_txn, parent->oid(), name);
m_ohead.get(n.oid()); m_ohead.get(m_txn, n.oid());
return new (this) wb_orepdb(&m_ohead.m_o); return new (this) wb_orepdb(&m_ohead.m_o);
} }
...@@ -67,7 +67,7 @@ wb_orep* wb_vrepdb::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination ...@@ -67,7 +67,7 @@ wb_orep* wb_vrepdb::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination
o.put(txn); o.put(txn);
m_db->adopt(txn, o, d); adopt(txn, o, d);
/* /*
pwr_tOid oid; pwr_tOid oid;
...@@ -110,7 +110,7 @@ bool wb_vrepdb::deleteObject(pwr_tStatus *sts, wb_orep *orp) ...@@ -110,7 +110,7 @@ bool wb_vrepdb::deleteObject(pwr_tStatus *sts, wb_orep *orp)
wb_db_txn *txn = m_db->begin(0); wb_db_txn *txn = m_db->begin(0);
try { try {
m_db->unadopt(txn, o); unadopt(txn, o);
wb_db_class c(m_db, o); wb_db_class c(m_db, o);
c.del(txn); c.del(txn);
...@@ -241,77 +241,77 @@ wb_orep *wb_vrepdb::ancestor(pwr_tStatus *sts, wb_orep *o) ...@@ -241,77 +241,77 @@ wb_orep *wb_vrepdb::ancestor(pwr_tStatus *sts, wb_orep *o)
pwr_tCid wb_vrepdb::cid(pwr_tStatus *sts, const wb_orep * const orp) pwr_tCid wb_vrepdb::cid(pwr_tStatus *sts, const wb_orep * const orp)
{ {
return m_ohead.get(orp->oid()).cid(); return m_ohead.get(m_txn, orp->oid()).cid();
} }
pwr_tOid wb_vrepdb::poid(pwr_tStatus *sts, const wb_orep * const orp) pwr_tOid wb_vrepdb::poid(pwr_tStatus *sts, const wb_orep * const orp)
{ {
return m_ohead.get(orp->oid()).poid(); return m_ohead.get(m_txn, orp->oid()).poid();
} }
pwr_tOid wb_vrepdb::foid(pwr_tStatus *sts, const wb_orep * const orp) pwr_tOid wb_vrepdb::foid(pwr_tStatus *sts, const wb_orep * const orp)
{ {
return m_ohead.get(orp->oid()).foid(); return m_ohead.get(m_txn, orp->oid()).foid();
} }
pwr_tOid wb_vrepdb::loid(pwr_tStatus *sts, const wb_orep * const orp) pwr_tOid wb_vrepdb::loid(pwr_tStatus *sts, const wb_orep * const orp)
{ {
return m_ohead.get(orp->oid()).loid(); return m_ohead.get(m_txn, orp->oid()).loid();
} }
pwr_tOid wb_vrepdb::aoid(pwr_tStatus *sts, const wb_orep * const orp) pwr_tOid wb_vrepdb::aoid(pwr_tStatus *sts, const wb_orep * const orp)
{ {
return m_ohead.get(orp->oid()).aoid(); return m_ohead.get(m_txn, orp->oid()).aoid();
} }
pwr_tOid wb_vrepdb::boid(pwr_tStatus *sts, const wb_orep * const orp) pwr_tOid wb_vrepdb::boid(pwr_tStatus *sts, const wb_orep * const orp)
{ {
return m_ohead.get(orp->oid()).boid(); return m_ohead.get(m_txn, orp->oid()).boid();
} }
wb_orep *wb_vrepdb::parent(pwr_tStatus *sts, wb_orep *orp) wb_orep *wb_vrepdb::parent(pwr_tStatus *sts, wb_orep *orp)
{ {
m_ohead.get(m_ohead.get(orp->oid()).poid()); m_ohead.get(m_txn, m_ohead.get(m_txn, orp->oid()).poid());
return new (this) wb_orepdb(&m_ohead.m_o); return new (this) wb_orepdb(&m_ohead.m_o);
} }
wb_orep *wb_vrepdb::after(pwr_tStatus *sts, wb_orep *orp) wb_orep *wb_vrepdb::after(pwr_tStatus *sts, wb_orep *orp)
{ {
m_ohead.get(m_ohead.get(orp->oid()).aoid()); m_ohead.get(m_txn, m_ohead.get(m_txn, orp->oid()).aoid());
return new (this) wb_orepdb(&m_ohead.m_o); return new (this) wb_orepdb(&m_ohead.m_o);
} }
wb_orep *wb_vrepdb::before(pwr_tStatus *sts, wb_orep *orp) wb_orep *wb_vrepdb::before(pwr_tStatus *sts, wb_orep *orp)
{ {
m_ohead.get(m_ohead.get(orp->oid()).boid()); m_ohead.get(m_txn, m_ohead.get(m_txn, orp->oid()).boid());
return new (this) wb_orepdb(&m_ohead.m_o); return new (this) wb_orepdb(&m_ohead.m_o);
} }
wb_orep *wb_vrepdb::first(pwr_tStatus *sts, wb_orep *orp) wb_orep *wb_vrepdb::first(pwr_tStatus *sts, wb_orep *orp)
{ {
m_ohead.get(m_ohead.get(orp->oid()).foid()); m_ohead.get(m_txn, m_ohead.get(m_txn, orp->oid()).foid());
return new (this) wb_orepdb(&m_ohead.m_o); return new (this) wb_orepdb(&m_ohead.m_o);
} }
wb_orep *wb_vrepdb::child(pwr_tStatus *sts, wb_orep *orp, const char *name) wb_orep *wb_vrepdb::child(pwr_tStatus *sts, wb_orep *orp, const char *name)
{ {
wb_db_name n(m_db, orp->oid(), name); wb_db_name n(m_db, m_txn, orp->oid(), name);
m_ohead.get(n.oid()); m_ohead.get(m_txn, n.oid());
return new (this) wb_orepdb(&m_ohead.m_o); return new (this) wb_orepdb(&m_ohead.m_o);
} }
wb_orep *wb_vrepdb::last(pwr_tStatus *sts, wb_orep *orp) wb_orep *wb_vrepdb::last(pwr_tStatus *sts, wb_orep *orp)
{ {
m_ohead.get(m_ohead.get(orp->oid()).loid()); m_ohead.get(m_txn, m_ohead.get(m_txn, orp->oid()).loid());
return new (this) wb_orepdb(&m_ohead.m_o); return new (this) wb_orepdb(&m_ohead.m_o);
} }
wb_orep *wb_vrepdb::next(pwr_tStatus *sts, wb_orep *orp) wb_orep *wb_vrepdb::next(pwr_tStatus *sts, wb_orep *orp)
{ {
m_ohead.get(orp->oid()); m_ohead.get(m_txn, orp->oid());
wb_db_class c(m_db, m_ohead.cid()); wb_db_class c(m_db, m_ohead.cid());
if (c.succ(m_ohead.oid())) { if (c.succ(m_ohead.oid())) {
m_ohead.get(c.oid()); m_ohead.get(m_txn, c.oid());
return new (this) wb_orepdb(&m_ohead.m_o); return new (this) wb_orepdb(&m_ohead.m_o);
} else { } else {
//*sts = LDH__?; //*sts = LDH__?;
...@@ -321,10 +321,10 @@ wb_orep *wb_vrepdb::next(pwr_tStatus *sts, wb_orep *orp) ...@@ -321,10 +321,10 @@ wb_orep *wb_vrepdb::next(pwr_tStatus *sts, wb_orep *orp)
wb_orep *wb_vrepdb::previous(pwr_tStatus *sts, wb_orep *orp) wb_orep *wb_vrepdb::previous(pwr_tStatus *sts, wb_orep *orp)
{ {
m_ohead.get(orp->oid()); m_ohead.get(m_txn, orp->oid());
wb_db_class c(m_db, m_ohead.cid()); wb_db_class c(m_db, m_ohead.cid());
if (c.pred(m_ohead.oid())) { if (c.pred(m_ohead.oid())) {
m_ohead.get(c.oid()); m_ohead.get(m_txn, c.oid());
return new (this) wb_orepdb(&m_ohead.m_o); return new (this) wb_orepdb(&m_ohead.m_o);
} else { } else {
//*sts = LDH__?; //*sts = LDH__?;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment