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
573a3dd4
Commit
573a3dd4
authored
Aug 25, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrated with zLOG.
parent
364674cc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
9 deletions
+35
-9
src/ZEO/StorageServer.py
src/ZEO/StorageServer.py
+15
-5
src/ZEO/smac.py
src/ZEO/smac.py
+10
-2
src/ZEO/zrpc/smac.py
src/ZEO/zrpc/smac.py
+10
-2
No files found.
src/ZEO/StorageServer.py
View file @
573a3dd4
...
...
@@ -4,9 +4,12 @@ from smac import smac
from
ZODB
import
POSException
from
ZODB.Transaction
import
Transaction
import
traceback
from
zLOG
import
LOG
,
INFO
,
ERROR
class
StorageServerError
(
POSException
.
StorageError
):
pass
def
blather
(
*
args
):
LOG
(
'ZEO Server'
,
INFO
,
string
.
join
(
args
))
class
StorageServer
(
asyncore
.
dispatcher
):
...
...
@@ -71,6 +74,13 @@ class StorageServer(asyncore.dispatcher):
Connection
(
self
,
sock
,
addr
)
def
log_info
(
self
,
message
,
type
=
'info'
):
if
type
==
'error'
:
type
=
ERROR
else
:
type
=
INFO
LOG
(
'ZEO Server'
,
type
,
message
)
log
=
log_info
storage_methods
=
{}
for
n
in
(
'get_info'
,
'abortVersion'
,
'commitVersion'
,
'history'
,
'load'
,
'modifiedInVersion'
,
'new_oid'
,
'pack'
,
'store'
,
...
...
@@ -107,7 +117,7 @@ class Connection(smac):
if
__debug__
:
m
=
`message`
if
len
(
m
)
>
60
:
m
=
m
[:
60
]
+
' ...'
print
'message_input'
,
m
blather
(
'message_input'
,
m
)
if
self
.
__storage
is
None
:
self
.
__storage
,
self
.
__storage_id
=
(
...
...
@@ -121,7 +131,7 @@ class Connection(smac):
if
__debug__
:
m
=
`tuple(args)`
if
len
(
m
)
>
60
:
m
=
m
[:
60
]
+
' ...'
print
'call: %s%s'
%
(
name
,
m
)
blather
(
'call: %s%s'
%
(
name
,
m
)
)
if
not
storage_method
(
name
):
raise
'Invalid Method Name'
,
name
...
...
@@ -131,7 +141,7 @@ class Connection(smac):
r
=
apply
(
getattr
(
self
.
__storage
,
name
),
args
)
if
r
is
_noreturn
:
return
except
:
traceback
.
print_exc
(
)
LOG
(
'ZEO Server'
,
ERROR
,
'error'
,
error
=
sys
.
exc_info
()
)
t
,
r
=
sys
.
exc_info
()[:
2
]
if
type
(
r
)
is
not
type
(
self
):
r
=
t
,
r
rt
=
'E'
...
...
@@ -139,7 +149,7 @@ class Connection(smac):
if
__debug__
:
m
=
`r`
if
len
(
m
)
>
60
:
m
=
m
[:
60
]
+
' ...'
print
'%s: %s'
%
(
rt
,
m
)
blather
(
'%s: %s'
%
(
rt
,
m
)
)
r
=
cPickle
.
dumps
(
r
,
1
)
self
.
message_output
(
rt
+
r
)
...
...
@@ -271,7 +281,7 @@ class Connection(smac):
if
__name__
==
'__main__'
:
import
ZODB.FileStorage
name
,
port
=
sys
.
argv
[
1
:
3
]
print
name
,
port
blather
(
name
,
port
)
try
:
port
=
''
,
string
.
atoi
(
port
)
except
:
pass
StorageServer
(
port
,
ZODB
.
FileStorage
.
FileStorage
(
name
))
...
...
src/ZEO/smac.py
View file @
573a3dd4
"""Sized message async connections
"""
import
asyncore
,
string
,
struct
import
asyncore
,
string
,
struct
,
zLOG
from
zLOG
import
LOG
,
INFO
,
ERROR
class
smac
(
asyncore
.
dispatcher
):
...
...
@@ -64,5 +65,12 @@ class smac(asyncore.dispatcher):
if
__debug__
:
if
len
(
message
)
>
40
:
m
=
message
[:
40
]
+
' ...'
else
:
m
=
message
print
'message_output'
,
`m`
LOG
(
'smax'
,
INFO
,
'message_output %s'
%
`m`
)
self
.
__append
(
pack
(
">i"
,
len
(
message
))
+
message
)
def
log_info
(
self
,
message
,
type
=
'info'
):
if
type
==
'error'
:
type
=
ERROR
else
:
type
=
INFO
LOG
(
'ZEO Server'
,
type
,
message
)
log
=
log_info
src/ZEO/zrpc/smac.py
View file @
573a3dd4
"""Sized message async connections
"""
import
asyncore
,
string
,
struct
import
asyncore
,
string
,
struct
,
zLOG
from
zLOG
import
LOG
,
INFO
,
ERROR
class
smac
(
asyncore
.
dispatcher
):
...
...
@@ -64,5 +65,12 @@ class smac(asyncore.dispatcher):
if
__debug__
:
if
len
(
message
)
>
40
:
m
=
message
[:
40
]
+
' ...'
else
:
m
=
message
print
'message_output'
,
`m`
LOG
(
'smax'
,
INFO
,
'message_output %s'
%
`m`
)
self
.
__append
(
pack
(
">i"
,
len
(
message
))
+
message
)
def
log_info
(
self
,
message
,
type
=
'info'
):
if
type
==
'error'
:
type
=
ERROR
else
:
type
=
INFO
LOG
(
'ZEO Server'
,
type
,
message
)
log
=
log_info
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