Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
5b43165b
Commit
5b43165b
authored
Jun 05, 2006
by
Gregory P. Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* support DBEnv.log_stat() method on BerkeleyDB >= 4.0 [patch #1494885]
parent
034160d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
0 deletions
+78
-0
Lib/bsddb/dbobj.py
Lib/bsddb/dbobj.py
+3
-0
Lib/bsddb/test/test_basics.py
Lib/bsddb/test/test_basics.py
+7
-0
Modules/_bsddb.c
Modules/_bsddb.c
+68
-0
No files found.
Lib/bsddb/dbobj.py
View file @
5b43165b
...
...
@@ -91,6 +91,9 @@ class DBEnv:
return
apply
(
self
.
_cobj
.
lock_stat
,
args
,
kwargs
)
def
log_archive
(
self
,
*
args
,
**
kwargs
):
return
apply
(
self
.
_cobj
.
log_archive
,
args
,
kwargs
)
if
db
.
version
()
>=
(
4
,
0
):
def
log_stat
(
self
,
*
args
,
**
kwargs
):
return
apply
(
self
.
_cobj
.
log_stat
,
args
,
kwargs
)
def
set_get_returns_none
(
self
,
*
args
,
**
kwargs
):
return
apply
(
self
.
_cobj
.
set_get_returns_none
,
args
,
kwargs
)
...
...
Lib/bsddb/test/test_basics.py
View file @
5b43165b
...
...
@@ -659,6 +659,13 @@ class BasicTransactionTestCase(BasicTestCase):
except
db
.
DBIncompleteError
:
pass
if
db
.
version
()
>=
(
4
,
0
):
statDict
=
self
.
env
.
log_stat
(
0
);
assert
statDict
.
has_key
(
'magic'
)
assert
statDict
.
has_key
(
'version'
)
assert
statDict
.
has_key
(
'cur_file'
)
assert
statDict
.
has_key
(
'region_nowait'
)
# must have at least one log file present:
logs
=
self
.
env
.
log_archive
(
db
.
DB_ARCH_ABS
|
db
.
DB_ARCH_LOG
)
assert
logs
!=
None
...
...
Modules/_bsddb.c
View file @
5b43165b
...
...
@@ -4294,6 +4294,71 @@ DBEnv_lock_put(DBEnvObject* self, PyObject* args)
RETURN_NONE
();
}
#if (DBVER >= 40)
static
PyObject
*
DBEnv_log_stat
(
DBEnvObject
*
self
,
PyObject
*
args
)
{
int
err
;
DB_LOG_STAT
*
statp
=
NULL
;
PyObject
*
d
=
NULL
;
u_int32_t
flags
=
0
;
if
(
!
PyArg_ParseTuple
(
args
,
"|i:log_stat"
,
&
flags
))
return
NULL
;
CHECK_ENV_NOT_CLOSED
(
self
);
MYDB_BEGIN_ALLOW_THREADS
;
err
=
self
->
db_env
->
log_stat
(
self
->
db_env
,
&
statp
,
flags
);
MYDB_END_ALLOW_THREADS
;
RETURN_IF_ERR
();
/* Turn the stat structure into a dictionary */
d
=
PyDict_New
();
if
(
d
==
NULL
)
{
if
(
statp
)
free
(
statp
);
return
NULL
;
}
#define MAKE_ENTRY(name) _addIntToDict(d, #name, statp->st_##name)
MAKE_ENTRY
(
magic
);
MAKE_ENTRY
(
version
);
MAKE_ENTRY
(
mode
);
MAKE_ENTRY
(
lg_bsize
);
#if (DBVER >= 44)
MAKE_ENTRY
(
lg_size
);
MAKE_ENTRY
(
record
);
#endif
#if (DBVER <= 40)
MAKE_ENTRY
(
lg_max
);
#endif
MAKE_ENTRY
(
w_mbytes
);
MAKE_ENTRY
(
w_bytes
);
MAKE_ENTRY
(
wc_mbytes
);
MAKE_ENTRY
(
wc_bytes
);
MAKE_ENTRY
(
wcount
);
MAKE_ENTRY
(
wcount_fill
);
#if (DBVER >= 44)
MAKE_ENTRY
(
rcount
);
#endif
MAKE_ENTRY
(
scount
);
MAKE_ENTRY
(
cur_file
);
MAKE_ENTRY
(
cur_offset
);
MAKE_ENTRY
(
disk_file
);
MAKE_ENTRY
(
disk_offset
);
MAKE_ENTRY
(
maxcommitperflush
);
MAKE_ENTRY
(
mincommitperflush
);
MAKE_ENTRY
(
regsize
);
MAKE_ENTRY
(
region_wait
);
MAKE_ENTRY
(
region_nowait
);
#undef MAKE_ENTRY
free
(
statp
);
return
d
;
}
/* DBEnv_log_stat */
#endif
/* DBVER >= 4.0 for log_stat method */
static
PyObject
*
DBEnv_lock_stat
(
DBEnvObject
*
self
,
PyObject
*
args
)
...
...
@@ -4781,6 +4846,9 @@ static PyMethodDef DBEnv_methods[] = {
{
"lock_put"
,
(
PyCFunction
)
DBEnv_lock_put
,
METH_VARARGS
},
{
"lock_stat"
,
(
PyCFunction
)
DBEnv_lock_stat
,
METH_VARARGS
},
{
"log_archive"
,
(
PyCFunction
)
DBEnv_log_archive
,
METH_VARARGS
},
#if (DBVER >= 40)
{
"log_stat"
,
(
PyCFunction
)
DBEnv_log_stat
,
METH_VARARGS
},
#endif
{
"set_get_returns_none"
,(
PyCFunction
)
DBEnv_set_get_returns_none
,
METH_VARARGS
},
{
NULL
,
NULL
}
/* sentinel */
};
...
...
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