Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
0a511052
Commit
0a511052
authored
Jan 16, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: code simplication, dead code removal
parent
900d4908
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
27 deletions
+2
-27
neo/storage/app.py
neo/storage/app.py
+1
-7
neo/storage/handlers/initialization.py
neo/storage/handlers/initialization.py
+1
-3
neo/storage/handlers/master.py
neo/storage/handlers/master.py
+0
-3
neo/tests/storage/testMasterHandler.py
neo/tests/storage/testMasterHandler.py
+0
-14
No files found.
neo/storage/app.py
View file @
0a511052
...
...
@@ -76,8 +76,6 @@ class Application(object):
# ready is True when operational and got all informations
self
.
ready
=
False
self
.
has_node_information
=
False
self
.
has_partition_table
=
False
self
.
dm
.
setup
(
reset
=
config
.
getReset
())
self
.
loadConfiguration
()
...
...
@@ -278,15 +276,11 @@ class Application(object):
self
.
master_conn
.
setHandler
(
handler
)
# ask node list and partition table
self
.
has_node_information
=
False
self
.
has_partition_table
=
False
self
.
has_last_ids
=
False
self
.
pt
.
clear
()
self
.
master_conn
.
ask
(
Packets
.
AskLastIDs
())
self
.
master_conn
.
ask
(
Packets
.
AskNodeInformation
())
self
.
master_conn
.
ask
(
Packets
.
AskPartitionTable
())
while
not
self
.
has_node_information
or
not
self
.
has_partition_table
\
or
not
self
.
has_last_ids
:
while
self
.
master_conn
.
isPending
():
_poll
()
self
.
ready
=
True
self
.
replicator
.
populate
()
...
...
neo/storage/handlers/initialization.py
View file @
0a511052
...
...
@@ -23,7 +23,7 @@ from neo.lib import protocol
class
InitializationHandler
(
BaseMasterHandler
):
def
answerNodeInformation
(
self
,
conn
):
self
.
app
.
has_node_information
=
True
pass
def
notifyNodeInformation
(
self
,
conn
,
node_list
):
# the whole node list is received here
...
...
@@ -53,11 +53,9 @@ class InitializationHandler(BaseMasterHandler):
app
.
dm
.
dropPartitions
(
num_partitions
,
unassigned_set
)
app
.
dm
.
setPartitionTable
(
ptid
,
cell_list
)
self
.
app
.
has_partition_table
=
True
def
answerLastIDs
(
self
,
conn
,
loid
,
ltid
,
lptid
):
self
.
app
.
dm
.
setLastOID
(
loid
)
self
.
app
.
has_last_ids
=
True
def
notifyPartitionChanges
(
self
,
conn
,
ptid
,
cell_list
):
# XXX: This is safe to ignore those notifications because all of the
...
...
neo/storage/handlers/master.py
View file @
0a511052
...
...
@@ -24,9 +24,6 @@ from . import BaseMasterHandler
class
MasterOperationHandler
(
BaseMasterHandler
):
""" This handler is used for the primary master """
def
answerLastIDs
(
self
,
conn
,
loid
,
ltid
,
lptid
):
self
.
app
.
replicator
.
setCriticalTID
(
ltid
)
def
answerUnfinishedTransactions
(
self
,
conn
,
max_tid
,
ttid_list
):
self
.
app
.
replicator
.
setUnfinishedTIDList
(
max_tid
,
ttid_list
)
...
...
neo/tests/storage/testMasterHandler.py
View file @
0a511052
...
...
@@ -164,20 +164,6 @@ class StorageMasterHandlerTests(NeoUnitTestBase):
calls
[
0
].
checkArgs
(
tid
)
self
.
checkNoPacketSent
(
conn
)
def
test_30_answerLastIDs
(
self
):
# set critical TID on replicator
conn
=
self
.
getFakeConnection
()
self
.
app
.
replicator
=
Mock
()
self
.
operation
.
answerLastIDs
(
conn
=
conn
,
loid
=
INVALID_OID
,
ltid
=
INVALID_TID
,
lptid
=
INVALID_TID
,
)
calls
=
self
.
app
.
replicator
.
mockGetNamedCalls
(
'setCriticalTID'
)
self
.
assertEqual
(
len
(
calls
),
1
)
calls
[
0
].
checkArgs
(
INVALID_TID
)
def
test_31_answerUnfinishedTransactions
(
self
):
# set unfinished TID on replicator
conn
=
self
.
getFakeConnection
()
...
...
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