Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
a87a8e93
Commit
a87a8e93
authored
Apr 17, 2004
by
Gintautas Miliauskas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated to use logging instead of zLOG.
parent
2fd1f932
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
15 deletions
+19
-15
src/ZODB/DB.py
src/ZODB/DB.py
+5
-3
src/ZODB/ExportImport.py
src/ZODB/ExportImport.py
+5
-4
src/ZODB/FileStorage/format.py
src/ZODB/FileStorage/format.py
+5
-2
src/ZODB/lock_file.py
src/ZODB/lock_file.py
+4
-6
No files found.
src/ZODB/DB.py
View file @
a87a8e93
...
@@ -13,20 +13,22 @@
...
@@ -13,20 +13,22 @@
##############################################################################
##############################################################################
"""Database objects
"""Database objects
$Id: DB.py,v 1.7
5 2004/04/15 16:41:42 jeremy
Exp $"""
$Id: DB.py,v 1.7
6 2004/04/17 23:04:52 gintautasm
Exp $"""
import
cPickle
,
cStringIO
,
sys
import
cPickle
,
cStringIO
,
sys
from
thread
import
allocate_lock
from
thread
import
allocate_lock
from
time
import
time
,
ctime
from
time
import
time
,
ctime
import
warnings
import
warnings
import
logging
from
ZODB.broken
import
find_global
from
ZODB.broken
import
find_global
from
ZODB.Connection
import
Connection
from
ZODB.Connection
import
Connection
from
ZODB.serialize
import
referencesf
from
ZODB.serialize
import
referencesf
from
zLOG
import
LOG
,
ERROR
import
transaction
import
transaction
logger
=
logging
.
getLogger
(
'zodb.db'
)
class
DB
(
object
):
class
DB
(
object
):
"""The Object Database
"""The Object Database
-------------------
-------------------
...
@@ -601,7 +603,7 @@ class DB(object):
...
@@ -601,7 +603,7 @@ class DB(object):
try
:
try
:
self
.
_storage
.
pack
(
t
,
referencesf
)
self
.
_storage
.
pack
(
t
,
referencesf
)
except
:
except
:
LOG
(
"ZODB"
,
ERROR
,
"packing"
,
error
=
sys
.
exc_info
()
)
logger
.
error
(
"packing"
,
exc_info
=
True
)
raise
raise
def
setCacheSize
(
self
,
v
):
def
setCacheSize
(
self
,
v
):
...
...
src/ZODB/ExportImport.py
View file @
a87a8e93
...
@@ -16,13 +16,15 @@
...
@@ -16,13 +16,15 @@
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
from
cPickle
import
Pickler
,
Unpickler
from
cPickle
import
Pickler
,
Unpickler
from
tempfile
import
TemporaryFile
from
tempfile
import
TemporaryFile
import
logging
from
ZODB.POSException
import
ExportError
from
ZODB.POSException
import
ExportError
from
ZODB.utils
import
p64
,
u64
from
ZODB.utils
import
p64
,
u64
from
ZODB.serialize
import
referencesf
from
ZODB.serialize
import
referencesf
import
zLOG
import
sys
import
sys
logger
=
logging
.
getLogger
(
'zodb.ExportImport'
)
class
ExportImport
:
class
ExportImport
:
def
exportFile
(
self
,
oid
,
f
=
None
):
def
exportFile
(
self
,
oid
,
f
=
None
):
...
@@ -43,9 +45,8 @@ class ExportImport:
...
@@ -43,9 +45,8 @@ class ExportImport:
try
:
try
:
p
,
serial
=
load
(
oid
,
self
.
_version
)
p
,
serial
=
load
(
oid
,
self
.
_version
)
except
:
except
:
zLOG
.
LOG
(
"ZODB"
,
zLOG
.
DEBUG
,
logger
.
debug
(
"broken reference for oid %s"
,
repr
(
oid
),
"broken reference for oid %s"
%
`oid`
,
exc_info
=
True
)
err
=
sys
.
exc_info
())
else
:
else
:
referencesf
(
p
,
oids
)
referencesf
(
p
,
oids
)
f
.
writelines
([
oid
,
p64
(
len
(
p
)),
p
])
f
.
writelines
([
oid
,
p64
(
len
(
p
)),
p
])
...
...
src/ZODB/FileStorage/format.py
View file @
a87a8e93
...
@@ -124,10 +124,11 @@
...
@@ -124,10 +124,11 @@
# record.
# record.
import
struct
import
struct
import
logging
from
ZODB.POSException
import
POSKeyError
from
ZODB.POSException
import
POSKeyError
from
ZODB.utils
import
u64
,
oid_repr
,
t32
from
ZODB.utils
import
u64
,
oid_repr
,
t32
from
zLOG
import
LOG
,
ERROR
class
CorruptedError
(
Exception
):
class
CorruptedError
(
Exception
):
pass
pass
...
@@ -159,6 +160,8 @@ DATA_VERSION_HDR_LEN = 58
...
@@ -159,6 +160,8 @@ DATA_VERSION_HDR_LEN = 58
assert
struct
.
calcsize
(
TRANS_HDR
)
==
TRANS_HDR_LEN
assert
struct
.
calcsize
(
TRANS_HDR
)
==
TRANS_HDR_LEN
assert
struct
.
calcsize
(
DATA_HDR
)
==
DATA_HDR_LEN
assert
struct
.
calcsize
(
DATA_HDR
)
==
DATA_HDR_LEN
logger
=
logging
.
getLogger
(
'zodb.FileStorage.format'
)
class
FileStorageFormatter
(
object
):
class
FileStorageFormatter
(
object
):
"""Mixin class that can read and write the low-level format."""
"""Mixin class that can read and write the low-level format."""
...
@@ -244,7 +247,7 @@ class FileStorageFormatter(object):
...
@@ -244,7 +247,7 @@ class FileStorageFormatter(object):
def
fail
(
self
,
pos
,
msg
,
*
args
):
def
fail
(
self
,
pos
,
msg
,
*
args
):
s
=
(
"%s:%s:"
+
msg
)
%
((
self
.
_name
,
pos
)
+
args
)
s
=
(
"%s:%s:"
+
msg
)
%
((
self
.
_name
,
pos
)
+
args
)
LOG
(
"FS pack"
,
ERROR
,
s
)
logger
.
error
(
s
)
raise
CorruptedError
(
s
)
raise
CorruptedError
(
s
)
def
checkTxn
(
self
,
th
,
pos
):
def
checkTxn
(
self
,
th
,
pos
):
...
...
src/ZODB/lock_file.py
View file @
a87a8e93
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
import
os
import
os
import
errno
import
errno
import
logging
import
logging
logger
=
logging
.
getLogger
(
"ZODB.lock_file"
)
try
:
try
:
import
fcntl
import
fcntl
...
@@ -23,10 +24,8 @@ except ImportError:
...
@@ -23,10 +24,8 @@ except ImportError:
from
winlock
import
LockFile
as
_LockFile
from
winlock
import
LockFile
as
_LockFile
from
winlock
import
UnlockFile
as
_UnlockFile
from
winlock
import
UnlockFile
as
_UnlockFile
except
ImportError
:
except
ImportError
:
import
zLOG
def
lock_file
(
file
):
def
lock_file
(
file
):
zLOG
.
LOG
(
'ZODB'
,
zLOG
.
INFO
,
logger
.
info
(
'No file-locking support on this platform'
)
'No file-locking support on this platform'
)
# Windows
# Windows
def
lock_file
(
file
):
def
lock_file
(
file
):
...
@@ -46,9 +45,8 @@ else:
...
@@ -46,9 +45,8 @@ else:
# File is automatically unlocked on close
# File is automatically unlocked on close
pass
pass
log
=
logging
.
getLogger
(
"LockFile"
)
# This is a better interface to use than the lockfile.lock_file() interface.
# This is a better interface to use than the lockfile.lock_file() interface.
# Creating the instance acquires the lock. The file remains open. Calling
# Creating the instance acquires the lock. The file remains open. Calling
# close both closes and unlocks the lock file.
# close both closes and unlocks the lock file.
...
@@ -64,7 +62,7 @@ class LockFile:
...
@@ -64,7 +62,7 @@ class LockFile:
try
:
try
:
lock_file
(
self
.
_fp
)
lock_file
(
self
.
_fp
)
except
:
except
:
log
.
exception
(
"Error locking file %s"
%
path
)
log
ger
.
exception
(
"Error locking file %s"
,
path
)
raise
raise
print
>>
self
.
_fp
,
os
.
getpid
()
print
>>
self
.
_fp
,
os
.
getpid
()
self
.
_fp
.
flush
()
self
.
_fp
.
flush
()
...
...
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