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
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
Stefane Fermigier
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
Show 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):
...
@@ -76,8 +76,6 @@ class Application(object):
# ready is True when operational and got all informations
# ready is True when operational and got all informations
self
.
ready
=
False
self
.
ready
=
False
self
.
has_node_information
=
False
self
.
has_partition_table
=
False
self
.
dm
.
setup
(
reset
=
config
.
getReset
())
self
.
dm
.
setup
(
reset
=
config
.
getReset
())
self
.
loadConfiguration
()
self
.
loadConfiguration
()
...
@@ -278,15 +276,11 @@ class Application(object):
...
@@ -278,15 +276,11 @@ class Application(object):
self
.
master_conn
.
setHandler
(
handler
)
self
.
master_conn
.
setHandler
(
handler
)
# ask node list and partition table
# 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
.
pt
.
clear
()
self
.
master_conn
.
ask
(
Packets
.
AskLastIDs
())
self
.
master_conn
.
ask
(
Packets
.
AskLastIDs
())
self
.
master_conn
.
ask
(
Packets
.
AskNodeInformation
())
self
.
master_conn
.
ask
(
Packets
.
AskNodeInformation
())
self
.
master_conn
.
ask
(
Packets
.
AskPartitionTable
())
self
.
master_conn
.
ask
(
Packets
.
AskPartitionTable
())
while
not
self
.
has_node_information
or
not
self
.
has_partition_table
\
while
self
.
master_conn
.
isPending
():
or
not
self
.
has_last_ids
:
_poll
()
_poll
()
self
.
ready
=
True
self
.
ready
=
True
self
.
replicator
.
populate
()
self
.
replicator
.
populate
()
...
...
neo/storage/handlers/initialization.py
View file @
0a511052
...
@@ -23,7 +23,7 @@ from neo.lib import protocol
...
@@ -23,7 +23,7 @@ from neo.lib import protocol
class
InitializationHandler
(
BaseMasterHandler
):
class
InitializationHandler
(
BaseMasterHandler
):
def
answerNodeInformation
(
self
,
conn
):
def
answerNodeInformation
(
self
,
conn
):
self
.
app
.
has_node_information
=
True
pass
def
notifyNodeInformation
(
self
,
conn
,
node_list
):
def
notifyNodeInformation
(
self
,
conn
,
node_list
):
# the whole node list is received here
# the whole node list is received here
...
@@ -53,11 +53,9 @@ class InitializationHandler(BaseMasterHandler):
...
@@ -53,11 +53,9 @@ class InitializationHandler(BaseMasterHandler):
app
.
dm
.
dropPartitions
(
num_partitions
,
unassigned_set
)
app
.
dm
.
dropPartitions
(
num_partitions
,
unassigned_set
)
app
.
dm
.
setPartitionTable
(
ptid
,
cell_list
)
app
.
dm
.
setPartitionTable
(
ptid
,
cell_list
)
self
.
app
.
has_partition_table
=
True
def
answerLastIDs
(
self
,
conn
,
loid
,
ltid
,
lptid
):
def
answerLastIDs
(
self
,
conn
,
loid
,
ltid
,
lptid
):
self
.
app
.
dm
.
setLastOID
(
loid
)
self
.
app
.
dm
.
setLastOID
(
loid
)
self
.
app
.
has_last_ids
=
True
def
notifyPartitionChanges
(
self
,
conn
,
ptid
,
cell_list
):
def
notifyPartitionChanges
(
self
,
conn
,
ptid
,
cell_list
):
# XXX: This is safe to ignore those notifications because all of the
# 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
...
@@ -24,9 +24,6 @@ from . import BaseMasterHandler
class
MasterOperationHandler
(
BaseMasterHandler
):
class
MasterOperationHandler
(
BaseMasterHandler
):
""" This handler is used for the primary master """
""" 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
):
def
answerUnfinishedTransactions
(
self
,
conn
,
max_tid
,
ttid_list
):
self
.
app
.
replicator
.
setUnfinishedTIDList
(
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):
...
@@ -164,20 +164,6 @@ class StorageMasterHandlerTests(NeoUnitTestBase):
calls
[
0
].
checkArgs
(
tid
)
calls
[
0
].
checkArgs
(
tid
)
self
.
checkNoPacketSent
(
conn
)
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
):
def
test_31_answerUnfinishedTransactions
(
self
):
# set unfinished TID on replicator
# set unfinished TID on replicator
conn
=
self
.
getFakeConnection
()
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