Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
neoppod
Commits
a8f9fedb
Commit
a8f9fedb
authored
Dec 23, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: simplify Transaction API
parent
87eee431
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
109 deletions
+58
-109
neo/storage/handlers/client.py
neo/storage/handlers/client.py
+2
-3
neo/storage/transactions.py
neo/storage/transactions.py
+55
-95
neo/tests/storage/testTransactions.py
neo/tests/storage/testTransactions.py
+1
-11
No files found.
neo/storage/handlers/client.py
View file @
a8f9fedb
...
...
@@ -77,7 +77,7 @@ class ClientOperationHandler(EventHandler):
checksum
,
data
,
data_serial
,
unlock
)
except
ConflictError
,
err
:
# resolvable or not
conn
.
answer
(
Packets
.
AnswerStoreObject
(
1
,
oid
,
err
.
getTID
()
))
conn
.
answer
(
Packets
.
AnswerStoreObject
(
1
,
oid
,
err
.
tid
))
except
DelayedError
:
# locked by a previous transaction, retry later
# If we are unlocking, we want queueEvent to raise
...
...
@@ -194,8 +194,7 @@ class ClientOperationHandler(EventHandler):
self
.
app
.
tm
.
checkCurrentSerial
(
ttid
,
serial
,
oid
)
except
ConflictError
,
err
:
# resolvable or not
conn
.
answer
(
Packets
.
AnswerCheckCurrentSerial
(
1
,
oid
,
err
.
getTID
()))
conn
.
answer
(
Packets
.
AnswerCheckCurrentSerial
(
1
,
oid
,
err
.
tid
))
except
DelayedError
:
# locked by a previous transaction, retry later
try
:
...
...
neo/storage/transactions.py
View file @
a8f9fedb
This diff is collapsed.
Click to expand it.
neo/tests/storage/testTransactions.py
View file @
a8f9fedb
...
...
@@ -17,19 +17,9 @@
import
unittest
from
mock
import
Mock
from
..
import
NeoUnitTestBase
from
neo.storage.transactions
import
Transaction
,
Transaction
Manager
from
neo.storage.transactions
import
TransactionManager
class
TransactionTests
(
NeoUnitTestBase
):
def
testLock
(
self
):
txn
=
Transaction
(
self
.
getClientUUID
(),
self
.
getNextTID
())
self
.
assertFalse
(
txn
.
isLocked
())
txn
.
lock
()
self
.
assertTrue
(
txn
.
isLocked
())
# disallow lock more than once
self
.
assertRaises
(
AssertionError
,
txn
.
lock
)
class
TransactionManagerTests
(
NeoUnitTestBase
):
def
setUp
(
self
):
...
...
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