This repository has been archived by the owner on Jul 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ciao-launcher: refactor instance go routine code
The code for the instance go routine is split over a number of different files. These files have been renamed to make it obvious in which context their code runs. Code that is not unique to the instance go routine, i.e., the error types for specific commands has been moved to new files. Fixes: #10 Signed-off-by: Mark Ryan <[email protected]>
- Loading branch information
Mark Ryan
committed
Jun 27, 2016
1 parent
aa1d0e3
commit 57fd2b3
Showing
7 changed files
with
135 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
// Copyright (c) 2016 Intel Corporation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/01org/ciao/payloads" | ||
"github.com/01org/ciao/ssntp" | ||
"github.com/golang/glog" | ||
) | ||
|
||
type deleteError struct { | ||
err error | ||
code payloads.DeleteFailureReason | ||
} | ||
|
||
func (de *deleteError) send(conn serverConn, instance string) { | ||
if !conn.isConnected() { | ||
return | ||
} | ||
|
||
payload, err := generateDeleteError(instance, de) | ||
if err != nil { | ||
glog.Errorf("Unable to generate payload for delete_failure: %v", err) | ||
return | ||
} | ||
|
||
_, err = conn.SendError(ssntp.DeleteFailure, payload) | ||
if err != nil { | ||
glog.Errorf("Unable to send delete_failure: %v", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
// Copyright (c) 2016 Intel Corporation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/01org/ciao/payloads" | ||
"github.com/01org/ciao/ssntp" | ||
"github.com/golang/glog" | ||
) | ||
|
||
type restartError struct { | ||
err error | ||
code payloads.RestartFailureReason | ||
} | ||
|
||
func (re *restartError) send(conn serverConn, instance string) { | ||
if !conn.isConnected() { | ||
return | ||
} | ||
|
||
payload, err := generateRestartError(instance, re) | ||
if err != nil { | ||
glog.Errorf("Unable to generate payload for restart_failure: %v", err) | ||
return | ||
} | ||
|
||
_, err = conn.SendError(ssntp.RestartFailure, payload) | ||
if err != nil { | ||
glog.Errorf("Unable to send restart_failure: %v", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
// Copyright (c) 2016 Intel Corporation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/01org/ciao/payloads" | ||
"github.com/01org/ciao/ssntp" | ||
"github.com/golang/glog" | ||
) | ||
|
||
type startError struct { | ||
err error | ||
code payloads.StartFailureReason | ||
} | ||
|
||
func (se *startError) send(conn serverConn, instance string) { | ||
if !conn.isConnected() { | ||
return | ||
} | ||
|
||
payload, err := generateStartError(instance, se) | ||
if err != nil { | ||
glog.Errorf("Unable to generate payload for start_failure: %v", err) | ||
return | ||
} | ||
|
||
_, err = conn.SendError(ssntp.StartFailure, payload) | ||
if err != nil { | ||
glog.Errorf("Unable to send start_failure: %v", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.