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
7ab14ef7
Commit
7ab14ef7
authored
Jan 19, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically set UUID on connection when setting it on node.
parent
88d76044
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
5 additions
and
11 deletions
+5
-11
neo/client/handlers/master.py
neo/client/handlers/master.py
+1
-3
neo/client/handlers/storage.py
neo/client/handlers/storage.py
+0
-1
neo/lib/bootstrap.py
neo/lib/bootstrap.py
+0
-1
neo/lib/node.py
neo/lib/node.py
+4
-0
neo/master/handlers/identification.py
neo/master/handlers/identification.py
+0
-1
neo/storage/handlers/replication.py
neo/storage/handlers/replication.py
+0
-2
neo/tests/client/testMasterHandler.py
neo/tests/client/testMasterHandler.py
+0
-1
neo/tests/client/testStorageHandler.py
neo/tests/client/testStorageHandler.py
+0
-1
neo/tests/storage/testIdentificationHandler.py
neo/tests/storage/testIdentificationHandler.py
+0
-1
No files found.
neo/client/handlers/master.py
View file @
7ab14ef7
...
@@ -43,9 +43,7 @@ class PrimaryBootstrapHandler(AnswerBaseHandler):
...
@@ -43,9 +43,7 @@ class PrimaryBootstrapHandler(AnswerBaseHandler):
app
.
uuid
=
your_uuid
app
.
uuid
=
your_uuid
neo
.
lib
.
logging
.
info
(
'Got an UUID: %s'
,
dump
(
app
.
uuid
))
neo
.
lib
.
logging
.
info
(
'Got an UUID: %s'
,
dump
(
app
.
uuid
))
node
=
app
.
nm
.
getByAddress
(
conn
.
getAddress
())
app
.
nm
.
getByAddress
(
conn
.
getAddress
()).
setUUID
(
uuid
)
conn
.
setUUID
(
uuid
)
node
.
setUUID
(
uuid
)
# Always create partition table
# Always create partition table
app
.
pt
=
PartitionTable
(
num_partitions
,
num_replicas
)
app
.
pt
=
PartitionTable
(
num_partitions
,
num_replicas
)
...
...
neo/client/handlers/storage.py
View file @
7ab14ef7
...
@@ -57,7 +57,6 @@ class StorageBootstrapHandler(AnswerBaseHandler):
...
@@ -57,7 +57,6 @@ class StorageBootstrapHandler(AnswerBaseHandler):
node
=
self
.
app
.
nm
.
getByAddress
(
conn
.
getAddress
())
node
=
self
.
app
.
nm
.
getByAddress
(
conn
.
getAddress
())
assert
node
is
not
None
,
conn
.
getAddress
()
assert
node
is
not
None
,
conn
.
getAddress
()
conn
.
setUUID
(
uuid
)
node
.
setUUID
(
uuid
)
node
.
setUUID
(
uuid
)
assert
node
.
getConnection
()
is
conn
,
(
node
.
getConnection
(),
conn
)
assert
node
.
getConnection
()
is
conn
,
(
node
.
getConnection
(),
conn
)
...
...
neo/lib/bootstrap.py
View file @
7ab14ef7
...
@@ -119,7 +119,6 @@ class BootstrapManager(EventHandler):
...
@@ -119,7 +119,6 @@ class BootstrapManager(EventHandler):
# got an uuid from the primary master
# got an uuid from the primary master
self
.
uuid
=
your_uuid
self
.
uuid
=
your_uuid
neo
.
lib
.
logging
.
info
(
'Got a new UUID : %s'
%
dump
(
self
.
uuid
))
neo
.
lib
.
logging
.
info
(
'Got a new UUID : %s'
%
dump
(
self
.
uuid
))
conn
.
setUUID
(
uuid
)
self
.
accepted
=
True
self
.
accepted
=
True
def
getPrimaryConnection
(
self
,
connector_handler
):
def
getPrimaryConnection
(
self
,
connector_handler
):
...
...
neo/lib/node.py
View file @
7ab14ef7
...
@@ -86,6 +86,8 @@ class Node(object):
...
@@ -86,6 +86,8 @@ class Node(object):
self
.
_uuid
=
uuid
self
.
_uuid
=
uuid
self
.
_manager
.
_updateUUID
(
self
,
old_uuid
)
self
.
_manager
.
_updateUUID
(
self
,
old_uuid
)
self
.
_manager
.
_updateIdentified
(
self
)
self
.
_manager
.
_updateIdentified
(
self
)
if
self
.
_connection
is
not
None
:
self
.
_connection
.
setUUID
(
uuid
)
def
getUUID
(
self
):
def
getUUID
(
self
):
return
self
.
_uuid
return
self
.
_uuid
...
@@ -104,6 +106,8 @@ class Node(object):
...
@@ -104,6 +106,8 @@ class Node(object):
"""
"""
assert
connection
is
not
None
assert
connection
is
not
None
assert
self
.
_connection
is
None
,
attributeTracker
.
whoSet
(
self
,
'_connection'
)
assert
self
.
_connection
is
None
,
attributeTracker
.
whoSet
(
self
,
'_connection'
)
assert
connection
.
getUUID
()
in
(
None
,
self
.
_uuid
),
connection
connection
.
setUUID
(
self
.
_uuid
)
self
.
_connection
=
connection
self
.
_connection
=
connection
connection
.
setOnClose
(
self
.
onConnectionClosed
)
connection
.
setOnClose
(
self
.
onConnectionClosed
)
self
.
_manager
.
_updateIdentified
(
self
)
self
.
_manager
.
_updateIdentified
(
self
)
...
...
neo/master/handlers/identification.py
View file @
7ab14ef7
...
@@ -59,7 +59,6 @@ class IdentificationHandler(MasterHandler):
...
@@ -59,7 +59,6 @@ class IdentificationHandler(MasterHandler):
node
.
setState
(
state
)
node
.
setState
(
state
)
node
.
setConnection
(
conn
)
node
.
setConnection
(
conn
)
# set up the connection
# set up the connection
conn
.
setUUID
(
uuid
)
conn
.
setHandler
(
handler
)
conn
.
setHandler
(
handler
)
# answer
# answer
args
=
(
NodeTypes
.
MASTER
,
app
.
uuid
,
app
.
pt
.
getPartitions
(),
args
=
(
NodeTypes
.
MASTER
,
app
.
uuid
,
app
.
pt
.
getPartitions
(),
...
...
neo/storage/handlers/replication.py
View file @
7ab14ef7
...
@@ -94,8 +94,6 @@ class ReplicationHandler(EventHandler):
...
@@ -94,8 +94,6 @@ class ReplicationHandler(EventHandler):
def
acceptIdentification
(
self
,
conn
,
node_type
,
def
acceptIdentification
(
self
,
conn
,
node_type
,
uuid
,
num_partitions
,
num_replicas
,
your_uuid
):
uuid
,
num_partitions
,
num_replicas
,
your_uuid
):
# set the UUID on the connection
conn
.
setUUID
(
uuid
)
self
.
startReplication
(
conn
)
self
.
startReplication
(
conn
)
def
startReplication
(
self
,
conn
):
def
startReplication
(
self
,
conn
):
...
...
neo/tests/client/testMasterHandler.py
View file @
7ab14ef7
...
@@ -78,7 +78,6 @@ class MasterBootstrapHandlerTests(MasterHandlerTests):
...
@@ -78,7 +78,6 @@ class MasterBootstrapHandlerTests(MasterHandlerTests):
self
.
handler
.
acceptIdentification
(
conn
,
NodeTypes
.
MASTER
,
uuid
,
self
.
handler
.
acceptIdentification
(
conn
,
NodeTypes
.
MASTER
,
uuid
,
partitions
,
replicas
,
your_uuid
)
partitions
,
replicas
,
your_uuid
)
self
.
assertEqual
(
self
.
app
.
uuid
,
your_uuid
)
self
.
assertEqual
(
self
.
app
.
uuid
,
your_uuid
)
self
.
checkUUIDSet
(
conn
,
uuid
)
self
.
checkUUIDSet
(
node
,
uuid
)
self
.
checkUUIDSet
(
node
,
uuid
)
self
.
assertTrue
(
isinstance
(
self
.
app
.
pt
,
PartitionTable
))
self
.
assertTrue
(
isinstance
(
self
.
app
.
pt
,
PartitionTable
))
...
...
neo/tests/client/testStorageHandler.py
View file @
7ab14ef7
...
@@ -62,7 +62,6 @@ class StorageBootstrapHandlerTests(NeoUnitTestBase):
...
@@ -62,7 +62,6 @@ class StorageBootstrapHandlerTests(NeoUnitTestBase):
self
.
handler
.
acceptIdentification
(
conn
,
NodeTypes
.
STORAGE
,
uuid
,
self
.
handler
.
acceptIdentification
(
conn
,
NodeTypes
.
STORAGE
,
uuid
,
10
,
0
,
None
)
10
,
0
,
None
)
self
.
checkUUIDSet
(
node
,
uuid
)
self
.
checkUUIDSet
(
node
,
uuid
)
self
.
checkUUIDSet
(
conn
,
uuid
)
class
StorageAnswerHandlerTests
(
NeoUnitTestBase
):
class
StorageAnswerHandlerTests
(
NeoUnitTestBase
):
...
...
neo/tests/storage/testIdentificationHandler.py
View file @
7ab14ef7
...
@@ -89,7 +89,6 @@ class StorageIdentificationHandlerTests(NeoUnitTestBase):
...
@@ -89,7 +89,6 @@ class StorageIdentificationHandlerTests(NeoUnitTestBase):
self
.
assertTrue
(
node
.
isConnected
())
self
.
assertTrue
(
node
.
isConnected
())
self
.
assertEqual
(
node
.
getUUID
(),
uuid
)
self
.
assertEqual
(
node
.
getUUID
(),
uuid
)
self
.
assertTrue
(
node
.
getConnection
()
is
conn
)
self
.
assertTrue
(
node
.
getConnection
()
is
conn
)
self
.
checkUUIDSet
(
conn
,
uuid
)
args
=
self
.
checkAcceptIdentification
(
conn
,
decode
=
True
)
args
=
self
.
checkAcceptIdentification
(
conn
,
decode
=
True
)
node_type
,
address
,
_np
,
_nr
,
_uuid
=
args
node_type
,
address
,
_np
,
_nr
,
_uuid
=
args
self
.
assertEqual
(
node_type
,
NodeTypes
.
STORAGE
)
self
.
assertEqual
(
node_type
,
NodeTypes
.
STORAGE
)
...
...
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