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
6f3ac9bf
Commit
6f3ac9bf
authored
May 09, 2001
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for transactionalUndo
parent
dc9cae12
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
src/ZEO/ClientStorage.py
src/ZEO/ClientStorage.py
+15
-1
src/ZEO/StorageServer.py
src/ZEO/StorageServer.py
+9
-1
No files found.
src/ZEO/ClientStorage.py
View file @
6f3ac9bf
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Network ZODB storage client
"""
__version__
=
'$Revision: 1.3
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
1
$'
[
11
:
-
2
]
import
struct
,
time
,
os
,
socket
,
string
,
Sync
,
zrpc
,
ClientCache
import
tempfile
,
Invalidator
,
ExtensionClass
,
thread
...
...
@@ -429,6 +429,8 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage):
def
supportsUndo
(
self
):
return
self
.
_info
[
'supportsUndo'
]
def
supportsVersions
(
self
):
return
self
.
_info
[
'supportsVersions'
]
def
supportsTransactionalUndo
(
self
):
return
self
.
_info
[
'supportsTransactionalUndo'
]
def
tpc_abort
(
self
,
transaction
):
self
.
_lock_acquire
()
...
...
@@ -547,6 +549,18 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage):
self
.
_commit_lock_release
()
finally
:
self
.
_lock_release
()
def
transactionalUndo
(
self
,
trans_id
,
trans
):
self
.
_lock_acquire
()
try
:
if
trans
is
not
self
.
_transaction
:
raise
POSException
.
StorageTransactionError
(
self
,
transaction
)
oids
=
self
.
_call
(
'transactionalUndo'
,
trans_id
,
self
.
_serial
)
for
oid
in
oids
:
# write invalidation records with no version
self
.
_tfile
.
write
(
"i%s
\
000
\
000
"
%
oid
)
return
oids
finally
:
self
.
_lock_release
()
def
undo
(
self
,
transaction_id
):
self
.
_lock_acquire
()
try
:
...
...
src/ZEO/StorageServer.py
View file @
6f3ac9bf
...
...
@@ -83,7 +83,7 @@
#
##############################################################################
__version__
=
"$Revision: 1.2
5
$"
[
11
:
-
2
]
__version__
=
"$Revision: 1.2
6
$"
[
11
:
-
2
]
import
asyncore
,
socket
,
string
,
sys
,
os
from
smac
import
SizedMessageAsyncConnection
...
...
@@ -201,6 +201,7 @@ for n in (
'modifiedInVersion'
,
'new_oid'
,
'new_oids'
,
'pack'
,
'store'
,
'storea'
,
'tpc_abort'
,
'tpc_begin'
,
'tpc_begin_sync'
,
'tpc_finish'
,
'undo'
,
'undoLog'
,
'undoInfo'
,
'versionEmpty'
,
'versions'
,
'transactionalUndo'
,
'vote'
,
'zeoLoad'
,
'zeoVerify'
,
'beginZeoVerify'
,
'endZeoVerify'
,
):
storage_methods
[
n
]
=
1
...
...
@@ -320,6 +321,7 @@ class ZEOConnection(SizedMessageAsyncConnection):
'name'
:
storage
.
getName
(),
'supportsUndo'
:
storage
.
supportsUndo
(),
'supportsVersions'
:
storage
.
supportsVersions
(),
'supportsTransactionalUndo'
:
storage
.
supportsTransactionalUndo
(),
}
def
get_size_info
(
self
):
...
...
@@ -451,6 +453,12 @@ class ZEOConnection(SizedMessageAsyncConnection):
if
t
is
None
or
id
!=
t
.
id
:
raise
POSException
.
StorageTransactionError
(
self
,
id
)
return
self
.
__storage
.
tpc_vote
(
t
)
def
transactionalUndo
(
self
,
trans_id
,
id
):
t
=
self
.
_transaction
if
t
is
None
or
id
!=
t
.
id
:
raise
POSException
.
StorageTransactionError
(
self
,
id
)
return
self
.
__storage
.
transactionalUndo
(
trans_id
,
self
.
_transaction
)
def
undo
(
self
,
transaction_id
):
oids
=
self
.
__storage
.
undo
(
transaction_id
)
...
...
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