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
9e308603
Commit
9e308603
authored
Aug 29, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge slog() function and self._log() method.
parent
5f43da72
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
src/ZEO/StorageServer.py
src/ZEO/StorageServer.py
+10
-16
No files found.
src/ZEO/StorageServer.py
View file @
9e308603
...
...
@@ -49,13 +49,6 @@ def log(message, level=zLOG.INFO, label="ZEO Server:%s" % os.getpid(),
error
=
None
):
zLOG
.
LOG
(
label
,
level
,
message
,
error
=
error
)
# a version of log that includes the storage name
def
slog
(
storage
,
msg
,
level
=
zLOG
.
INFO
,
error
=
None
,
pid
=
os
.
getpid
()):
name
=
getattr
(
storage
,
'__name__'
,
None
)
if
name
is
None
:
name
=
str
(
storage
)
zLOG
.
LOG
(
"ZEO Server:%s:%s"
%
(
pid
,
name
),
level
,
msg
,
error
=
error
)
class
StorageServerError
(
StorageError
):
pass
...
...
@@ -126,6 +119,7 @@ class ZEOStorage:
def
close
(
self
):
# When this storage closes, we must ensure that it aborts
# any pending transaction. Not sure if this is the clearest way.
zLOG
.
LOG
if
self
.
_transaction
is
not
None
:
self
.
tpc_abort
(
self
.
_transaction
.
id
)
self
.
_conn
.
close
()
...
...
@@ -145,8 +139,10 @@ class ZEOStorage:
return
"<%s %X trans=%s s_trans=%s>"
%
(
name
,
id
(
self
),
tid
,
stid
)
def
_log
(
self
,
msg
,
level
=
zLOG
.
INFO
,
error
=
None
,
pid
=
os
.
getpid
()):
zLOG
.
LOG
(
"ZEO Server:%s:%s"
%
(
pid
,
self
.
__storage_id
),
level
,
msg
,
error
=
error
)
name
=
getattr
(
self
,
'__name__'
,
None
)
if
name
is
None
:
name
=
str
(
self
)
zLOG
.
LOG
(
"ZEO Server:%s:%s"
%
(
pid
,
name
),
level
,
msg
,
error
=
error
)
def
setup_delegation
(
self
):
"""Delegate several methods to the storage"""
...
...
@@ -162,16 +158,14 @@ class ZEOStorage:
def
_check_tid
(
self
,
tid
,
exc
=
None
):
caller
=
sys
.
_getframe
().
f_back
.
f_code
.
co_name
if
self
.
_transaction
is
None
:
self
.
_log
(
"no current transaction: %s()"
%
caller
,
zLOG
.
PROBLEM
)
self
.
_log
(
"no current transaction: %s()"
%
caller
,
zLOG
.
PROBLEM
)
if
exc
is
not
None
:
raise
exc
(
None
,
tid
)
else
:
return
0
if
self
.
_transaction
.
id
!=
tid
:
self
.
_log
(
"%s(%s) invalid; current transaction = %s"
%
\
(
caller
,
repr
(
tid
),
repr
(
self
.
_transaction
.
id
)),
zLOG
.
PROBLEM
)
(
caller
,
repr
(
tid
),
repr
(
self
.
_transaction
.
id
)),
zLOG
.
PROBLEM
)
if
exc
is
not
None
:
raise
exc
(
self
.
_transaction
.
id
,
tid
)
else
:
...
...
@@ -487,8 +481,8 @@ class ImmediateCommitStrategy:
except
Exception
:
# Unexpected storage errors are logged and passed to the client
exc_info
=
sys
.
exc_info
()
s
log
(
self
.
storage
,
"store error: %s, %s"
%
exc_info
[:
2
],
zLOG
.
ERROR
,
error
=
exc_info
)
s
elf
.
storage
.
_log
(
"store error: %s, %s"
%
exc_info
[:
2
],
zLOG
.
ERROR
,
error
=
exc_info
)
newserial
=
exc_info
[
1
]
del
exc_info
else
:
...
...
@@ -499,7 +493,7 @@ class ImmediateCommitStrategy:
dump
(
newserial
,
1
)
except
:
msg
=
"Couldn't pickle storage exception: %s"
%
repr
(
newserial
)
s
log
(
self
.
storage
,
msg
,
zLOG
.
ERROR
)
s
elf
.
storage
.
_log
(
msg
,
zLOG
.
ERROR
)
dump
(
''
,
1
)
# clear pickler
r
=
StorageServerError
(
msg
)
newserial
=
r
...
...
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