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
8c3b6ee0
Commit
8c3b6ee0
authored
Jun 17, 2016
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Oh git -- rest of last commit
parent
dcbeab41
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
36 deletions
+18
-36
src/ZEO/ClientStorage.py
src/ZEO/ClientStorage.py
+1
-2
src/ZEO/asyncio/client.py
src/ZEO/asyncio/client.py
+1
-19
src/ZEO/asyncio/tests.py
src/ZEO/asyncio/tests.py
+13
-12
src/ZEO/tests/testZEO.py
src/ZEO/tests/testZEO.py
+3
-3
No files found.
src/ZEO/ClientStorage.py
View file @
8c3b6ee0
...
...
@@ -784,8 +784,7 @@ class ClientStorage(object):
self
.
_commit_lock
.
release
()
def
lastTransaction
(
self
):
with
self
.
_lock
:
return
self
.
_cache
.
getLastTid
()
return
self
.
_cache
.
getLastTid
()
def
tpc_abort
(
self
,
txn
,
timeout
=
None
):
"""Storage API: abort a transaction.
...
...
src/ZEO/asyncio/client.py
View file @
8c3b6ee0
...
...
@@ -624,21 +624,6 @@ class Client:
# Special methods because they update the cache.
def
load_threadsafe
(
self
,
future
,
oid
):
data
=
self
.
cache
.
load
(
oid
)
if
data
is
not
None
:
future
.
set_result
(
data
)
elif
self
.
ready
:
@
self
.
protocol
.
promise
(
'loadEx'
,
oid
)
def
load
(
data
):
future
.
set_result
(
data
)
data
,
tid
=
data
self
.
cache
.
store
(
oid
,
tid
,
None
,
data
)
load
.
catch
(
future
.
set_exception
)
else
:
self
.
_when_ready
(
self
.
load_threadsafe
,
future
,
oid
)
def
load_before_threadsafe
(
self
,
future
,
oid
,
tid
):
data
=
self
.
cache
.
loadBefore
(
oid
,
tid
)
if
data
is
not
None
:
...
...
@@ -690,8 +675,8 @@ class Client:
if
self
.
ready
:
for
oid
in
oids
:
self
.
cache
.
invalidate
(
oid
,
tid
)
self
.
cache
.
setLastTid
(
tid
)
self
.
client
.
invalidateTransaction
(
tid
,
oids
)
self
.
cache
.
setLastTid
(
tid
)
def
serialnos
(
self
,
serials
):
# Before delegating, check for errors (likely ConflictErrors)
...
...
@@ -769,9 +754,6 @@ class ClientRunner:
def
async_iter
(
self
,
it
):
return
self
.
__call
(
self
.
client
.
call_async_iter_threadsafe
,
it
)
def
load
(
self
,
oid
):
return
self
.
__call
(
self
.
client
.
load_threadsafe
,
oid
)
def
load_before
(
self
,
oid
,
tid
):
return
self
.
__call
(
self
.
client
.
load_before_threadsafe
,
oid
,
tid
)
...
...
src/ZEO/asyncio/tests.py
View file @
8c3b6ee0
...
...
@@ -15,6 +15,7 @@ import ZEO.Exceptions
from
.testing
import
Loop
from
.client
import
ClientRunner
,
Fallback
from
..Exceptions
import
ClientDisconnected
from
..ClientStorage
import
m64
class
AsyncTests
(
setupstack
.
TestCase
,
ClientRunner
):
...
...
@@ -143,17 +144,17 @@ class AsyncTests(setupstack.TestCase, ClientRunner):
self
.
assertEqual
(
parse
(
transport
.
pop
()),
(
0
,
True
,
'bar'
,
(
3
,
4
)))
# Loading objects gets special handling to leverage the cache.
loaded
=
self
.
load
(
b'1'
*
8
)
loaded
=
self
.
load
_before
(
b'1'
*
8
,
m64
)
# The data wasn't in the cache, so we make a server call:
self
.
assertEqual
(
parse
(
transport
.
pop
()),
(
5
,
False
,
'load
Ex'
,
(
b'1'
*
8
,
)))
respond
(
5
,
(
b'data'
,
b'a'
*
8
))
self
.
assertEqual
(
loaded
.
result
(),
(
b'data'
,
b'a'
*
8
))
(
5
,
False
,
'load
Before'
,
(
b'1'
*
8
,
m64
)))
respond
(
5
,
(
b'data'
,
b'a'
*
8
,
None
))
self
.
assertEqual
(
loaded
.
result
(),
(
b'data'
,
b'a'
*
8
,
None
))
# If we make another request, it will be satisfied from the cache:
loaded
=
self
.
load
(
b'1'
*
8
)
self
.
assertEqual
(
loaded
.
result
(),
(
b'data'
,
b'a'
*
8
))
loaded
=
self
.
load
_before
(
b'1'
*
8
,
m64
)
self
.
assertEqual
(
loaded
.
result
(),
(
b'data'
,
b'a'
*
8
,
None
))
self
.
assertFalse
(
transport
.
data
)
# Let's send an invalidation:
...
...
@@ -162,11 +163,11 @@ class AsyncTests(setupstack.TestCase, ClientRunner):
wrapper
.
invalidateTransaction
.
reset_mock
()
# Now, if we try to load current again, we'll make a server request.
loaded
=
self
.
load
(
b'1'
*
8
)
loaded
=
self
.
load
_before
(
b'1'
*
8
,
m64
)
self
.
assertEqual
(
parse
(
transport
.
pop
()),
(
6
,
False
,
'load
Ex'
,
(
b'1'
*
8
,
)))
respond
(
6
,
(
b'data2'
,
b'b'
*
8
))
self
.
assertEqual
(
loaded
.
result
(),
(
b'data2'
,
b'b'
*
8
))
(
6
,
False
,
'load
Before'
,
(
b'1'
*
8
,
m64
)))
respond
(
6
,
(
b'data2'
,
b'b'
*
8
,
None
))
self
.
assertEqual
(
loaded
.
result
(),
(
b'data2'
,
b'b'
*
8
,
None
))
# Loading non-current data may also be satisfied from cache
loaded
=
self
.
load_before
(
b'1'
*
8
,
b'b'
*
8
)
...
...
@@ -212,11 +213,11 @@ class AsyncTests(setupstack.TestCase, ClientRunner):
# If the protocol is disconnected, it will reconnect and will
# resolve outstanding requests with exceptions:
loaded
=
self
.
load
(
b'1'
*
8
)
loaded
=
self
.
load
_before
(
b'1'
*
8
,
m64
)
f1
=
self
.
call
(
'foo'
,
1
,
2
)
self
.
assertFalse
(
loaded
.
done
()
or
f1
.
done
())
self
.
assertEqual
(
parse
(
transport
.
pop
()),
[(
9
,
False
,
'load
Ex'
,
(
b'1'
*
8
,
)),
[(
9
,
False
,
'load
Before'
,
(
b'1'
*
8
,
m64
)),
(
10
,
False
,
'foo'
,
(
1
,
2
))],
)
exc
=
TypeError
(
43
)
...
...
src/ZEO/tests/testZEO.py
View file @
8c3b6ee0
...
...
@@ -920,12 +920,12 @@ def tpc_finish_error():
>>> addr, admin = start_server()
>>> db = ZEO.DB(addr)
>>> client = ZEO.client(addr)
>>> db = ZODB.DB(client)
>>> conn = db.open()
>>> conn.root.x = 1
>>> t = conn.transaction_manager.get()
>>> client = conn._storage
>>> client.tpc_begin(t)
>>> conn._storage.tpc_begin(t)
>>> conn.commit(t)
>>> _ = client.tpc_vote(t)
...
...
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