Commit d1cb910c authored by lw's avatar lw

*** empty log message ***

parent 2b392528
...@@ -20,19 +20,27 @@ wb_db_info::wb_db_info(wb_db *db) : ...@@ -20,19 +20,27 @@ wb_db_info::wb_db_info(wb_db *db) :
void wb_db_info::get(wb_db_txn *txn) void wb_db_info::get(wb_db_txn *txn)
{ {
int index = 0; int index = 0;
int ret;
m_key.set_data(&index); m_key.set_data(&index);
m_key.set_size(sizeof(index)); m_key.set_size(sizeof(index));
m_data.set_ulen(sizeof(m_volume));
m_data.set_flags(DB_DBT_USERMEM);
m_db->m_t_info->get(txn, &m_key, &m_data, 0); ret = m_db->m_t_info->get(txn, &m_key, &m_data, 0);
printf("info get: %d\n", ret);
} }
void wb_db_info::put(wb_db_txn *txn) void wb_db_info::put(wb_db_txn *txn)
{ {
int index = 0; int index = 0;
int ret;
m_key.set_data(&index); m_key.set_data(&index);
m_key.set_size(sizeof(index)); m_key.set_size(sizeof(index));
m_db->m_t_info->put(txn, &m_key, &m_data, 0); ret = m_db->m_t_info->put(txn, &m_key, &m_data, 0);
printf("info put: %d\n", ret);
} }
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) :
...@@ -161,24 +169,29 @@ void wb_db_name::name(wb_name &name) ...@@ -161,24 +169,29 @@ void wb_db_name::name(wb_name &name)
} }
wb_db_ohead::wb_db_ohead() : wb_db_ohead::wb_db_ohead() :
m_db(0), m_key(&m_o.oid, sizeof(m_o.oid)), m_data(&m_o, sizeof(m_o)) m_db(0), m_key(&m_oid, sizeof(m_oid)), m_data(&m_o, sizeof(m_o))
{ {
memset(&m_o, 0, sizeof(m_o));
} }
wb_db_ohead::wb_db_ohead(wb_db *db) : wb_db_ohead::wb_db_ohead(wb_db *db) :
m_db(db), m_key(&m_o.oid, sizeof(m_o.oid)), m_data(&m_o, sizeof(m_o)) m_db(db), m_key(&m_oid, sizeof(m_oid)), m_data(&m_o, sizeof(m_o))
{ {
memset(&m_o, 0, sizeof(m_o));
} }
wb_db_ohead::wb_db_ohead(wb_db *db, pwr_tOid oid) : wb_db_ohead::wb_db_ohead(wb_db *db, pwr_tOid oid) :
m_db(db), m_key(&m_o.oid, sizeof(m_o.oid)), m_data(&m_o, sizeof(m_o)) m_db(db), m_key(&m_oid, sizeof(m_oid)), m_data(&m_o, sizeof(m_o))
{ {
m_o.oid = oid; memset(&m_o, 0, sizeof(m_o));
m_oid = oid;
} }
wb_db_ohead::wb_db_ohead(wb_db *db, wb_db_txn *txn, pwr_tOid oid) : wb_db_ohead::wb_db_ohead(wb_db *db, wb_db_txn *txn, pwr_tOid oid) :
m_db(db), m_key(&m_o.oid, sizeof(m_o.oid)), m_data(&m_o, sizeof(m_o)) m_db(db), m_key(&m_oid, sizeof(m_oid)), m_data(&m_o, sizeof(m_o))
{ {
m_o.oid = oid; memset(&m_o, 0, sizeof(m_o));
m_oid = oid;
get(txn); get(txn);
} }
...@@ -187,10 +200,11 @@ wb_db_ohead::wb_db_ohead(wb_db *db, pwr_tOid oid, pwr_tCid cid, ...@@ -187,10 +200,11 @@ wb_db_ohead::wb_db_ohead(wb_db *db, pwr_tOid oid, pwr_tCid cid,
const char *name, const char *normname, const char *name, const char *normname,
pwr_tTime ohTime, pwr_tTime rbTime, pwr_tTime dbTime, pwr_tTime ohTime, pwr_tTime rbTime, pwr_tTime dbTime,
size_t rbSize, size_t dbSize) : 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_db(db), m_key(&m_oid, sizeof(m_oid)), m_data(&m_o, sizeof(m_o))
{ {
m_o.oid = oid; memset(&m_o, 0, sizeof(m_o));
m_oid = m_o.oid = oid;
m_o.cid = cid; m_o.cid = cid;
m_o.poid = poid; m_o.poid = poid;
strcpy(m_o.name, name); strcpy(m_o.name, name);
...@@ -212,7 +226,10 @@ wb_db_ohead::wb_db_ohead(wb_db *db, pwr_tOid oid, pwr_tCid cid, ...@@ -212,7 +226,10 @@ wb_db_ohead::wb_db_ohead(wb_db *db, pwr_tOid oid, pwr_tCid cid,
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_t_ohead->get(txn, &m_key, &m_data, 0); m_data.set_ulen(sizeof(m_o));
m_data.set_flags(DB_DBT_USERMEM);
int ret = m_db->m_t_ohead->get(txn, &m_key, &m_data, 0);
return *this; return *this;
} }
...@@ -223,8 +240,11 @@ void wb_db_ohead::put(wb_db_txn *txn) ...@@ -223,8 +240,11 @@ void wb_db_ohead::put(wb_db_txn *txn)
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_oid = oid;
m_db->m_t_ohead->get(txn, &m_key, &m_data, 0); m_data.set_ulen(sizeof(m_o));
m_data.set_flags(DB_DBT_USERMEM);
int ret = m_db->m_t_ohead->get(txn, &m_key, &m_data, 0);
return *this; return *this;
} }
...@@ -524,6 +544,7 @@ bool wb_db::importVolume(wb_export &e) ...@@ -524,6 +544,7 @@ bool wb_db::importVolume(wb_export &e)
} }
} }
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,
pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid, pwr_tOid loid, pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid, pwr_tOid loid,
const char *name, const char *normname, const char *name, const char *normname,
...@@ -536,6 +557,14 @@ bool wb_db::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, ...@@ -536,6 +557,14 @@ bool wb_db::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
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);
if (oid.oix == pwr_cNOix) { // This is the volume object
wb_db_info i(this);
i.cid(cid);
i.vid(oid.vid);
i.name(name);
i.put(m_txn);
}
return true; return true;
} }
......
...@@ -54,6 +54,11 @@ public: ...@@ -54,6 +54,11 @@ public:
wb_db(pwr_tVid vid); wb_db(pwr_tVid vid);
//~wb_db(); //~wb_db();
pwr_tCid cid() { return m_cid;}
pwr_tVid vid() { return m_vid;}
//pwr_tTime time() { return m_volume.time;}
char *volumeName() { return m_volumeName;}
pwr_tOid new_oid(wb_db_txn *txn); pwr_tOid new_oid(wb_db_txn *txn);
void close(); void close();
...@@ -131,6 +136,7 @@ class wb_db_ohead ...@@ -131,6 +136,7 @@ class wb_db_ohead
{ {
public: public:
db_sObject m_o; db_sObject m_o;
pwr_tOid m_oid;
wb_db *m_db; wb_db *m_db;
Dbt m_key; Dbt m_key;
...@@ -149,6 +155,8 @@ public: ...@@ -149,6 +155,8 @@ public:
wb_db_ohead &get(wb_db_txn *txn); wb_db_ohead &get(wb_db_txn *txn);
wb_db_ohead &get(wb_db_txn *txn, pwr_tOid oid); wb_db_ohead &get(wb_db_txn *txn, pwr_tOid oid);
void setDb(wb_db *db) { m_db = db;}
void put(wb_db_txn *txn); void put(wb_db_txn *txn);
void del(wb_db_txn *txn); void del(wb_db_txn *txn);
...@@ -163,9 +171,9 @@ public: ...@@ -163,9 +171,9 @@ public:
pwr_tOid aoid() { return m_o.aoid;} pwr_tOid aoid() { return m_o.aoid;}
pwr_tTime ohTime() { return m_o.time;} pwr_tTime ohTime() { return m_o.time;}
char *name() { return m_o.name;} const char *name() { return m_o.name;}
char *normname() {return m_o.normname;} const char *normname() {return m_o.normname;}
size_t rbSize() { return m_o.body[0].size;} size_t rbSize() { return m_o.body[0].size;}
size_t dbSize() { return m_o.body[1].size;} size_t dbSize() { return m_o.body[1].size;}
......
...@@ -143,14 +143,11 @@ wb_dbs::checkObject(sOentry *oep) ...@@ -143,14 +143,11 @@ wb_dbs::checkObject(sOentry *oep)
switch (oep->o.cid) { switch (oep->o.cid) {
case pwr_eClass_LibHier: case pwr_eClass_LibHier:
if (m_volume.cid == pwr_eClass_ClassVolume) if (m_volume.cid != pwr_eClass_ClassVolume)
break;
oep->o.flags.b.devOnly = 1; oep->o.flags.b.devOnly = 1;
break; break;
case pwr_eClass_Alias: case pwr_eClass_Alias:
if (m_volume.cid == pwr_eClass_ClassVolume) if (m_volume.cid != pwr_eClass_ClassVolume)
break;
oep->o.flags.b.isAliasClient = 1; oep->o.flags.b.isAliasClient = 1;
break; break;
case pwr_eClass_MountVolume: case pwr_eClass_MountVolume:
......
...@@ -419,9 +419,9 @@ void wb_erep::loadMeta( pwr_tStatus *status) ...@@ -419,9 +419,9 @@ void wb_erep::loadMeta( pwr_tStatus *status)
strcat( vname, ".db"); strcat( vname, ".db");
dcli_translate_filename( vname, vname); dcli_translate_filename( vname, vname);
// wb_vrepdb *vrepdb = new wb_vrepdb( this, vname); wb_vrepdb *vrepdb = new wb_vrepdb( this, vname);
// vrepdb->name(vol_array[0]); vrepdb->name(vol_array[0]);
// addDbs( &sts, vrepdb); addDbs( &sts, vrepdb);
vol_cnt++; vol_cnt++;
} }
} }
......
...@@ -21,6 +21,22 @@ wb_orepdb::~wb_orepdb() ...@@ -21,6 +21,22 @@ wb_orepdb::~wb_orepdb()
{ {
} }
void *
wb_orepdb::operator new(size_t size, wb_vrepdb *v)
{
return (void *)v->new_wb_orepdb(size);
}
#if 1
void
wb_orepdb::operator delete(void *p)
{
wb_orepdb *o = (wb_orepdb *)p;
((wb_vrepdb *)o->m_vrep)->delete_wb_orepdb(p);
}
#endif
// //
// Operations declared in wb_orep // Operations declared in wb_orep
// //
...@@ -29,7 +45,13 @@ pwr_tOid wb_orepdb::oid() const ...@@ -29,7 +45,13 @@ pwr_tOid wb_orepdb::oid() const
{ {
pwr_tStatus sts; pwr_tStatus sts;
return m_vrep->oid(&sts, (wb_orep*)this); return m_oid;
}
pwr_tVid wb_orepdb::cid() const
{
pwr_tStatus sts;
return m_vrep->cid(&sts, (wb_orep*)this);
} }
pwr_tVid wb_orepdb::vid() const pwr_tVid wb_orepdb::vid() const
...@@ -74,6 +96,11 @@ pwr_tOid wb_orepdb::aoid() const ...@@ -74,6 +96,11 @@ pwr_tOid wb_orepdb::aoid() const
return m_vrep->aoid(&sts, (wb_orep*)this); return m_vrep->aoid(&sts, (wb_orep*)this);
} }
wb_name wb_orepdb::longName()
{
return wb_name();
}
const char * wb_orepdb::name() const const char * wb_orepdb::name() const
{ {
pwr_tStatus sts; pwr_tStatus sts;
......
...@@ -19,6 +19,9 @@ public: ...@@ -19,6 +19,9 @@ public:
wb_orepdb(db_sObject *o); wb_orepdb(db_sObject *o);
~wb_orepdb(); ~wb_orepdb();
void* operator new(size_t size, wb_vrepdb *v);
void operator delete(void *p);
virtual pwr_tOid oid() const; virtual pwr_tOid oid() const;
virtual pwr_tVid vid() const; virtual pwr_tVid vid() const;
virtual pwr_tOix oix() const; virtual pwr_tOix oix() const;
......
...@@ -110,8 +110,8 @@ public: ...@@ -110,8 +110,8 @@ public:
virtual bool isLocal(const wb_orep *o) = 0; virtual bool isLocal(const wb_orep *o) = 0;
pwr_tVid vid() const { return m_vid;} pwr_tVid vid() const { return m_vid;}
pwr_tCid cid() const { return m_cid;} pwr_tCid cid() const { return m_cid;}
pwr_tVid vid(pwr_tVid vid) { m_vid = vid;} void vid(pwr_tVid vid) { m_vid = vid;}
pwr_tCid cid(pwr_tCid cid) { m_cid = cid;} void cid(pwr_tCid cid) { m_cid = cid;}
virtual void name( const char *n) { strcpy( m_name, n);} virtual void name( const char *n) { strcpy( m_name, n);}
virtual const char *name() { return m_name;} virtual const char *name() { return m_name;}
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <errno.h> #include <errno.h>
#include "wb_vrepdb.h" #include "wb_vrepdb.h"
#include "wb_orepdb.h" #include "wb_orepdb.h"
#include "wb_erep.h"
#include "db_cxx.h" #include "db_cxx.h"
#include "wb_ldh.h" #include "wb_ldh.h"
...@@ -26,17 +27,80 @@ wb_vrepdb::wb_vrepdb(wb_erep *erep, const char *fileName) : ...@@ -26,17 +27,80 @@ wb_vrepdb::wb_vrepdb(wb_erep *erep, const char *fileName) :
m_db = new wb_db(); m_db = new wb_db();
m_db->open(fileName); m_db->open(fileName);
m_ohead.setDb(m_db);
strcpy(m_name, m_db->volumeName());
m_vid = m_db->vid();
m_cid = m_db->cid();
#if 0
m_isDbsenvLoaded = false;
if ( isCommonMeta())
m_merep = m_erep->merep(); m_merep = m_erep->merep();
else
m_merep = new wb_merep(m_erep, (wb_mvrep *)this);
#endif
} }
wb_erep *wb_vrepdb::erep()
{
return m_erep;
}
wb_vrep *wb_vrepdb::next()
{
return 0;
}
wb_merep *wb_vrepdb::merep() const
{
return m_merep;
}
wb_srep *wb_vrepdb::newSession()
{
return 0;
}
wb_name wb_vrepdb::longName(pwr_tStatus *sts, const wb_orep *o)
{
*sts = LDH__SUCCESS;
return wb_name();
}
bool wb_vrepdb::isOffspringOf(pwr_tStatus *sts, const wb_orep *child, const wb_orep *parent)
{
return false;
}
bool wb_vrepdb::isLocal(const wb_orep *o)
{
if (o)
return o->oid().vid == wb_vrep::vid();
return false;
}
bool wb_vrepdb::createSnapshot(const char *fileName)
{
return false;
}
void wb_vrepdb::objectName(const wb_orep *o, char *str)
{
if (str)
*str = '\0';
}
const char *wb_vrepdb::objectName(pwr_tStatus *sts, const wb_orep *o)
{
*sts = LDH__SUCCESS;
try {
m_ohead.get(m_txn, o->oid());
return m_ohead.name();
}
catch (DbException &e) {
*sts = LDH__NOSUCHOBJ;
printf("vrepdb: %s\n", e.what());
return 0;
}
}
void wb_vrepdb::load() void wb_vrepdb::load()
{ {
} }
...@@ -48,6 +112,7 @@ void wb_vrepdb::load() ...@@ -48,6 +112,7 @@ void wb_vrepdb::load()
bool wb_vrepdb::commit(pwr_tStatus *sts) bool wb_vrepdb::commit(pwr_tStatus *sts)
{ {
*sts = LDH__SUCCESS;
return m_db->commit(m_txn); return m_db->commit(m_txn);
} }
...@@ -57,11 +122,13 @@ bool wb_vrepdb::commit(pwr_tStatus *sts) ...@@ -57,11 +122,13 @@ bool wb_vrepdb::commit(pwr_tStatus *sts)
// //
bool wb_vrepdb::abort(pwr_tStatus *sts) bool wb_vrepdb::abort(pwr_tStatus *sts)
{ {
*sts = LDH__SUCCESS;
return m_db->abort(m_txn); return m_db->abort(m_txn);
} }
wb_orep* wb_vrepdb::object(pwr_tStatus *sts) wb_orep* wb_vrepdb::object(pwr_tStatus *sts)
{ {
*sts = LDH__SUCCESS;
try { try {
pwr_tOid oid; pwr_tOid oid;
...@@ -82,6 +149,7 @@ wb_orep* wb_vrepdb::object(pwr_tStatus *sts) ...@@ -82,6 +149,7 @@ wb_orep* wb_vrepdb::object(pwr_tStatus *sts)
wb_orep* wb_vrepdb::object(pwr_tStatus *sts, pwr_tOid oid) wb_orep* wb_vrepdb::object(pwr_tStatus *sts, pwr_tOid oid)
{ {
*sts = LDH__SUCCESS;
try { try {
m_ohead.get(m_txn, oid); m_ohead.get(m_txn, oid);
...@@ -94,8 +162,14 @@ wb_orep* wb_vrepdb::object(pwr_tStatus *sts, pwr_tOid oid) ...@@ -94,8 +162,14 @@ wb_orep* wb_vrepdb::object(pwr_tStatus *sts, pwr_tOid oid)
} }
} }
wb_orep* wb_vrepdb::object(pwr_tStatus *sts, wb_name &name)
{
return 0;
}
wb_orep* wb_vrepdb::object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name) wb_orep* wb_vrepdb::object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name)
{ {
*sts = LDH__SUCCESS;
try { try {
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(m_txn, n.oid()); m_ohead.get(m_txn, n.oid());
...@@ -108,8 +182,20 @@ wb_orep* wb_vrepdb::object(pwr_tStatus *sts, const wb_orep *parent, wb_name &nam ...@@ -108,8 +182,20 @@ wb_orep* wb_vrepdb::object(pwr_tStatus *sts, const wb_orep *parent, wb_name &nam
} }
} }
wb_orep *wb_vrepdb::copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destination &d, wb_name &name)
{
*sts = LDH__NYI;
return 0;
}
bool wb_vrepdb::copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination &d)
{
return false;
}
wb_orep* wb_vrepdb::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name) wb_orep* wb_vrepdb::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name)
{ {
*sts = LDH__NYI;
wb_db_txn *txn = m_db->begin(0); wb_db_txn *txn = m_db->begin(0);
try { try {
...@@ -155,6 +241,7 @@ wb_orep* wb_vrepdb::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination ...@@ -155,6 +241,7 @@ wb_orep* wb_vrepdb::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination
bool wb_vrepdb::deleteObject(pwr_tStatus *sts, wb_orep *orp) bool wb_vrepdb::deleteObject(pwr_tStatus *sts, wb_orep *orp)
{ {
*sts = LDH__NYI;
wb_db_ohead o(m_db, orp->oid()); wb_db_ohead o(m_db, orp->oid());
wb_db_txn *txn = m_db->begin(0); wb_db_txn *txn = m_db->begin(0);
...@@ -179,8 +266,21 @@ bool wb_vrepdb::deleteObject(pwr_tStatus *sts, wb_orep *orp) ...@@ -179,8 +266,21 @@ bool wb_vrepdb::deleteObject(pwr_tStatus *sts, wb_orep *orp)
return true; return true;
} }
bool wb_vrepdb::deleteFamily(pwr_tStatus *sts, wb_orep *orep)
{
*sts = LDH__NYI;
return false;
}
bool wb_vrepdb::deleteOset(pwr_tStatus *sts, wb_oset *oset)
{
*sts = LDH__NYI;
return false;
}
bool wb_vrepdb::moveObject(pwr_tStatus *sts, wb_orep *orp, wb_destination &d) bool wb_vrepdb::moveObject(pwr_tStatus *sts, wb_orep *orp, wb_destination &d)
{ {
*sts = LDH__NYI;
#if 0 #if 0
if (!isLocal(o)) if (!isLocal(o))
return ; return ;
...@@ -210,6 +310,7 @@ bool wb_vrepdb::moveObject(pwr_tStatus *sts, wb_orep *orp, wb_destination &d) ...@@ -210,6 +310,7 @@ bool wb_vrepdb::moveObject(pwr_tStatus *sts, wb_orep *orp, wb_destination &d)
bool wb_vrepdb::renameObject(pwr_tStatus *sts, wb_orep *orp, wb_name &name) bool wb_vrepdb::renameObject(pwr_tStatus *sts, wb_orep *orp, wb_name &name)
{ {
*sts = LDH__NYI;
wb_db_txn *txn = m_db->begin(0); wb_db_txn *txn = m_db->begin(0);
try { try {
...@@ -237,6 +338,7 @@ bool wb_vrepdb::renameObject(pwr_tStatus *sts, wb_orep *orp, wb_name &name) ...@@ -237,6 +338,7 @@ bool wb_vrepdb::renameObject(pwr_tStatus *sts, wb_orep *orp, wb_name &name)
bool wb_vrepdb::writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, size_t offset, size_t size, void *p) bool wb_vrepdb::writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, size_t offset, size_t size, void *p)
{ {
*sts = LDH__NYI;
//body.oid = ?; //body.oid = ?;
//body.bix = ?; //body.bix = ?;
//key.data = &body; //key.data = &body;
...@@ -319,16 +421,19 @@ void *wb_vrepdb::readBody(pwr_tStatus *sts, const wb_orep *orp, pwr_eBix bix, vo ...@@ -319,16 +421,19 @@ void *wb_vrepdb::readBody(pwr_tStatus *sts, const wb_orep *orp, pwr_eBix bix, vo
bool wb_vrepdb::writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p) bool wb_vrepdb::writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p)
{ {
*sts = LDH__NYI;
return true; return true;
} }
wb_orep *wb_vrepdb::ancestor(pwr_tStatus *sts, const wb_orep *o) wb_orep *wb_vrepdb::ancestor(pwr_tStatus *sts, const wb_orep *o)
{ {
*sts = LDH__NYI;
return 0; return 0;
} }
pwr_tCid wb_vrepdb::cid(pwr_tStatus *sts, const wb_orep *orp) pwr_tCid wb_vrepdb::cid(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
return m_ohead.get(m_txn, orp->oid()).cid(); return m_ohead.get(m_txn, orp->oid()).cid();
} }
...@@ -341,6 +446,7 @@ pwr_tCid wb_vrepdb::cid(pwr_tStatus *sts, const wb_orep *orp) ...@@ -341,6 +446,7 @@ pwr_tCid wb_vrepdb::cid(pwr_tStatus *sts, const wb_orep *orp)
pwr_tTime wb_vrepdb::ohTime(pwr_tStatus *sts, const wb_orep *orp) pwr_tTime wb_vrepdb::ohTime(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
return m_ohead.get(m_txn, orp->oid()).ohTime(); return m_ohead.get(m_txn, orp->oid()).ohTime();
} }
...@@ -355,6 +461,7 @@ pwr_tTime wb_vrepdb::ohTime(pwr_tStatus *sts, const wb_orep *orp) ...@@ -355,6 +461,7 @@ pwr_tTime wb_vrepdb::ohTime(pwr_tStatus *sts, const wb_orep *orp)
pwr_tVid wb_vrepdb::vid(pwr_tStatus *sts, const wb_orep *orp) pwr_tVid wb_vrepdb::vid(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
return m_ohead.get(m_txn, orp->oid()).vid(); return m_ohead.get(m_txn, orp->oid()).vid();
} }
...@@ -367,6 +474,7 @@ pwr_tVid wb_vrepdb::vid(pwr_tStatus *sts, const wb_orep *orp) ...@@ -367,6 +474,7 @@ pwr_tVid wb_vrepdb::vid(pwr_tStatus *sts, const wb_orep *orp)
pwr_tOid wb_vrepdb::oid(pwr_tStatus *sts, const wb_orep *orp) pwr_tOid wb_vrepdb::oid(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
return m_ohead.get(m_txn, orp->oid()).oid(); return m_ohead.get(m_txn, orp->oid()).oid();
} }
...@@ -379,6 +487,7 @@ pwr_tOid wb_vrepdb::oid(pwr_tStatus *sts, const wb_orep *orp) ...@@ -379,6 +487,7 @@ pwr_tOid wb_vrepdb::oid(pwr_tStatus *sts, const wb_orep *orp)
pwr_tOix wb_vrepdb::oix(pwr_tStatus *sts, const wb_orep *orp) pwr_tOix wb_vrepdb::oix(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
return m_ohead.get(m_txn, orp->oid()).oix(); return m_ohead.get(m_txn, orp->oid()).oix();
} }
...@@ -391,6 +500,7 @@ pwr_tOix wb_vrepdb::oix(pwr_tStatus *sts, const wb_orep *orp) ...@@ -391,6 +500,7 @@ pwr_tOix wb_vrepdb::oix(pwr_tStatus *sts, const wb_orep *orp)
pwr_tOid wb_vrepdb::poid(pwr_tStatus *sts, const wb_orep *orp) pwr_tOid wb_vrepdb::poid(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
return m_ohead.get(m_txn, orp->oid()).poid(); return m_ohead.get(m_txn, orp->oid()).poid();
} }
...@@ -403,6 +513,7 @@ pwr_tOid wb_vrepdb::poid(pwr_tStatus *sts, const wb_orep *orp) ...@@ -403,6 +513,7 @@ pwr_tOid wb_vrepdb::poid(pwr_tStatus *sts, const wb_orep *orp)
pwr_tOid wb_vrepdb::foid(pwr_tStatus *sts, const wb_orep *orp) pwr_tOid wb_vrepdb::foid(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
return m_ohead.get(m_txn, orp->oid()).foid(); return m_ohead.get(m_txn, orp->oid()).foid();
} }
...@@ -415,6 +526,7 @@ pwr_tOid wb_vrepdb::foid(pwr_tStatus *sts, const wb_orep *orp) ...@@ -415,6 +526,7 @@ pwr_tOid wb_vrepdb::foid(pwr_tStatus *sts, const wb_orep *orp)
pwr_tOid wb_vrepdb::loid(pwr_tStatus *sts, const wb_orep *orp) pwr_tOid wb_vrepdb::loid(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
return m_ohead.get(m_txn, orp->oid()).loid(); return m_ohead.get(m_txn, orp->oid()).loid();
} }
...@@ -427,6 +539,7 @@ pwr_tOid wb_vrepdb::loid(pwr_tStatus *sts, const wb_orep *orp) ...@@ -427,6 +539,7 @@ pwr_tOid wb_vrepdb::loid(pwr_tStatus *sts, const wb_orep *orp)
pwr_tOid wb_vrepdb::aoid(pwr_tStatus *sts, const wb_orep *orp) pwr_tOid wb_vrepdb::aoid(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
return m_ohead.get(m_txn, orp->oid()).aoid(); return m_ohead.get(m_txn, orp->oid()).aoid();
} }
...@@ -439,6 +552,7 @@ pwr_tOid wb_vrepdb::aoid(pwr_tStatus *sts, const wb_orep *orp) ...@@ -439,6 +552,7 @@ pwr_tOid wb_vrepdb::aoid(pwr_tStatus *sts, const wb_orep *orp)
pwr_tOid wb_vrepdb::boid(pwr_tStatus *sts, const wb_orep *orp) pwr_tOid wb_vrepdb::boid(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
return m_ohead.get(m_txn, orp->oid()).boid(); return m_ohead.get(m_txn, orp->oid()).boid();
} }
...@@ -451,6 +565,7 @@ pwr_tOid wb_vrepdb::boid(pwr_tStatus *sts, const wb_orep *orp) ...@@ -451,6 +565,7 @@ pwr_tOid wb_vrepdb::boid(pwr_tStatus *sts, const wb_orep *orp)
wb_orep *wb_vrepdb::parent(pwr_tStatus *sts, const wb_orep *orp) wb_orep *wb_vrepdb::parent(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
m_ohead.get(m_txn, m_ohead.get(m_txn, 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);
...@@ -464,6 +579,7 @@ wb_orep *wb_vrepdb::parent(pwr_tStatus *sts, const wb_orep *orp) ...@@ -464,6 +579,7 @@ wb_orep *wb_vrepdb::parent(pwr_tStatus *sts, const wb_orep *orp)
wb_orep *wb_vrepdb::after(pwr_tStatus *sts, const wb_orep *orp) wb_orep *wb_vrepdb::after(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
m_ohead.get(m_txn, m_ohead.get(m_txn, 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);
...@@ -477,6 +593,7 @@ wb_orep *wb_vrepdb::after(pwr_tStatus *sts, const wb_orep *orp) ...@@ -477,6 +593,7 @@ wb_orep *wb_vrepdb::after(pwr_tStatus *sts, const wb_orep *orp)
wb_orep *wb_vrepdb::before(pwr_tStatus *sts, const wb_orep *orp) wb_orep *wb_vrepdb::before(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
m_ohead.get(m_txn, m_ohead.get(m_txn, 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);
...@@ -490,6 +607,7 @@ wb_orep *wb_vrepdb::before(pwr_tStatus *sts, const wb_orep *orp) ...@@ -490,6 +607,7 @@ wb_orep *wb_vrepdb::before(pwr_tStatus *sts, const wb_orep *orp)
wb_orep *wb_vrepdb::first(pwr_tStatus *sts, const wb_orep *orp) wb_orep *wb_vrepdb::first(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
m_ohead.get(m_txn, m_ohead.get(m_txn, 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);
...@@ -503,6 +621,7 @@ wb_orep *wb_vrepdb::first(pwr_tStatus *sts, const wb_orep *orp) ...@@ -503,6 +621,7 @@ wb_orep *wb_vrepdb::first(pwr_tStatus *sts, const wb_orep *orp)
wb_orep *wb_vrepdb::child(pwr_tStatus *sts, const wb_orep *orp, wb_name &name) wb_orep *wb_vrepdb::child(pwr_tStatus *sts, const wb_orep *orp, wb_name &name)
{ {
*sts = LDH__SUCCESS;
try { try {
wb_db_name n(m_db, m_txn, orp->oid(), name); wb_db_name n(m_db, m_txn, orp->oid(), name);
m_ohead.get(m_txn, n.oid()); m_ohead.get(m_txn, n.oid());
...@@ -517,6 +636,7 @@ wb_orep *wb_vrepdb::child(pwr_tStatus *sts, const wb_orep *orp, wb_name &name) ...@@ -517,6 +636,7 @@ wb_orep *wb_vrepdb::child(pwr_tStatus *sts, const wb_orep *orp, wb_name &name)
wb_orep *wb_vrepdb::last(pwr_tStatus *sts, const wb_orep *orp) wb_orep *wb_vrepdb::last(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
m_ohead.get(m_txn, m_ohead.get(m_txn, 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);
...@@ -530,6 +650,7 @@ wb_orep *wb_vrepdb::last(pwr_tStatus *sts, const wb_orep *orp) ...@@ -530,6 +650,7 @@ wb_orep *wb_vrepdb::last(pwr_tStatus *sts, const wb_orep *orp)
wb_orep *wb_vrepdb::next(pwr_tStatus *sts, const wb_orep *orp) wb_orep *wb_vrepdb::next(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
m_ohead.get(m_txn, orp->oid()); m_ohead.get(m_txn, orp->oid());
wb_db_class c(m_db, m_txn, m_ohead.cid()); wb_db_class c(m_db, m_txn, m_ohead.cid());
...@@ -550,9 +671,10 @@ wb_orep *wb_vrepdb::next(pwr_tStatus *sts, const wb_orep *orp) ...@@ -550,9 +671,10 @@ wb_orep *wb_vrepdb::next(pwr_tStatus *sts, const wb_orep *orp)
wb_orep *wb_vrepdb::previous(pwr_tStatus *sts, const wb_orep *orp) wb_orep *wb_vrepdb::previous(pwr_tStatus *sts, const wb_orep *orp)
{ {
*sts = LDH__SUCCESS;
try { try {
m_ohead.get(m_txn, 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_txn, m_ohead.cid());
if (c.pred(m_ohead.oid())) { if (c.pred(m_ohead.oid())) {
m_ohead.get(m_txn, 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);
...@@ -615,7 +737,7 @@ void wb_vrepdb::adopt(wb_db_txn *txn, wb_db_ohead &o, wb_destination &dest) ...@@ -615,7 +737,7 @@ void wb_vrepdb::adopt(wb_db_txn *txn, wb_db_ohead &o, wb_destination &dest)
d.put(txn); d.put(txn);
wb_db_name n(m_db, o.poid(), o.name()); wb_db_name n(m_db, o.oid(), o.poid(), o.normname());
n.put(txn); n.put(txn);
} }
...@@ -645,7 +767,44 @@ void wb_vrepdb::unadopt(wb_db_txn *txn, wb_db_ohead &o) ...@@ -645,7 +767,44 @@ void wb_vrepdb::unadopt(wb_db_txn *txn, wb_db_ohead &o)
p.put(txn); p.put(txn);
wb_db_name n(m_db, o.poid(), o.name()); wb_db_name n(m_db, o.oid(), o.poid(), o.normname());
n.del(txn); n.del(txn);
} }
bool wb_vrepdb::exportVolume(wb_import &e)
{
return false;
}
bool wb_vrepdb::exportHead(wb_import &e)
{
return false;
}
bool wb_vrepdb::exportRbody(wb_import &e)
{
return false;
}
bool wb_vrepdb::exportDbody(wb_import &e)
{
return false;
}
bool wb_vrepdb::exportMeta(wb_import &e)
{
return false;
}
wb_orepdb *wb_vrepdb::new_wb_orepdb(size_t size)
{
wb_orepdb *o = (wb_orepdb *) calloc(1, size);
o->m_vrep = this;
return o;
}
void wb_vrepdb::delete_wb_orepdb(void *p)
{
free(p);
}
...@@ -13,6 +13,8 @@ protected: ...@@ -13,6 +13,8 @@ protected:
//wb_session m_wsession; //wb_session m_wsession;
wb_erep *m_erep; wb_erep *m_erep;
wb_merep *m_merep;
unsigned int m_nSession; unsigned int m_nSession;
unsigned int m_nRef; unsigned int m_nRef;
...@@ -125,6 +127,10 @@ public: ...@@ -125,6 +127,10 @@ public:
#endif #endif
void unadopt(wb_db_txn *txn, wb_db_ohead &o); void unadopt(wb_db_txn *txn, wb_db_ohead &o);
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);
wb_orepdb *new_wb_orepdb(size_t size);
void delete_wb_orepdb(void *p);
}; };
#endif #endif
...@@ -39,6 +39,7 @@ dbs_sEnv *wb_vrepdbs::dbsenv() ...@@ -39,6 +39,7 @@ dbs_sEnv *wb_vrepdbs::dbsenv()
m_isDbsenvLoaded = true; m_isDbsenvLoaded = true;
strcpy(m_name, m_dbsenv.vp->name); strcpy(m_name, m_dbsenv.vp->name);
m_vid = m_dbsenv.vp->vid; m_vid = m_dbsenv.vp->vid;
m_cid = m_dbsenv.vp->cid;
} else { } else {
ep = &m_dbsenv; ep = &m_dbsenv;
} }
......
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