|
|
@ -24,6 +24,7 @@ const ( |
|
|
|
SupportSyncing ServiceType = iota |
|
|
|
SupportSyncing ServiceType = iota |
|
|
|
SupportClient |
|
|
|
SupportClient |
|
|
|
SupportExplorer |
|
|
|
SupportExplorer |
|
|
|
|
|
|
|
Consensus |
|
|
|
Test |
|
|
|
Test |
|
|
|
Done |
|
|
|
Done |
|
|
|
) |
|
|
|
) |
|
|
@ -36,6 +37,8 @@ func (t ServiceType) String() string { |
|
|
|
return "SyncingSupport" |
|
|
|
return "SyncingSupport" |
|
|
|
case SupportExplorer: |
|
|
|
case SupportExplorer: |
|
|
|
return "SupportExplorer" |
|
|
|
return "SupportExplorer" |
|
|
|
|
|
|
|
case Consensus: |
|
|
|
|
|
|
|
return "Consensus" |
|
|
|
case Test: |
|
|
|
case Test: |
|
|
|
return "Test" |
|
|
|
return "Test" |
|
|
|
case Done: |
|
|
|
case Done: |
|
|
@ -60,8 +63,8 @@ type Action struct { |
|
|
|
|
|
|
|
|
|
|
|
// ServiceInterface is the collection of functions any service needs to implement.
|
|
|
|
// ServiceInterface is the collection of functions any service needs to implement.
|
|
|
|
type ServiceInterface interface { |
|
|
|
type ServiceInterface interface { |
|
|
|
Start() |
|
|
|
StartService() |
|
|
|
Stop() |
|
|
|
StopService() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ServiceStore stores all services for service manager.
|
|
|
|
// ServiceStore stores all services for service manager.
|
|
|
@ -108,10 +111,10 @@ func (node *Node) TakeAction(action *Action) { |
|
|
|
switch action.action { |
|
|
|
switch action.action { |
|
|
|
case Start: |
|
|
|
case Start: |
|
|
|
fmt.Printf("Start %s\n", action.serviceType) |
|
|
|
fmt.Printf("Start %s\n", action.serviceType) |
|
|
|
service.Start() |
|
|
|
service.StartService() |
|
|
|
case Stop: |
|
|
|
case Stop: |
|
|
|
fmt.Printf("Stop %s\n", action.serviceType) |
|
|
|
fmt.Printf("Stop %s\n", action.serviceType) |
|
|
|
service.Stop() |
|
|
|
service.StopService() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|