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