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
12f7995a
Commit
12f7995a
authored
Feb 28, 2013
by
Marius Gedminas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a bunch of ResourceWarnings in iterator.test
parent
5472857b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
1 deletion
+32
-1
src/ZODB/FileStorage/iterator.test
src/ZODB/FileStorage/iterator.test
+32
-1
No files found.
src/ZODB/FileStorage/iterator.test
View file @
12f7995a
...
...
@@ -37,6 +37,8 @@ By default, we start at the beginning:
>>>
it
.
next
()
.
tid
==
tids
[
0
]
True
>>>
it
.
close
()
The
file
iterator
has
an
optimization
to
deal
with
large
files
.
It
can
serarch
from
either
the
front
or
the
back
of
the
file
,
depending
on
the
starting
transaction
given
.
To
see
this
,
we
'll turn on debug
...
...
@@ -55,30 +57,42 @@ seems best and set the next record to that:
>>>
it
.
next
()
.
tid
==
tids
[
0
]
True
>>>
it
.
close
()
>>>
it
=
ZODB
.
FileStorage
.
FileIterator
(
'data.fs'
,
tids
[
1
])
Scan
forward
data
.
fs
:
4
looking
for
'\x03z\xbd\xd8\xd06\x9c\xcc'
>>>
it
.
next
()
.
tid
==
tids
[
1
]
True
>>>
it
.
close
()
>>>
it
=
ZODB
.
FileStorage
.
FileIterator
(
'data.fs'
,
tids
[
30
])
Scan
forward
data
.
fs
:
4
looking
for
'\x03z\xbd\xd8\xdc\x96.\xcc'
>>>
it
.
next
()
.
tid
==
tids
[
30
]
True
>>>
it
.
close
()
>>>
it
=
ZODB
.
FileStorage
.
FileIterator
(
'data.fs'
,
tids
[
70
])
Scan
backward
data
.
fs
:
117080
looking
for
'\x03z\xbd\xd8\xed\xa7>\xcc'
>>>
it
.
next
()
.
tid
==
tids
[
70
]
True
>>>
it
.
close
()
>>>
it
=
ZODB
.
FileStorage
.
FileIterator
(
'data.fs'
,
tids
[
-
2
])
Scan
backward
data
.
fs
:
117080
looking
for
'\x03z\xbd\xd8\xfa\x06\xd0\xcc'
>>>
it
.
next
()
.
tid
==
tids
[
-
2
]
True
>>>
it
.
close
()
>>>
it
=
ZODB
.
FileStorage
.
FileIterator
(
'data.fs'
,
tids
[
-
1
])
>>>
it
.
next
()
.
tid
==
tids
[
-
1
]
True
>>>
it
.
close
()
We
can
also
supply
a
file
position
.
This
can
speed
up
finding
the
starting
point
,
or
just
pick
up
where
another
iterator
left
off
:
...
...
@@ -86,28 +100,40 @@ starting point, or just pick up where another iterator left off:
>>>
it
.
next
()
.
tid
==
tids
[
51
]
True
>>>
it
.
close
()
>>>
it
=
ZODB
.
FileStorage
.
FileIterator
(
'data.fs'
,
tids
[
0
],
pos
=
4
)
>>>
it
.
next
()
.
tid
==
tids
[
0
]
True
>>>
it
.
close
()
>>>
it
=
ZODB
.
FileStorage
.
FileIterator
(
'data.fs'
,
tids
[
-
1
],
pos
=
poss
[
-
2
])
>>>
it
.
next
()
.
tid
==
tids
[
-
1
]
True
>>>
it
.
close
()
>>>
it
=
ZODB
.
FileStorage
.
FileIterator
(
'data.fs'
,
tids
[
50
],
pos
=
poss
[
50
])
Scan
backward
data
.
fs
:
35936
looking
for
'\x03z\xbd\xd8\xe5\x1e\xb6\xcc'
>>>
it
.
next
()
.
tid
==
tids
[
50
]
True
>>>
it
.
close
()
>>>
it
=
ZODB
.
FileStorage
.
FileIterator
(
'data.fs'
,
tids
[
49
],
pos
=
poss
[
50
])
Scan
backward
data
.
fs
:
35936
looking
for
'\x03z\xbd\xd8\xe4\xb1|\xcc'
>>>
it
.
next
()
.
tid
==
tids
[
49
]
True
>>>
it
.
close
()
>>>
it
=
ZODB
.
FileStorage
.
FileIterator
(
'data.fs'
,
tids
[
51
],
pos
=
poss
[
50
])
>>>
it
.
next
()
.
tid
==
tids
[
51
]
True
>>>
it
.
close
()
>>>
logging
.
getLogger
()
.
setLevel
(
old_log_level
)
>>>
logging
.
getLogger
()
.
removeHandler
(
handler
)
...
...
@@ -120,12 +146,16 @@ then the first transaction is returned.
>>>
it
.
next
()
.
tid
==
tids
[
0
]
True
>>>
it
.
close
()
If
it
is
after
the
last
transaction
,
then
iteration
be
empty
:
>>>
it
=
ZODB
.
FileStorage
.
FileIterator
(
'data.fs'
,
p64
(
u64
(
tids
[
-
1
])
+
1
))
>>>
list
(
it
)
[]
>>>
it
.
close
()
Even
if
we
write
more
transactions
:
>>>
it
=
ZODB
.
FileStorage
.
FileIterator
(
'data.fs'
,
p64
(
u64
(
tids
[
-
1
])
+
1
))
...
...
@@ -135,8 +165,9 @@ Even if we write more transactions:
>>>
list
(
it
)
[]
>>>
it
.
close
()
..
Cleanup
>>>
time
.
time
=
time_time
>>>
it
.
close
()
>>>
db
.
close
()
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