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
Jérome Perrin
neoppod
Commits
80eb719e
Commit
80eb719e
authored
Mar 21, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch several master handler to singletons.
parent
ff076765
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
neo/master/app.py
neo/master/app.py
+12
-6
No files found.
neo/master/app.py
View file @
80eb719e
...
@@ -104,6 +104,12 @@ class Application(object):
...
@@ -104,6 +104,12 @@ class Application(object):
self
.
backup_app
=
BackupApplication
(
self
,
upstream_cluster
,
self
.
backup_app
=
BackupApplication
(
self
,
upstream_cluster
,
*
config
.
getUpstreamMasters
())
*
config
.
getUpstreamMasters
())
self
.
administration_handler
=
administration
.
AdministrationHandler
(
self
)
self
.
secondary_master_handler
=
secondary
.
SecondaryMasterHandler
(
self
)
self
.
client_service_handler
=
client
.
ClientServiceHandler
(
self
)
self
.
storage_service_handler
=
storage
.
StorageServiceHandler
(
self
)
registerLiveDebugger
(
on_log
=
self
.
log
)
registerLiveDebugger
(
on_log
=
self
.
log
)
def
close
(
self
):
def
close
(
self
):
...
@@ -388,10 +394,10 @@ class Application(object):
...
@@ -388,10 +394,10 @@ class Application(object):
return
return
# select the storage handler
# select the storage handler
client_handler
=
client
.
ClientServiceHandler
(
self
)
client_handler
=
self
.
client_service_handler
if
state
in
(
ClusterStates
.
RUNNING
,
ClusterStates
.
STARTING_BACKUP
,
if
state
in
(
ClusterStates
.
RUNNING
,
ClusterStates
.
STARTING_BACKUP
,
ClusterStates
.
BACKINGUP
,
ClusterStates
.
STOPPING_BACKUP
):
ClusterStates
.
BACKINGUP
,
ClusterStates
.
STOPPING_BACKUP
):
storage_handler
=
s
torage
.
StorageServiceHandler
(
self
)
storage_handler
=
s
elf
.
storage_service_handler
elif
self
.
_current_manager
is
not
None
:
elif
self
.
_current_manager
is
not
None
:
storage_handler
=
self
.
_current_manager
.
getHandler
()
storage_handler
=
self
.
_current_manager
.
getHandler
()
else
:
else
:
...
@@ -468,7 +474,7 @@ class Application(object):
...
@@ -468,7 +474,7 @@ class Application(object):
if
uuid
is
None
or
node
is
None
:
if
uuid
is
None
or
node
is
None
:
# same as for verification
# same as for verification
state
=
NodeStates
.
PENDING
state
=
NodeStates
.
PENDING
return
state
,
s
torage
.
StorageServiceHandler
(
self
)
return
state
,
s
elf
.
storage_service_handler
def
identifyNode
(
self
,
node_type
,
uuid
,
node
):
def
identifyNode
(
self
,
node_type
,
uuid
,
node
):
...
@@ -477,12 +483,12 @@ class Application(object):
...
@@ -477,12 +483,12 @@ class Application(object):
if
node_type
==
NodeTypes
.
ADMIN
:
if
node_type
==
NodeTypes
.
ADMIN
:
# always accept admin nodes
# always accept admin nodes
node_ctor
=
self
.
nm
.
createAdmin
node_ctor
=
self
.
nm
.
createAdmin
handler
=
administration
.
AdministrationHandler
(
self
)
handler
=
self
.
administration_handler
human_readable_node_type
=
'n admin '
human_readable_node_type
=
'n admin '
elif
node_type
==
NodeTypes
.
MASTER
:
elif
node_type
==
NodeTypes
.
MASTER
:
# always put other master in waiting state
# always put other master in waiting state
node_ctor
=
self
.
nm
.
createMaster
node_ctor
=
self
.
nm
.
createMaster
handler
=
se
condary
.
SecondaryMasterHandler
(
self
)
handler
=
se
lf
.
secondary_master_handler
human_readable_node_type
=
' master '
human_readable_node_type
=
' master '
elif
node_type
==
NodeTypes
.
CLIENT
:
elif
node_type
==
NodeTypes
.
CLIENT
:
# refuse any client before running
# refuse any client before running
...
@@ -490,7 +496,7 @@ class Application(object):
...
@@ -490,7 +496,7 @@ class Application(object):
logging
.
info
(
'Reject a connection from a client'
)
logging
.
info
(
'Reject a connection from a client'
)
raise
NotReadyError
raise
NotReadyError
node_ctor
=
self
.
nm
.
createClient
node_ctor
=
self
.
nm
.
createClient
handler
=
client
.
ClientServiceHandler
(
self
)
handler
=
self
.
client_service_handler
human_readable_node_type
=
' client '
human_readable_node_type
=
' client '
elif
node_type
==
NodeTypes
.
STORAGE
:
elif
node_type
==
NodeTypes
.
STORAGE
:
node_ctor
=
self
.
nm
.
createStorage
node_ctor
=
self
.
nm
.
createStorage
...
...
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