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
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
Kirill Smelkov
ZEO
Commits
f71114f0
Commit
f71114f0
authored
Aug 02, 2016
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use relative imports in server code so it can be reused in ZEO5 tests
parent
4aaf4b62
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
40 additions
and
44 deletions
+40
-44
src/ZEO/StorageServer.py
src/ZEO/StorageServer.py
+8
-8
src/ZEO/auth/auth_digest.py
src/ZEO/auth/auth_digest.py
+3
-3
src/ZEO/auth/base.py
src/ZEO/auth/base.py
+1
-1
src/ZEO/monitor.py
src/ZEO/monitor.py
+0
-2
src/ZEO/runzeo.py
src/ZEO/runzeo.py
+2
-3
src/ZEO/zrpc/client.py
src/ZEO/zrpc/client.py
+5
-5
src/ZEO/zrpc/connection.py
src/ZEO/zrpc/connection.py
+10
-11
src/ZEO/zrpc/marshal.py
src/ZEO/zrpc/marshal.py
+2
-2
src/ZEO/zrpc/server.py
src/ZEO/zrpc/server.py
+4
-4
src/ZEO/zrpc/smac.py
src/ZEO/zrpc/smac.py
+5
-5
No files found.
src/ZEO/StorageServer.py
View file @
f71114f0
...
...
@@ -30,7 +30,7 @@ import threading
import
time
import
transaction
import
warnings
import
ZEO.zrpc.e
rror
from
.zrpc.error
import
DisconnectedE
rror
import
ZODB.blob
import
ZODB.event
import
ZODB.serialize
...
...
@@ -40,9 +40,9 @@ import six
from
ZEO._compat
import
Pickler
,
Unpickler
,
PY3
,
BytesIO
from
ZEO.Exceptions
import
AuthError
from
ZEO
.monitor
import
StorageStats
,
StatsServer
from
ZEO
.zrpc.connection
import
ManagedServerConnection
,
Delay
,
MTDelay
,
Result
from
ZEO
.zrpc.server
import
Dispatcher
from
.monitor
import
StorageStats
,
StatsServer
from
.zrpc.connection
import
ManagedServerConnection
,
Delay
,
MTDelay
,
Result
from
.zrpc.server
import
Dispatcher
from
ZODB.ConflictResolution
import
ResolvedSerial
from
ZODB.loglevels
import
BLATHER
from
ZODB.POSException
import
StorageError
,
StorageTransactionError
...
...
@@ -790,7 +790,7 @@ class StorageServer:
# Classes we instantiate. A subclass might override.
DispatcherClass
=
ZEO
.
zrpc
.
server
.
Dispatcher
from
.zrpc.server
import
Dispatcher
as
DispatcherClass
ZEOStorageClass
=
ZEOStorage
ManagedServerConnectionClass
=
ManagedServerConnection
...
...
@@ -947,7 +947,7 @@ class StorageServer:
def
_setup_auth
(
self
,
protocol
):
# Can't be done in global scope, because of cyclic references
from
ZEO
.auth
import
get_module
from
.auth
import
get_module
name
=
self
.
__class__
.
__name__
...
...
@@ -1049,7 +1049,7 @@ class StorageServer:
try
:
p
.
connection
.
should_close
()
p
.
connection
.
trigger
.
pull_trigger
()
except
ZEO
.
zrpc
.
error
.
DisconnectedError
:
except
DisconnectedError
:
pass
...
...
@@ -1111,7 +1111,7 @@ class StorageServer:
p
.
client
.
invalidateTransaction
(
tid
,
invalidated
)
elif
info
is
not
None
:
p
.
client
.
info
(
info
)
except
ZEO
.
zrpc
.
error
.
DisconnectedError
:
except
DisconnectedError
:
pass
def
get_invalidations
(
self
,
storage_id
,
tid
):
...
...
src/ZEO/auth/auth_digest.py
View file @
f71114f0
...
...
@@ -40,10 +40,10 @@ import random
import
struct
import
time
from
ZEO.auth
.base
import
Database
,
Client
from
ZEO
.StorageServer
import
ZEOStorage
from
.base
import
Database
,
Client
from
.
.StorageServer
import
ZEOStorage
from
ZEO.Exceptions
import
AuthError
from
ZEO
.hash
import
sha1
from
.
.hash
import
sha1
def
get_random_bytes
(
n
=
8
):
try
:
...
...
src/ZEO/auth/base.py
View file @
f71114f0
...
...
@@ -20,7 +20,7 @@ from __future__ import print_function
from
__future__
import
print_function
import
os
from
ZEO
.hash
import
sha1
from
.
.hash
import
sha1
class
Client
:
# Subclass should override to list the names of methods that
...
...
src/ZEO/monitor.py
View file @
f71114f0
...
...
@@ -12,8 +12,6 @@
#
##############################################################################
"""Monitor behavior of ZEO server and record statistics.
$Id$
"""
from
__future__
import
print_function
from
__future__
import
print_function
...
...
src/ZEO/runzeo.py
View file @
f71114f0
...
...
@@ -44,7 +44,6 @@ import socket
import
logging
import
ZConfig.datatypes
import
ZEO
from
zdaemon.zdoptions
import
ZDOptions
logger
=
logging
.
getLogger
(
'ZEO.runzeo'
)
...
...
@@ -123,7 +122,7 @@ class ZEOOptions(ZDOptions, ZEOOptionsMixin):
__doc__
=
__doc__
logsectionname
=
"eventlog"
schemadir
=
os
.
path
.
dirname
(
ZEO
.
__file__
)
schemadir
=
os
.
path
.
dirname
(
__file__
)
def
__init__
(
self
):
ZDOptions
.
__init__
(
self
)
...
...
@@ -344,7 +343,7 @@ class ZEOServer:
def
create_server
(
storages
,
options
):
from
ZEO
.StorageServer
import
StorageServer
from
.StorageServer
import
StorageServer
return
StorageServer
(
options
.
address
,
storages
,
...
...
src/ZEO/zrpc/client.py
View file @
f71114f0
...
...
@@ -19,12 +19,12 @@ import socket
import
sys
import
threading
import
time
import
ZEO.zrpc.
trigger
from
.
import
trigger
from
ZEO.zrpc
.connection
import
ManagedClientConnection
from
ZEO.zrpc
.log
import
log
from
ZEO.zrpc
.error
import
DisconnectedError
from
.connection
import
ManagedClientConnection
from
.log
import
log
from
.error
import
DisconnectedError
from
ZODB.POSException
import
ReadOnlyError
from
ZODB.loglevels
import
BLATHER
...
...
@@ -163,7 +163,7 @@ class ConnectionManager(object):
def
_start_asyncore_loop
(
self
):
self
.
map
=
{}
self
.
trigger
=
ZEO
.
zrpc
.
trigger
.
trigger
(
self
.
map
)
self
.
trigger
=
trigger
.
trigger
(
self
.
map
)
self
.
loop_thread
=
threading
.
Thread
(
name
=
"%s zeo client networking thread"
%
self
.
client
.
__name__
,
target
=
client_loop
,
args
=
(
self
.
map
,))
...
...
src/ZEO/zrpc/connection.py
View file @
f71114f0
...
...
@@ -17,13 +17,12 @@ import json
import
sys
import
threading
import
logging
import
ZEO.zrpc.marshal
from
.
import
marshal
from
.
import
trigger
import
ZEO.zrpc.trigger
from
ZEO.zrpc
import
smac
from
ZEO.zrpc.error
import
ZRPCError
,
DisconnectedError
from
ZEO.zrpc.log
import
short_repr
,
log
from
.
import
smac
from
.error
import
ZRPCError
,
DisconnectedError
from
.log
import
short_repr
,
log
from
ZODB.loglevels
import
BLATHER
,
TRACE
import
ZODB.POSException
...
...
@@ -290,9 +289,9 @@ class Connection(smac.SizedMessageAsyncConnection, object):
# our peer.
def
__init__
(
self
,
sock
,
addr
,
obj
,
tag
,
map
=
None
):
self
.
obj
=
None
self
.
decode
=
ZEO
.
zrpc
.
marshal
.
decode
self
.
encode
=
ZEO
.
zrpc
.
marshal
.
encode
self
.
fast_encode
=
ZEO
.
zrpc
.
marshal
.
fast_encode
self
.
decode
=
marshal
.
decode
self
.
encode
=
marshal
.
encode
self
.
fast_encode
=
marshal
.
fast_encode
self
.
closed
=
False
self
.
peer_protocol_version
=
None
# set in recv_handshake()
...
...
@@ -613,9 +612,9 @@ class ManagedServerConnection(Connection):
map
=
{}
Connection
.
__init__
(
self
,
sock
,
addr
,
obj
,
b'S'
,
map
=
map
)
self
.
decode
=
ZEO
.
zrpc
.
marshal
.
server_decode
self
.
decode
=
marshal
.
server_decode
self
.
trigger
=
ZEO
.
zrpc
.
trigger
.
trigger
(
map
)
self
.
trigger
=
trigger
.
trigger
(
map
)
self
.
call_from_thread
=
self
.
trigger
.
pull_trigger
t
=
threading
.
Thread
(
target
=
server_loop
,
args
=
(
map
,))
...
...
src/ZEO/zrpc/marshal.py
View file @
f71114f0
...
...
@@ -14,8 +14,8 @@
import
logging
from
ZEO._compat
import
Unpickler
,
Pickler
,
BytesIO
,
PY3
,
PYPY
from
ZEO.zrpc
.error
import
ZRPCError
from
ZEO.zrpc
.log
import
log
,
short_repr
from
.error
import
ZRPCError
from
.log
import
log
,
short_repr
def
encode
(
*
args
):
# args: (msgid, flags, name, args)
# (We used to have a global pickler, but that's not thread-safe. :-( )
...
...
src/ZEO/zrpc/server.py
View file @
f71114f0
...
...
@@ -31,9 +31,9 @@ else:
s
.
close
()
del
s
from
ZEO.zrpc
.connection
import
Connection
from
ZEO.zrpc
.log
import
log
import
ZEO.zrpc.log
from
.connection
import
Connection
from
.log
import
log
from
.log
import
logger
import
logging
# Export the main asyncore loop
...
...
@@ -119,6 +119,6 @@ class Dispatcher(asyncore.dispatcher):
except
:
if
sock
.
fileno
()
in
asyncore
.
socket_map
:
del
asyncore
.
socket_map
[
sock
.
fileno
()]
ZEO
.
zrpc
.
log
.
logger
.
exception
(
"Error in handle_accept"
)
logger
.
exception
(
"Error in handle_accept"
)
else
:
log
(
"connect from %s: %s"
%
(
repr
(
addr
),
c
))
src/ZEO/zrpc/smac.py
View file @
f71114f0
...
...
@@ -36,9 +36,9 @@ import socket
import
struct
import
threading
from
ZEO.zrpc
.log
import
log
from
ZEO.zrpc
.error
import
DisconnectedError
import
ZEO.
hash
from
.log
import
log
from
.error
import
DisconnectedError
from
..
import
hash
as
ZEO_
hash
# Use the dictionary to make sure we get the minimum number of errno
...
...
@@ -144,8 +144,8 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
# and thus iterator, because it contains a yield statement.
def
hack
():
self
.
__hmac_send
=
hmac
.
HMAC
(
sesskey
,
digestmod
=
ZEO
.
hash
)
self
.
__hmac_recv
=
hmac
.
HMAC
(
sesskey
,
digestmod
=
ZEO
.
hash
)
self
.
__hmac_send
=
hmac
.
HMAC
(
sesskey
,
digestmod
=
ZEO
_
hash
)
self
.
__hmac_recv
=
hmac
.
HMAC
(
sesskey
,
digestmod
=
ZEO
_
hash
)
if
False
:
yield
b''
...
...
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