Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
nexedi
ZODB
Commits
5472857b
Commit
5472857b
authored
Feb 28, 2013
by
Marius Gedminas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ResourceWarning in fstail.py
parent
2d181876
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
16 deletions
+17
-16
src/ZODB/scripts/fstail.py
src/ZODB/scripts/fstail.py
+15
-15
src/ZODB/scripts/tests/fstail.txt
src/ZODB/scripts/tests/fstail.txt
+2
-1
No files found.
src/ZODB/scripts/fstail.py
100644 → 100755
View file @
5472857b
...
...
@@ -26,21 +26,21 @@ except ImportError:
from
sha
import
sha
as
sha1
def
main
(
path
,
ntxn
):
f
=
open
(
path
,
"rb"
)
f
.
seek
(
0
,
2
)
th
=
prev_txn
(
f
)
i
=
ntxn
while
th
and
i
>
0
:
hash
=
sha1
(
th
.
get_raw_data
()).
digest
()
l
=
len
(
str
(
th
.
get_timestamp
()))
+
1
th
.
read_meta
()
print
(
"%s: hash=%s"
%
(
th
.
get_timestamp
(),
binascii
.
hexlify
(
hash
).
decode
()))
print
((
"user=%r description=%r length=%d offset=%d"
%
(
th
.
user
,
th
.
descr
,
th
.
length
,
th
.
get_data_offset
())))
print
()
th
=
th
.
prev_txn
()
i
-=
1
with
open
(
path
,
"rb"
)
as
f
:
f
.
seek
(
0
,
2
)
th
=
prev_txn
(
f
)
i
=
ntxn
while
th
and
i
>
0
:
hash
=
sha1
(
th
.
get_raw_data
()).
digest
()
l
=
len
(
str
(
th
.
get_timestamp
()))
+
1
th
.
read_meta
()
print
(
"%s: hash=%s"
%
(
th
.
get_timestamp
(),
binascii
.
hexlify
(
hash
).
decode
()))
print
((
"user=%r description=%r length=%d offset=%d"
%
(
th
.
user
,
th
.
descr
,
th
.
length
,
th
.
get_data_offset
())))
print
()
th
=
th
.
prev_txn
()
i
-=
1
def
Main
():
ntxn
=
10
...
...
src/ZODB/scripts/tests/fstail.txt
View file @
5472857b
...
...
@@ -11,7 +11,7 @@ We have to prepare a FileStorage first:
>>> from ZODB.DB import DB
>>> import transaction
>>> from tempfile import mktemp
>>> storagefile = mktemp()
>>> storagefile = mktemp(
suffix='.fs'
)
>>> base_storage = FileStorage(storagefile)
>>> database = DB(base_storage)
>>> connection1 = database.open()
...
...
@@ -33,6 +33,7 @@ Now lets have a look at the last transactions of this FileStorage:
Now clean up the storage again:
>>> import os
>>> connection1.close()
>>> base_storage.close()
>>> os.unlink(storagefile)
>>> os.unlink(storagefile+'.index')
...
...
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