Nats Native Behaviors + Peer is Stateless
This commit is contained in:
@@ -14,19 +14,20 @@ import (
|
||||
)
|
||||
|
||||
type NATSResponse struct {
|
||||
FromApp string `json:"from_app"`
|
||||
Datatype DataType `json:"datatype"`
|
||||
User string `json:"user"`
|
||||
Method int `json:"method"`
|
||||
Payload []byte `json:"payload"`
|
||||
FromApp string `json:"from_app"`
|
||||
Datatype DataType `json:"datatype"`
|
||||
User string `json:"user"`
|
||||
Method int `json:"method"`
|
||||
SearchAttr string `json:"search_attr"`
|
||||
Payload []byte `json:"payload"`
|
||||
}
|
||||
|
||||
// NATS Method Enum defines the different methods that can be used to interact with the NATS server
|
||||
type NATSMethod int
|
||||
|
||||
var meths = []string{"remove execution", "create execution", "discovery",
|
||||
"workflow event", "remove peer", "create peer", "create resource", "remove resource", "verify_resource",
|
||||
"propalgation event", "catalogsearch event",
|
||||
"workflow event", "create resource", "remove resource",
|
||||
"propalgation event", "catalog search event",
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -35,12 +36,8 @@ const (
|
||||
DISCOVERY
|
||||
WORKFLOW_EVENT
|
||||
|
||||
REMOVE_PEER
|
||||
CREATE_PEER
|
||||
|
||||
CREATE_RESOURCE
|
||||
REMOVE_RESOURCE
|
||||
VERIFY_RESOURCE
|
||||
|
||||
PROPALGATION_EVENT
|
||||
CATALOG_SEARCH_EVENT
|
||||
@@ -53,7 +50,7 @@ func (n NATSMethod) String() string {
|
||||
// NameToMethod returns the NATSMethod enum value from a string
|
||||
func NameToMethod(name string) NATSMethod {
|
||||
for _, v := range [...]NATSMethod{REMOVE_EXECUTION, CREATE_EXECTUTION, DISCOVERY, WORKFLOW_EVENT,
|
||||
REMOVE_PEER, CREATE_PEER, CREATE_RESOURCE, REMOVE_RESOURCE, VERIFY_RESOURCE, PROPALGATION_EVENT, CATALOG_SEARCH_EVENT} {
|
||||
CREATE_RESOURCE, REMOVE_RESOURCE, PROPALGATION_EVENT, CATALOG_SEARCH_EVENT} {
|
||||
if strings.Contains(strings.ToLower(v.String()), strings.ToLower(name)) {
|
||||
return v
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user