Commit e642a710 authored by lw's avatar lw

*** empty log message ***

parent b3a3df9a
......@@ -3,9 +3,9 @@ link_rule_mk := 1
link = $(ldxx) $(linkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(wb_msg_objs) $(rt_msg_objs) \
$(pwr_obj)/rt_io_user.o -L/usr/X11R6/lib\
$(pwr_obj)/rt_io_user.o -L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib\
-lpwr_wb -lpwr_ge -lpwr_rt -lpwr_co -lpwr_flow -lpwr_glow\
-lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
-lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp -ldb_cxx-4.0\
-lSM -lICE\
-lrpcsvc -lpthread -lm -lposix1b -lrt
......
......@@ -285,8 +285,10 @@ void wb_db_rbody::get(wb_db_txn *txn, size_t offset, size_t size, void *p)
m_data.set_doff(offset);
m_data.set_dlen(size);
m_data.set_data(p);
m_data.set_ulen(size);
m_data.set_flags(DB_DBT_USERMEM|DB_DBT_PARTIAL);
m_db->m_t_rbody->get(txn, &m_key, &m_data, DB_DBT_PARTIAL);
m_db->m_t_rbody->get(txn, &m_key, &m_data, 0);
}
wb_db_dbody::wb_db_dbody(wb_db *db, pwr_tOid oid, size_t size, void *p) :
......@@ -309,6 +311,8 @@ void wb_db_dbody::get(wb_db_txn *txn, size_t offset, size_t size, void *p)
m_data.set_doff(offset);
m_data.set_dlen(size);
m_data.set_data(p);
m_data.set_ulen(size);
m_data.set_flags(DB_DBT_USERMEM);
m_db->m_t_dbody->get(txn, &m_key, &m_data, DB_DBT_PARTIAL);
}
......@@ -383,11 +387,17 @@ void wb_db::openDb()
m_env = new DbEnv(0/*DB_CXX_NO_EXCEPTIONS*/);
m_env->set_errpfx("PWR db");
//m_env->set_cachesize(0, 256 * 1024 * 1024, 0);
#if 1
m_env->open(m_fileName,
DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_RECOVER,
S_IRUSR | S_IWUSR);
#else
m_env->open(m_fileName,
DB_CREATE | DB_INIT_MPOOL,
S_IRUSR | S_IWUSR);
#endif
m_t_ohead = new Db(m_env, 0);
m_t_rbody = new Db(m_env, 0);
m_t_dbody = new Db(m_env, 0);
......@@ -526,19 +536,20 @@ bool wb_db::deleteOset(pwr_tStatus *sts, wb_oset *o)
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);
m_txn = 0;
e.exportHead(*this);
e.exportRbody(*this);
e.exportDbody(*this);
e.exportMeta(*this);
m_txn->commit(0);
m_env->txn_checkpoint(0, 0, 0);
//m_txn->commit(0);
//m_env->txn_checkpoint(0, 0, 0);
return true;
}
catch (DbException &e) {
m_txn->abort();
//m_txn->abort();
printf("exeption: %s\n", e.what());
return false;
}
......@@ -553,6 +564,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);
o.put(m_txn);
printf("head put: %d.%d %s\n", oid.vid, oid.oix, name);
wb_db_name n(this, oid, poid, normname);
n.put(m_txn);
wb_db_class c(this, cid, oid);
......@@ -572,6 +584,7 @@ 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)
{
wb_db_rbody rb(this, oid, size, body);
printf("rbody size: %d.%d %d\n", oid.vid, oid.oix, size);
rb.put(m_txn);
return true;
}
......@@ -579,6 +592,7 @@ bool wb_db::importRbody(pwr_tOid oid, size_t size, void *body)
bool wb_db::importDbody(pwr_tOid oid, size_t size, void *body)
{
wb_db_dbody db(this, oid, size, body);
printf("dbody size: %d.%d %d\n", oid.vid, oid.oix, size);
db.put(m_txn);
return true;
}
......
......@@ -196,10 +196,11 @@ wb_dbs::checkObject(sOentry *oep)
oep->o.name_bt.rsize = dbs_dAlign(sizeof(dbs_sName));
}
bool
wb_dbs::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid aoid, pwr_tOid boid, pwr_tOid foid,
pwr_tOid loid, const char *name, const char *normname, pwr_tTime time,
pwr_tTime rbTime, pwr_tTime dbTime, size_t rbSize, size_t dbSize)
bool wb_dbs::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 time, pwr_tTime rbTime, pwr_tTime dbTime,
size_t rbSize, size_t dbSize)
{
sNentry *nep;
sOentry *oep;
......
......@@ -98,7 +98,9 @@ pwr_tOid wb_orepdb::aoid() const
wb_name wb_orepdb::longName()
{
return wb_name();
pwr_tStatus sts;
return m_vrep->longName(&sts, (wb_orep*)this);
}
const char * wb_orepdb::name() const
......
......@@ -55,10 +55,38 @@ wb_srep *wb_vrepdb::newSession()
return 0;
}
void wb_vrepdb::objectName(pwr_tOid oid, char *name, int level)
{
if (cdh_ObjidIsNull(oid))
return;
wb_db_ohead o(m_db, m_txn, oid);
if (o.oix() == pwr_cNOix) {
strcpy(name, o.name());
strcat(name, ":");
} else {
objectName(o.poid(), name, level+1);
strcat(name, o.name());
if (level > 0)
strcat(name, "-");
}
}
wb_name wb_vrepdb::longName(pwr_tStatus *sts, const wb_orep *o)
{
*sts = LDH__SUCCESS;
return wb_name();
char name[512];
try {
objectName(o->oid(), name, 0);
}
catch (DbException &e) {
*sts = LDH__NOSUCHOBJ;
printf("vrepdb: %s\n", e.what());
name[0] = '\0';
}
return wb_name(name);
}
bool wb_vrepdb::isOffspringOf(pwr_tStatus *sts, const wb_orep *child, const wb_orep *parent)
......@@ -581,7 +609,13 @@ wb_orep *wb_vrepdb::after(pwr_tStatus *sts, const wb_orep *orp)
{
*sts = LDH__SUCCESS;
try {
m_ohead.get(m_txn, m_ohead.get(m_txn, orp->oid()).aoid());
pwr_tOid aoid = m_ohead.get(m_txn, orp->oid()).aoid();
if (cdh_ObjidIsNull(aoid)) {
*sts = LDH__NO_SIBLING;
return 0;
}
m_ohead.get(m_txn, aoid);
return new (this) wb_orepdb(&m_ohead.m_o);
}
catch (DbException &e) {
......@@ -595,7 +629,13 @@ wb_orep *wb_vrepdb::before(pwr_tStatus *sts, const wb_orep *orp)
{
*sts = LDH__SUCCESS;
try {
m_ohead.get(m_txn, m_ohead.get(m_txn, orp->oid()).boid());
pwr_tOid boid = m_ohead.get(m_txn, orp->oid()).boid();
if (cdh_ObjidIsNull(boid)) {
*sts = LDH__NO_SIBLING;
return 0;
}
m_ohead.get(m_txn, boid);
return new (this) wb_orepdb(&m_ohead.m_o);
}
catch (DbException &e) {
......@@ -609,7 +649,13 @@ wb_orep *wb_vrepdb::first(pwr_tStatus *sts, const wb_orep *orp)
{
*sts = LDH__SUCCESS;
try {
m_ohead.get(m_txn, m_ohead.get(m_txn, orp->oid()).foid());
pwr_tOid foid = m_ohead.get(m_txn, orp->oid()).foid();
if (cdh_ObjidIsNull(foid)) {
*sts = LDH__NO_CHILD;
return 0;
}
m_ohead.get(m_txn, foid);
return new (this) wb_orepdb(&m_ohead.m_o);
}
catch (DbException &e) {
......@@ -638,7 +684,13 @@ wb_orep *wb_vrepdb::last(pwr_tStatus *sts, const wb_orep *orp)
{
*sts = LDH__SUCCESS;
try {
m_ohead.get(m_txn, m_ohead.get(m_txn, orp->oid()).loid());
pwr_tOid loid = m_ohead.get(m_txn, orp->oid()).loid();
if (cdh_ObjidIsNull(loid)) {
*sts = LDH__NO_CHILD;
return 0;
}
m_ohead.get(m_txn, loid);
return new (this) wb_orepdb(&m_ohead.m_o);
}
catch (DbException &e) {
......
......@@ -110,6 +110,8 @@ public:
virtual void objectName(const wb_orep *o, char *str);
void objectName(pwr_tOid oid, char *name, int level);
void load();
virtual bool exportVolume(wb_import &e);
......
......@@ -446,7 +446,7 @@ bool wb_vrepdbs::exportHead(wb_import &i)
pwr_tStatus sts;
while ((op = dbs_NextHead(&sts, dbsenv(), op))) {
i.importHead(op->oid, op->cid, op->poid, op->aoid, op->boid, op->foid, op->loid, op->name, op->normname,
i.importHead(op->oid, op->cid, op->poid, op->boid, op->aoid, op->foid, op->loid, op->name, op->normname,
op->time, op->rbody.time, op->dbody.time, op->rbody.size, op->dbody.size);
}
......
#include <iostream>
#include <fstream>
#include <sys/stat.h>
......
......@@ -1462,7 +1462,7 @@ bool wb_wblnode::exportHead(wb_import &i)
pwr_tOid lchoid = o_lch ? o_lch->m_oid : pwr_cNOid;
wb_name n = wb_name(name());
i.importHead( m_oid, m_cid, fthoid, fwsoid, bwsoid, fchoid, lchoid, name(), n.normName(cdh_mName_object),
i.importHead( m_oid, m_cid, fthoid, bwsoid, fwsoid, fchoid, lchoid, name(), n.normName(cdh_mName_object),
getFileTime(), getFileTime(), getFileTime(), rbody_size, dbody_size);
if ( o_fch)
......
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