value := make(map[string]interface{})
- value[KeyAppName] = appName
- value[KeyServiceName] = serviceName
- value[KeyCmd] = cmd
- value[KeyMsgChan] = msgChan
- value[KeyCtlChan] = ctlChan
+ value[ConstKeyAppName] = appName
+ value[ConstKeyServiceName] = serviceName
+ value[ConstKeyCmd] = cmd
+ value[ConstKeyMsgChan] = msgChan
+ value[ConstKeyCtlChan] = ctlChan
ServiceMap.Set(serviceID, value)
func GetAppName(serviceID uint64) (string, error) {
value, _ := ServiceMap.Get(serviceID)
if value == nil {
- return "", errInvalidService
+ return "", ErrInvalidService
}
valueList := value.(map[string]interface{})
- return valueList[KeyAppName].(string), nil
+ return valueList[ConstKeyAppName].(string), nil
}
// GetServiceName function
func GetServiceName(serviceID uint64) (string, error) {
value, _ := ServiceMap.Get(serviceID)
if value == nil {
- return "", errInvalidService
+ return "", ErrInvalidService
}
valueList := value.(map[string]interface{})
- return valueList[KeyServiceName].(string), nil
+ return valueList[ConstKeyServiceName].(string), nil
}
// GetCmd function
func GetCmd(serviceID uint64) (*exec.Cmd, error) {
value, _ := ServiceMap.Get(serviceID)
if value == nil {
- return nil, errInvalidService
+ return nil, ErrInvalidService
}
valueList := value.(map[string]interface{})
- return valueList[KeyCmd].(*exec.Cmd), nil
+ return valueList[ConstKeyCmd].(*exec.Cmd), nil
}
// SetCmd function
func SetCmd(serviceID uint64, cmd *exec.Cmd) error {
value, _ := ServiceMap.Get(serviceID)
if value == nil {
- return errInvalidService
+ return ErrInvalidService
}
valueList := value.(map[string]interface{})
- valueList[KeyCmd] = cmd
+ valueList[ConstKeyCmd] = cmd
return nil
}
-// GetMsgChan function
-func GetMsgChan(serviceID uint64) (chan MsgFormat, error) {
- value, _ := ServiceMap.Get(serviceID)
- if value == nil {
- return nil, errInvalidService
- }
-
- valueList := value.(map[string]interface{})
- return valueList[KeyMsgChan].(chan MsgFormat), nil
-}
-
-// GetCtlChan function
-func GetCtlChan(serviceID uint64) (chan bool, error) {
- value, _ := ServiceMap.Get(serviceID)
- if value == nil {
- return nil, errInvalidService
- }
-
- valueList := value.(map[string]interface{})
- return valueList[KeyCtlChan].(chan bool), nil
-}
+// @TODO GetMsgChan function
+// func GetMsgChan(serviceID uint64) (chan MsgFormat, error) {
+// value, _ := ServiceMap.Get(serviceID)
+// if value == nil {
+// return nil, ErrInvalidService
+// }
+
+// valueList := value.(map[string]interface{})
+// return valueList[ConstKeyMsgChan].(chan MsgFormat), nil
+// }
+
+// @TODO GetCtlChan function
+// func GetCtlChan(serviceID uint64) (chan bool, error) {
+// value, _ := ServiceMap.Get(serviceID)
+// if value == nil {
+// return nil, ErrInvalidService
+// }
+
+// valueList := value.(map[string]interface{})
+// return valueList[ConstKeyCtlChan].(chan bool), nil
+// }
// getServiceIdx() is for getting global serviceID
func getServiceIdx() uint64 {
// DistService structure
type DistService struct {
- SystemParam SystemParam `json:"SystemParam"`
- UserParam UserParam `json:"UserParam"`
+ UserArgs []string `json:"UserArgs"`
+ SystemArgs []string `json:"SystemArgs"`
+ RelatedArgs []RelatedService `json:"RelatedServices"`
}
-// SystemParam structure
-type SystemParam struct {
- IP string `json:"IP"`
- Port int `json:"Port"`
-}
-
-// UserParam structure
-type UserParam struct {
- Args []string `json:"Args"`
+// RelatedService structrue
+type RelatedService struct {
+ ServiceName string `json:"ServiceName"`
+ ServiceID uint64 `json:"ServiceID"`
+ ServiceType string `json:"ServiceType"`
+ IPAddr string `json:"IPAddr"`
+ Port int `json:"Port"`
}
// ErrorType structure
ErrorCode string `json:"ErrorCode"`
}
-// ServiceCreationResponse structure
-type ServiceCreationResponse struct {
- Return string `json:"Return"`
+// ServiceExecutionResponse structure
+type ServiceExecutionResponse struct {
+ Status string `json:"Status"`
}
// ServiceDestroyResponse structure
type ServiceDestroyResponse struct {
- Return string `json:"return"`
+ Return string `json:"Return"`
}
-// ServiceExecutionResponse structure
-type ServiceExecutionResponse struct {
- ServiceList []ServiceExecutionItem `json:"ServiceList"`
+// ServiceCreationResponse structure
+type ServiceCreationResponse struct {
+ Status string `json:"Status"`
+ ServiceList []ServiceCreationResponseItem `json:"ServiceList"`
}
-// ServiceExecutionItem structure
-type ServiceExecutionItem struct {
+// ServiceCreationResponseItem structure
+type ServiceCreationResponseItem struct {
ID uint64 `json:"ID"`
Time string `json:"Time"`
}