Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
d27bdbc4
Commit
d27bdbc4
authored
Feb 28, 2003
by
lw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
9add1965
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
144 additions
and
59 deletions
+144
-59
wb/lib/wb/src/wb_attribute.h
wb/lib/wb/src/wb_attribute.h
+2
-1
wb/lib/wb/src/wb_db.cpp
wb/lib/wb/src/wb_db.cpp
+76
-13
wb/lib/wb/src/wb_db.h
wb/lib/wb/src/wb_db.h
+7
-22
wb/lib/wb/src/wb_ldh.cpp
wb/lib/wb/src/wb_ldh.cpp
+10
-7
wb/lib/wb/src/wb_session.cpp
wb/lib/wb/src/wb_session.cpp
+16
-1
wb/lib/wb/src/wb_session.h
wb/lib/wb/src/wb_session.h
+2
-1
wb/lib/wb/src/wb_volume.cpp
wb/lib/wb/src/wb_volume.cpp
+1
-1
wb/lib/wb/src/wb_vrepdb.cpp
wb/lib/wb/src/wb_vrepdb.cpp
+30
-13
No files found.
wb/lib/wb/src/wb_attribute.h
View file @
d27bdbc4
...
...
@@ -52,7 +52,8 @@ public:
~
wb_attribute
();
wb_attribute
&
operator
=
(
const
wb_attribute
&
);
operator
bool
()
const
{
return
oddSts
();}
operator
wb_orep
*
()
const
;
operator
wb_orep
*
()
const
{
return
m_orep
;}
bool
operator
==
(
const
wb_attribute
&
)
const
;
//wb_object& operator=(const wb_orep&);
...
...
wb/lib/wb/src/wb_db.cpp
View file @
d27bdbc4
...
...
@@ -229,7 +229,7 @@ wb_db_ohead &wb_db_ohead::get(wb_db_txn *txn)
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
);
m_db
->
m_t_ohead
->
get
(
txn
,
&
m_key
,
&
m_data
,
0
);
return
*
this
;
}
...
...
@@ -244,7 +244,7 @@ wb_db_ohead &wb_db_ohead::get(wb_db_txn *txn, pwr_tOid oid)
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
);
m_db
->
m_t_ohead
->
get
(
txn
,
&
m_key
,
&
m_data
,
0
);
return
*
this
;
}
...
...
@@ -279,6 +279,16 @@ void wb_db_rbody::put(wb_db_txn *txn)
m_db
->
m_t_rbody
->
put
(
txn
,
&
m_key
,
&
m_data
,
0
);
}
void
wb_db_rbody
::
put
(
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_PARTIAL
);
m_db
->
m_t_rbody
->
get
(
txn
,
&
m_key
,
&
m_data
,
0
);
}
void
wb_db_rbody
::
get
(
wb_db_txn
*
txn
,
size_t
offset
,
size_t
size
,
void
*
p
)
{
...
...
@@ -306,15 +316,26 @@ void wb_db_dbody::put(wb_db_txn *txn)
m_db
->
m_t_dbody
->
put
(
txn
,
&
m_key
,
&
m_data
,
0
);
}
void
wb_db_dbody
::
put
(
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_PARTIAL
);
m_db
->
m_t_dbody
->
put
(
txn
,
&
m_key
,
&
m_data
,
0
);
}
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_data
.
set_flags
(
DB_DBT_USERMEM
|
DB_DBT_PARTIAL
);
m_db
->
m_t_dbody
->
get
(
txn
,
&
m_key
,
&
m_data
,
DB_DBT_PARTIAL
);
m_db
->
m_t_dbody
->
get
(
txn
,
&
m_key
,
&
m_data
,
0
);
}
...
...
@@ -372,6 +393,34 @@ void wb_db::open(const char *fileName)
strcpy
(
m_volumeName
,
i
.
name
());
}
static
void
printstat
(
DbEnv
*
ep
,
char
*
s
)
{
DB_LOCK_STAT
*
lp
;
ep
->
lock_stat
(
&
lp
,
0
);
printf
(
"DbEnv loc statistics, %s:
\n
"
,
s
);
printf
(
" lastid.......: %d
\n
"
,
lp
->
st_lastid
);
printf
(
" nmodes.......: %d
\n
"
,
lp
->
st_nmodes
);
printf
(
" maxlocks:....: %d
\n
"
,
lp
->
st_maxlocks
);
printf
(
" maxlockers...: %d
\n
"
,
lp
->
st_maxlockers
);
printf
(
" maxobjects...: %d
\n
"
,
lp
->
st_maxobjects
);
printf
(
" nlocks.......: %d
\n
"
,
lp
->
st_nlocks
);
printf
(
" maxnlocks....: %d
\n
"
,
lp
->
st_maxnlocks
);
printf
(
" nlockers.....: %d
\n
"
,
lp
->
st_nlockers
);
printf
(
" maxnlockers..: %d
\n
"
,
lp
->
st_maxnlockers
);
printf
(
" nobjects.....: %d
\n
"
,
lp
->
st_nobjects
);
printf
(
" maxnobjects..: %d
\n
"
,
lp
->
st_maxnobjects
);
printf
(
" nrequests....: %d
\n
"
,
lp
->
st_nrequests
);
printf
(
" nreleases....: %d
\n
"
,
lp
->
st_nreleases
);
printf
(
" nnowaits.....: %d
\n
"
,
lp
->
st_nnowaits
);
printf
(
" nconflicts...: %d
\n
"
,
lp
->
st_nconflicts
);
printf
(
" ndeadlocks...: %d
\n
"
,
lp
->
st_ndeadlocks
);
printf
(
" regsize......: %d
\n
"
,
lp
->
st_regsize
);
printf
(
" region_wait..: %d
\n
"
,
lp
->
st_region_wait
);
printf
(
" region_nowait: %d
\n
"
,
lp
->
st_region_nowait
);
printf
(
"
\n
"
);
}
void
wb_db
::
openDb
()
{
struct
stat
sb
;
...
...
@@ -388,7 +437,9 @@ 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);
m_env
->
set_lk_max_locks
(
200000
);
m_env
->
set_lk_max_objects
(
20000
);
#if 1
m_env
->
open
(
m_fileName
,
DB_CREATE
|
DB_INIT_LOCK
|
DB_INIT_LOG
|
DB_INIT_MPOOL
|
DB_INIT_TXN
|
DB_RECOVER
,
...
...
@@ -398,6 +449,8 @@ void wb_db::openDb()
DB_CREATE
|
DB_INIT_MPOOL
,
S_IRUSR
|
S_IWUSR
);
#endif
printstat
(
m_env
,
"after open env"
);
m_t_ohead
=
new
Db
(
m_env
,
0
);
m_t_rbody
=
new
Db
(
m_env
,
0
);
m_t_dbody
=
new
Db
(
m_env
,
0
);
...
...
@@ -411,6 +464,7 @@ void wb_db::openDb()
m_t_class
->
open
(
"class"
,
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
);
printstat
(
m_env
,
"after open databases"
);
}
...
...
@@ -536,21 +590,30 @@ 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_txn
=
0
;
m_env
->
txn_begin
(
0
,
(
DbTxn
**
)
&
m_txn
,
0
);
//
m_txn = 0;
printstat
(
m_env
,
"importVolume"
);
e
.
exportHead
(
*
this
);
printstat
(
m_env
,
"after head"
);
e
.
exportRbody
(
*
this
);
printstat
(
m_env
,
"after rbody"
);
e
.
exportDbody
(
*
this
);
printstat
(
m_env
,
"after dbody"
);
e
.
exportMeta
(
*
this
);
printstat
(
m_env
,
"after meta"
);
//m_txn->commit(0);
//m_env->txn_checkpoint(0, 0, 0);
m_txn
->
commit
(
0
);
printstat
(
m_env
,
"after commit"
);
m_env
->
txn_checkpoint
(
0
,
0
,
0
);
printstat
(
m_env
,
"after checkpoint"
);
return
true
;
}
catch
(
DbException
&
e
)
{
//m_txn->abort();
printstat
(
m_env
,
"after exception"
);
m_txn
->
abort
();
printf
(
"exeption: %s
\n
"
,
e
.
what
());
printstat
(
m_env
,
"after abort"
);
return
false
;
}
}
...
...
@@ -564,7 +627,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
);
//
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
);
...
...
@@ -584,7 +647,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
);
//
printf("rbody size: %d.%d %d\n", oid.vid, oid.oix, size);
rb
.
put
(
m_txn
);
return
true
;
}
...
...
@@ -592,7 +655,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
);
//
printf("dbody size: %d.%d %d\n", oid.vid, oid.oix, size);
db
.
put
(
m_txn
);
return
true
;
}
...
...
wb/lib/wb/src/wb_db.h
View file @
d27bdbc4
...
...
@@ -258,7 +258,7 @@ public:
}
;
class
wb_db_body
class
wb_db_
d
body
{
public:
wb_db
*
m_db
;
...
...
@@ -270,9 +270,12 @@ public:
Dbt
m_key
;
Dbt
m_data
;
wb_db_body
(
wb_db
*
db
,
pwr_tOid
oid
,
size_t
size
,
void
*
p
);
wb_db_dbody
(
wb_db
*
db
,
pwr_tOid
oid
);
wb_db_dbody
(
wb_db
*
db
,
pwr_tOid
oid
,
size_t
size
,
void
*
p
);
void
get
(
wb_db_txn
*
txn
,
size_t
offset
,
size_t
size
,
void
*
p
);
void
put
(
wb_db_txn
*
txn
);
void
put
(
wb_db_txn
*
txn
,
size_t
offset
,
size_t
size
,
void
*
p
);
};
class
wb_db_rbody
...
...
@@ -290,27 +293,9 @@ public:
wb_db_rbody
(
wb_db
*
db
,
pwr_tOid
oid
);
wb_db_rbody
(
wb_db
*
db
,
pwr_tOid
oid
,
size_t
size
,
void
*
p
);
void
put
(
wb_db_txn
*
txn
);
void
get
(
wb_db_txn
*
txn
,
size_t
offset
,
size_t
size
,
void
*
p
);
};
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
);
wb_db_dbody
(
wb_db
*
db
,
pwr_tOid
oid
,
size_t
size
,
void
*
p
);
void
put
(
wb_db_txn
*
txn
);
void
ge
t
(
wb_db_txn
*
txn
,
size_t
offset
,
size_t
size
,
void
*
p
);
void
pu
t
(
wb_db_txn
*
txn
,
size_t
offset
,
size_t
size
,
void
*
p
);
};
class
wb_db_txn
:
public
DbTxn
...
...
wb/lib/wb/src/wb_ldh.cpp
View file @
d27bdbc4
...
...
@@ -1228,7 +1228,7 @@ ldh_SetObjectBuffer(ldh_tSession session, pwr_tOid oid, char *bname, char *aname
wb_attribute
a
=
o
.
attribute
(
bname
,
aname
);
if
(
!
a
)
return
a
.
sts
();
sp
->
writeAttribute
(
/*a, value*/
);
sp
->
writeAttribute
(
a
,
value
);
return
sp
->
sts
();
}
...
...
@@ -1240,14 +1240,13 @@ pwr_tStatus
ldh_SetObjectName
(
ldh_tSession
session
,
pwr_tOid
oid
,
char
*
name
)
{
wb_session
*
sp
=
(
wb_session
*
)
session
;
wb_object
o
=
sp
->
object
(
oid
);
if
(
!
o
)
return
o
.
sts
();
wb_name
n
(
name
);
pwr_tStatus
sts
=
sp
->
renameObject
(
o
,
n
);
sp
->
renameObject
(
o
,
n
);
return
s
ts
;
return
s
p
->
sts
()
;
}
pwr_tStatus
...
...
@@ -1258,18 +1257,22 @@ ldh_SetObjectPar(ldh_tSession session, pwr_tOid oid, char *bname,
wb_object
o
=
sp
->
object
(
oid
);
if
(
!
o
)
return
o
.
sts
();
wb_attribute
a
=
o
.
attribute
(
bname
,
aname
);
if
(
!
a
)
return
a
.
sts
();
return
sp
->
writeAttribute
(
/*a, value, size*/
);
sp
->
writeAttribute
(
a
,
value
,
size
);
return
sp
->
sts
();
}
pwr_tStatus
ldh_SetSession
(
ldh_tSession
session
,
ldh_eAccess
access
)
{
wb_session
*
sp
=
(
wb_session
*
)
session
;
sp
->
access
(
access
);
return
sp
->
access
(
access
);
return
sp
->
sts
(
);
}
pwr_tStatus
...
...
wb/lib/wb/src/wb_session.cpp
View file @
d27bdbc4
...
...
@@ -123,6 +123,22 @@ bool wb_session::deleteFamily(wb_object o)
return
m_vrep
->
deleteFamily
(
&
m_sts
,
(
wb_orep
*
)
o
);
}
bool
wb_session
::
writeAttribute
(
wb_attribute
&
a
,
void
*
p
,
size_t
size
)
{
if
(
isReadonly
())
throw
wb_error_str
(
"ReadOnlySession"
);
return
m_vrep
->
writeAttribute
(
&
m_sts
,
(
wb_orep
*
)
a
,
a
.
bix
(),
a
.
offset
(),
a
.
size
(),
p
);
}
bool
wb_session
::
writeAttribute
(
wb_attribute
&
a
,
void
*
p
)
{
if
(
isReadonly
())
throw
wb_error_str
(
"ReadOnlySession"
);
return
m_vrep
->
writeAttribute
(
&
m_sts
,
(
wb_orep
*
)
a
,
a
.
bix
(),
a
.
offset
(),
a
.
size
(),
p
);
}
pwr_tStatus
wb_session
::
getMenu
(
ldh_sMenuCall
*
ip
)
{
pwr_tStatus
sts
;
...
...
@@ -355,7 +371,6 @@ void wb_session::getAllMenuItems( ldh_sMenuCall *ip, ldh_sMenuItem **Item, wb_cd
}
}
pwr_tStatus
wb_session
::
callMenuMethod
(
ldh_sMenuCall
*
mcp
,
int
Index
)
{
pwr_tStatus
sts
=
LDH__SUCCESS
;
...
...
wb/lib/wb/src/wb_session.h
View file @
d27bdbc4
...
...
@@ -68,7 +68,8 @@ public:
bool
deleteObject
(
wb_object
o
);
bool
deleteFamily
(
wb_object
o
);
bool
writeAttribute
()
{
return
false
;}
// Fix
bool
writeAttribute
(
wb_attribute
&
a
,
void
*
p
,
size_t
size
);
bool
writeAttribute
(
wb_attribute
&
a
,
void
*
p
);
bool
writeBody
()
{
return
false
;}
// Fix
void
getAllMenuItems
(
ldh_sMenuCall
*
ip
,
ldh_sMenuItem
**
Item
,
wb_cdrep
*
cdrep
,
...
...
wb/lib/wb/src/wb_volume.cpp
View file @
d27bdbc4
...
...
@@ -272,7 +272,7 @@ wb_attribute wb_volume::attribute(const pwr_sAttrRef* arp) const
// We have found a matching attribute
if
(
ODD
(
sts
))
{
if
(
ODD
(
sts
))
{
if
(
arp
->
Size
==
0
||
arp
->
Size
>
(
adrep
->
size
()
/
adrep
->
nElement
()))
{
// Map whole atribute
idx
=
(
adrep
->
nElement
()
>
1
)
?
-
1
:
0
;
...
...
wb/lib/wb/src/wb_vrepdb.cpp
View file @
d27bdbc4
...
...
@@ -364,21 +364,38 @@ 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
rp
,
pwr_eBix
bix
,
size_t
offset
,
size_t
size
,
void
*
p
)
{
*
sts
=
LDH__NYI
;
//body.oid = ?;
//body.bix = ?;
//key.data = &body;
//key.len = sizeof(body);
try
{
m_ohead
.
get
(
m_txn
,
orp
->
oid
());
*
sts
=
LDH__SUCCESS
;
switch
(
bix
)
{
case
pwr_eBix_rt
:
{
//data.data = ?;
//data.offset = ?;
//data.size = ?;
wb_db_rbody
rb
(
m_db
,
m_ohead
.
oid
());
rb
.
put
(
m_txn
,
offset
,
size
,
p
);
break
;
}
case
pwr_eBix_dev
:
{
//update(body-tab)
wb_db_dbody
db
(
m_db
,
m_ohead
.
oid
());
db
.
put
(
m_txn
,
offset
,
size
,
p
);
break
;
}
default:
break
;
}
return
true
;
return
true
;
}
catch
(
DbException
&
e
)
{
*
sts
=
LDH__NOSUCHOBJ
;
printf
(
"vrepdb: %s
\n
"
,
e
.
what
());
return
false
;
}
}
void
*
wb_vrepdb
::
readAttribute
(
pwr_tStatus
*
sts
,
const
wb_orep
*
orp
,
pwr_eBix
bix
,
size_t
offset
,
size_t
size
,
void
*
p
)
...
...
@@ -398,7 +415,7 @@ void *wb_vrepdb::readAttribute(pwr_tStatus *sts, const wb_orep *orp, pwr_eBix bi
case
pwr_eBix_dev
:
{
wb_db_
r
body
db
(
m_db
,
m_ohead
.
oid
());
wb_db_
d
body
db
(
m_db
,
m_ohead
.
oid
());
db
.
get
(
m_txn
,
offset
,
size
,
p
);
break
;
}
...
...
@@ -430,7 +447,7 @@ void *wb_vrepdb::readBody(pwr_tStatus *sts, const wb_orep *orp, pwr_eBix bix, vo
}
case
pwr_eBix_dev
:
{
wb_db_
r
body
db
(
m_db
,
m_ohead
.
oid
());
wb_db_
d
body
db
(
m_db
,
m_ohead
.
oid
());
db
.
get
(
m_txn
,
0
,
m_ohead
.
dbSize
(),
p
);
break
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment