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
Joshua
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
Show 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
...
@@ -25,6 +25,7 @@ import POSException
from
persistent.TimeStamp
import
TimeStamp
from
persistent.TimeStamp
import
TimeStamp
from
ZODB
import
POSException
,
utils
from
ZODB
import
POSException
,
utils
from
ZODB.utils
import
z64
from
ZODB.UndoLogCompatible
import
UndoLogCompatible
from
ZODB.UndoLogCompatible
import
UndoLogCompatible
log
=
logging
.
getLogger
(
"ZODB.BaseStorage"
)
log
=
logging
.
getLogger
(
"ZODB.BaseStorage"
)
...
@@ -98,7 +99,7 @@ class BaseStorage(UndoLogCompatible):
...
@@ -98,7 +99,7 @@ class BaseStorage(UndoLogCompatible):
t
=
self
.
_ts
=
apply
(
TimeStamp
,(
time
.
gmtime
(
t
)[:
5
]
+
(
t
%
60
,)))
t
=
self
.
_ts
=
apply
(
TimeStamp
,(
time
.
gmtime
(
t
)[:
5
]
+
(
t
%
60
,)))
self
.
_tid
=
`t`
self
.
_tid
=
`t`
if
base
is
None
:
if
base
is
None
:
self
.
_oid
=
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
self
.
_oid
=
z64
else
:
else
:
self
.
_oid
=
base
.
_oid
self
.
_oid
=
base
.
_oid
...
...
src/ZODB/DB.py
View file @
41c20bde
...
@@ -22,6 +22,7 @@ import warnings
...
@@ -22,6 +22,7 @@ import warnings
import
logging
import
logging
from
ZODB.broken
import
find_global
from
ZODB.broken
import
find_global
from
ZODB.utils
import
z64
from
ZODB.Connection
import
Connection
from
ZODB.Connection
import
Connection
from
ZODB.serialize
import
referencesf
from
ZODB.serialize
import
referencesf
...
@@ -124,7 +125,7 @@ class DB(object):
...
@@ -124,7 +125,7 @@ class DB(object):
if
not
hasattr
(
storage
,
'tpc_vote'
):
if
not
hasattr
(
storage
,
'tpc_vote'
):
storage
.
tpc_vote
=
lambda
*
args
:
None
storage
.
tpc_vote
=
lambda
*
args
:
None
try
:
try
:
storage
.
load
(
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
,
''
)
storage
.
load
(
z64
,
''
)
except
KeyError
:
except
KeyError
:
# Create the database's root in the storage if it doesn't exist
# Create the database's root in the storage if it doesn't exist
from
persistent.mapping
import
PersistentMapping
from
persistent.mapping
import
PersistentMapping
...
@@ -138,7 +139,7 @@ class DB(object):
...
@@ -138,7 +139,7 @@ class DB(object):
t
=
transaction
.
Transaction
()
t
=
transaction
.
Transaction
()
t
.
description
=
'initial database creation'
t
.
description
=
'initial database creation'
storage
.
tpc_begin
(
t
)
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_vote
(
t
)
storage
.
tpc_finish
(
t
)
storage
.
tpc_finish
(
t
)
...
...
src/ZODB/DemoStorage.py
View file @
41c20bde
...
@@ -82,6 +82,7 @@ and call it to monitor the storage.
...
@@ -82,6 +82,7 @@ and call it to monitor the storage.
import
base64
,
time
,
string
import
base64
,
time
,
string
from
ZODB
import
POSException
,
BaseStorage
,
utils
from
ZODB
import
POSException
,
BaseStorage
,
utils
from
ZODB.utils
import
z64
from
persistent.TimeStamp
import
TimeStamp
from
persistent.TimeStamp
import
TimeStamp
from
cPickle
import
loads
from
cPickle
import
loads
from
BTrees
import
OOBTree
from
BTrees
import
OOBTree
...
@@ -409,7 +410,7 @@ class DemoStorage(BaseStorage.BaseStorage):
...
@@ -409,7 +410,7 @@ class DemoStorage(BaseStorage.BaseStorage):
# Now build an index of *only* those objects reachable
# Now build an index of *only* those objects reachable
# from the root.
# from the root.
rootl
=
[
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
]
rootl
=
[
z64
]
pindex
=
{}
pindex
=
{}
while
rootl
:
while
rootl
:
oid
=
rootl
.
pop
()
oid
=
rootl
.
pop
()
...
...
src/ZODB/MappingStorage.py
View file @
41c20bde
...
@@ -21,7 +21,7 @@ It is meant to illustrate the simplest possible storage.
...
@@ -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.
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
BaseStorage
from
ZODB
import
POSException
from
ZODB
import
POSException
from
persistent.TimeStamp
import
TimeStamp
from
persistent.TimeStamp
import
TimeStamp
...
@@ -115,7 +115,7 @@ class MappingStorage(BaseStorage.BaseStorage):
...
@@ -115,7 +115,7 @@ class MappingStorage(BaseStorage.BaseStorage):
if
not
self
.
_index
:
if
not
self
.
_index
:
return
return
# Build an index of *only* those objects reachable from the root.
# Build an index of *only* those objects reachable from the root.
rootl
=
[
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
]
rootl
=
[
z64
]
pindex
=
{}
pindex
=
{}
while
rootl
:
while
rootl
:
oid
=
rootl
.
pop
()
oid
=
rootl
.
pop
()
...
@@ -144,6 +144,6 @@ class MappingStorage(BaseStorage.BaseStorage):
...
@@ -144,6 +144,6 @@ class MappingStorage(BaseStorage.BaseStorage):
for
oid
in
keys
:
for
oid
in
keys
:
r
=
self
.
_index
[
oid
]
r
=
self
.
_index
[
oid
]
o
.
append
(
' %s: %s, %s'
%
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
)
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
...
@@ -19,6 +19,8 @@ objects like hit counters that don't need or want to participate
in undo or versions.
in undo or versions.
"""
"""
from
ZODB.utils
import
z64
from
MappingStorage
import
MappingStorage
from
MappingStorage
import
MappingStorage
from
BaseStorage
import
BaseStorage
from
BaseStorage
import
BaseStorage
import
anydbm
,
os
import
anydbm
,
os
...
@@ -56,7 +58,7 @@ class gdbmStorage(anydbmStorage):
...
@@ -56,7 +58,7 @@ class gdbmStorage(anydbmStorage):
self
.
_index
=
index
=
gdbm
.
open
(
filename
,
flag
[:
1
]
+
'f'
,
mode
)
self
.
_index
=
index
=
gdbm
.
open
(
filename
,
flag
[:
1
]
+
'f'
,
mode
)
self
.
_tindex
=
[]
self
.
_tindex
=
[]
m
=
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
m
=
z64
oid
=
index
.
firstkey
()
oid
=
index
.
firstkey
()
while
oid
!=
None
:
while
oid
!=
None
:
m
=
max
(
m
,
oid
)
m
=
max
(
m
,
oid
)
...
@@ -76,7 +78,7 @@ class gdbmStorage(anydbmStorage):
...
@@ -76,7 +78,7 @@ class gdbmStorage(anydbmStorage):
# Build an index of *only* those objects reachable
# Build an index of *only* those objects reachable
# from the root.
# from the root.
index
=
self
.
_index
index
=
self
.
_index
rootl
=
[
'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
0
'
]
rootl
=
[
z64
]
pop
=
rootl
.
pop
pop
=
rootl
.
pop
pindex
=
{}
pindex
=
{}
referenced
=
pindex
.
has_key
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