oc-lib
This commit is contained in:
@@ -177,6 +177,11 @@ const (
|
||||
PB_PVC_CONFIG
|
||||
PB_CLOSE_SEARCH
|
||||
NONE
|
||||
PB_OBSERVE
|
||||
PB_OBSERVE_CLOSE
|
||||
// PB_PROPAGATE is used by oc-discovery to broadcast a peer's online/offline
|
||||
// state to other oc-discovery nodes in the federation via PROPALGATION_EVENT.
|
||||
PB_PROPAGATE
|
||||
)
|
||||
|
||||
func GetActionString(ss string) PubSubAction {
|
||||
@@ -203,14 +208,40 @@ func GetActionString(ss string) PubSubAction {
|
||||
return PB_MINIO_CONFIG
|
||||
case "close_search":
|
||||
return PB_CLOSE_SEARCH
|
||||
case "observe":
|
||||
return PB_OBSERVE
|
||||
case "observe_close":
|
||||
return PB_OBSERVE_CLOSE
|
||||
case "propagate":
|
||||
return PB_PROPAGATE
|
||||
default:
|
||||
return NONE
|
||||
}
|
||||
}
|
||||
|
||||
var path = []string{"search", "search_response", "create", "update", "delete", "planner", "close_planner",
|
||||
"considers", "admiralty_config", "minio_config", "close_search"}
|
||||
// path aligns with PubSubAction iota values for String().
|
||||
var path = []string{
|
||||
"search", // 0 PB_SEARCH
|
||||
"search_response", // 1 PB_SEARCH_RESPONSE
|
||||
"create", // 2 PB_CREATE
|
||||
"update", // 3 PB_UPDATE
|
||||
"delete", // 4 PB_DELETE
|
||||
"planner", // 5 PB_PLANNER
|
||||
"close_planner", // 6 PB_CLOSE_PLANNER
|
||||
"considers", // 7 PB_CONSIDERS
|
||||
"admiralty_config", // 8 PB_ADMIRALTY_CONFIG
|
||||
"minio_config", // 9 PB_MINIO_CONFIG
|
||||
"pvc_config", // 10 PB_PVC_CONFIG
|
||||
"close_search", // 11 PB_CLOSE_SEARCH
|
||||
"none", // 12 NONE
|
||||
"observe", // 13 PB_OBSERVE
|
||||
"observe_close", // 14 PB_OBSERVE_CLOSE
|
||||
"propagate", // 15 PB_PROPAGATE
|
||||
}
|
||||
|
||||
func (m PubSubAction) String() string {
|
||||
if int(m) >= len(path) {
|
||||
return "unknown"
|
||||
}
|
||||
return strings.ToUpper(path[m])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user