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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
ZODB
Commits
41c20bde
Commit
41c20bde
authored
Oct 15, 2004
by
Dmitry Vasiliev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Now use ZODB.utils.z64 instead of '\0\0\0\0\0\0\0\0' where appropriate
parent
402ea2f9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
9 deletions
+14
-9
src/ZODB/BaseStorage.py
src/ZODB/BaseStorage.py
+2
-1
src/ZODB/DB.py
src/ZODB/DB.py
+3
-2
src/ZODB/DemoStorage.py
src/ZODB/DemoStorage.py
+2
-1
src/ZODB/MappingStorage.py
src/ZODB/MappingStorage.py
+3
-3
src/ZODB/dbmStorage.py
src/ZODB/dbmStorage.py
+4
-2
No files found.
src/ZODB/BaseStorage.py
View file @
41c20bde
...
...
@@ -25,6 +25,7 @@ import POSException
from
persistent.TimeStamp
import
TimeStamp
from
ZODB
import
POSException
,
utils
from
ZODB.utils
import
z64
from
ZODB.UndoLogCompatible
import
UndoLogCompatible
log
=
logging
.
getLogger
(
"ZODB.BaseStorage"
)
...
...
@@ -98,7 +99,7 @@ class BaseStorage(UndoLogCompatible):
t
=
self
.
_ts
=
apply
(
TimeStamp
,(
time
.
gmtime
(
t
)[:
5
]
+
(
t
%
60
,)))
self
.
_tid
=
`t`
if
base
is
None
:
self
.
_oid
=
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
self
.
_oid
=
z64
else
:
self
.
_oid
=
base
.
_oid
...
...
src/ZODB/DB.py
View file @
41c20bde
...
...
@@ -22,6 +22,7 @@ import warnings
import
logging
from
ZODB.broken
import
find_global
from
ZODB.utils
import
z64
from
ZODB.Connection
import
Connection
from
ZODB.serialize
import
referencesf
...
...
@@ -124,7 +125,7 @@ class DB(object):
if
not
hasattr
(
storage
,
'tpc_vote'
):
storage
.
tpc_vote
=
lambda
*
args
:
None
try
:
storage
.
load
(
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
,
''
)
storage
.
load
(
z64
,
''
)
except
KeyError
:
# Create the database's root in the storage if it doesn't exist
from
persistent.mapping
import
PersistentMapping
...
...
@@ -138,7 +139,7 @@ class DB(object):
t
=
transaction
.
Transaction
()
t
.
description
=
'initial database creation'
storage
.
tpc_begin
(
t
)
storage
.
store
(
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
,
None
,
file
.
getvalue
(),
''
,
t
)
storage
.
store
(
z64
,
None
,
file
.
getvalue
(),
''
,
t
)
storage
.
tpc_vote
(
t
)
storage
.
tpc_finish
(
t
)
...
...
src/ZODB/DemoStorage.py
View file @
41c20bde
...
...
@@ -82,6 +82,7 @@ and call it to monitor the storage.
import
base64
,
time
,
string
from
ZODB
import
POSException
,
BaseStorage
,
utils
from
ZODB.utils
import
z64
from
persistent.TimeStamp
import
TimeStamp
from
cPickle
import
loads
from
BTrees
import
OOBTree
...
...
@@ -409,7 +410,7 @@ class DemoStorage(BaseStorage.BaseStorage):
# Now build an index of *only* those objects reachable
# from the root.
rootl
=
[
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
]
rootl
=
[
z64
]
pindex
=
{}
while
rootl
:
oid
=
rootl
.
pop
()
...
...
src/ZODB/MappingStorage.py
View file @
41c20bde
...
...
@@ -21,7 +21,7 @@ It is meant to illustrate the simplest possible storage.
The Mapping storage uses a single data structure to map object ids to data.
"""
from
ZODB
import
utils
from
ZODB
.utils
import
u64
,
z64
from
ZODB
import
BaseStorage
from
ZODB
import
POSException
from
persistent.TimeStamp
import
TimeStamp
...
...
@@ -115,7 +115,7 @@ class MappingStorage(BaseStorage.BaseStorage):
if
not
self
.
_index
:
return
# Build an index of *only* those objects reachable from the root.
rootl
=
[
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
]
rootl
=
[
z64
]
pindex
=
{}
while
rootl
:
oid
=
rootl
.
pop
()
...
...
@@ -144,6 +144,6 @@ class MappingStorage(BaseStorage.BaseStorage):
for
oid
in
keys
:
r
=
self
.
_index
[
oid
]
o
.
append
(
' %s: %s, %s'
%
(
u
tils
.
u
64
(
oid
),
TimeStamp
(
r
[:
8
]),
`r[8:]`
))
(
u64
(
oid
),
TimeStamp
(
r
[:
8
]),
`r[8:]`
))
return
'
\
n
'
.
join
(
o
)
src/ZODB/dbmStorage.py
View file @
41c20bde
...
...
@@ -19,6 +19,8 @@ objects like hit counters that don't need or want to participate
in undo or versions.
"""
from
ZODB.utils
import
z64
from
MappingStorage
import
MappingStorage
from
BaseStorage
import
BaseStorage
import
anydbm
,
os
...
...
@@ -56,7 +58,7 @@ class gdbmStorage(anydbmStorage):
self
.
_index
=
index
=
gdbm
.
open
(
filename
,
flag
[:
1
]
+
'f'
,
mode
)
self
.
_tindex
=
[]
m
=
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
m
=
z64
oid
=
index
.
firstkey
()
while
oid
!=
None
:
m
=
max
(
m
,
oid
)
...
...
@@ -76,7 +78,7 @@ class gdbmStorage(anydbmStorage):
# Build an index of *only* those objects reachable
# from the root.
index
=
self
.
_index
rootl
=
[
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
]
rootl
=
[
z64
]
pop
=
rootl
.
pop
pindex
=
{}
referenced
=
pindex
.
has_key
...
...
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