mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
Renamed CLICommandRequestNOSEQ to REQnCliCommand
This commit is contained in:
parent
4a7f1fff43
commit
debd146f28
7 changed files with 38 additions and 37 deletions
|
@ -96,6 +96,7 @@ type Configuration struct {
|
||||||
SubscribersDataFolder string
|
SubscribersDataFolder string
|
||||||
// central node to receive messages published from nodes
|
// central node to receive messages published from nodes
|
||||||
CentralNodeName string
|
CentralNodeName string
|
||||||
|
|
||||||
// Start the central error logger.
|
// Start the central error logger.
|
||||||
// Takes a comma separated string of nodes to receive from or "*" for all nodes.
|
// Takes a comma separated string of nodes to receive from or "*" for all nodes.
|
||||||
StartSubErrorLog flagNodeSlice
|
StartSubErrorLog flagNodeSlice
|
||||||
|
@ -109,8 +110,8 @@ type Configuration struct {
|
||||||
StartSubEchoReply flagNodeSlice
|
StartSubEchoReply flagNodeSlice
|
||||||
// Subscriber for CLICommandRequest
|
// Subscriber for CLICommandRequest
|
||||||
StartSubREQCliCommand flagNodeSlice
|
StartSubREQCliCommand flagNodeSlice
|
||||||
// Subscriber for CLICommandRequestNOSEQ
|
// Subscriber for REQnCliCommand
|
||||||
StartSubCLICommandRequestNOSEQ flagNodeSlice
|
StartSubREQnCliCommand flagNodeSlice
|
||||||
// Subscriber for CLICommandReply
|
// Subscriber for CLICommandReply
|
||||||
StartSubCLICommandReply flagNodeSlice
|
StartSubCLICommandReply flagNodeSlice
|
||||||
}
|
}
|
||||||
|
@ -138,7 +139,7 @@ func newConfigurationDefaults() Configuration {
|
||||||
StartSubEchoRequest: flagNodeSlice{OK: true, Values: []node{"*"}},
|
StartSubEchoRequest: flagNodeSlice{OK: true, Values: []node{"*"}},
|
||||||
StartSubEchoReply: flagNodeSlice{OK: true, Values: []node{"*"}},
|
StartSubEchoReply: flagNodeSlice{OK: true, Values: []node{"*"}},
|
||||||
StartSubREQCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}},
|
StartSubREQCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}},
|
||||||
StartSubCLICommandRequestNOSEQ: flagNodeSlice{OK: true, Values: []node{"*"}},
|
StartSubREQnCliCommand: flagNodeSlice{OK: true, Values: []node{"*"}},
|
||||||
StartSubCLICommandReply: flagNodeSlice{OK: true, Values: []node{"*"}},
|
StartSubCLICommandReply: flagNodeSlice{OK: true, Values: []node{"*"}},
|
||||||
}
|
}
|
||||||
return c
|
return c
|
||||||
|
@ -177,7 +178,7 @@ func (c *Configuration) CheckFlags() error {
|
||||||
flag.Var(&c.StartSubEchoRequest, "startSubEchoRequest", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
|
flag.Var(&c.StartSubEchoRequest, "startSubEchoRequest", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
|
||||||
flag.Var(&c.StartSubEchoReply, "startSubEchoReply", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
|
flag.Var(&c.StartSubEchoReply, "startSubEchoReply", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
|
||||||
flag.Var(&c.StartSubREQCliCommand, "startSubREQCliCommand", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
|
flag.Var(&c.StartSubREQCliCommand, "startSubREQCliCommand", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
|
||||||
flag.Var(&c.StartSubCLICommandRequestNOSEQ, "startSubCLICommandRequestNOSEQ", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
|
flag.Var(&c.StartSubREQnCliCommand, "startSubREQnCliCommand", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
|
||||||
flag.Var(&c.StartSubCLICommandReply, "startSubCLICommandReply", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
|
flag.Var(&c.StartSubCLICommandReply, "startSubCLICommandReply", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
|
@ -13,10 +13,6 @@ SubscribersDataFolder = "./data"
|
||||||
OK = true
|
OK = true
|
||||||
Values = ["*"]
|
Values = ["*"]
|
||||||
|
|
||||||
[StartSubCLICommandRequestNOSEQ]
|
|
||||||
OK = true
|
|
||||||
Values = ["*"]
|
|
||||||
|
|
||||||
[StartSubEchoReply]
|
[StartSubEchoReply]
|
||||||
OK = true
|
OK = true
|
||||||
Values = ["*"]
|
Values = ["*"]
|
||||||
|
@ -33,6 +29,10 @@ SubscribersDataFolder = "./data"
|
||||||
OK = true
|
OK = true
|
||||||
Values = ["*"]
|
Values = ["*"]
|
||||||
|
|
||||||
|
[StartSubREQnCliCommand]
|
||||||
|
OK = true
|
||||||
|
Values = ["*"]
|
||||||
|
|
||||||
[StartSubSayHello]
|
[StartSubSayHello]
|
||||||
OK = true
|
OK = true
|
||||||
Values = ["*"]
|
Values = ["*"]
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
"toNode": "ship1",
|
"toNode": "ship1",
|
||||||
"data": ["bash","-c","tree ../"],
|
"data": ["bash","-c","tree ../"],
|
||||||
"method":"CLICommandRequestNOSEQ",
|
"method":"REQnCliCommand",
|
||||||
"timeout":10,
|
"timeout":3,
|
||||||
"retries":3,
|
"retries":3,
|
||||||
"methodTimeout": 0
|
"methodTimeout": 10
|
||||||
}
|
}
|
||||||
]
|
]
|
|
@ -105,12 +105,12 @@ func (s *server) ProcessesStart() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start a subscriber for CLICommandRequestNOSEQ messages
|
// Start a subscriber for Not In Order Cli Command Request messages
|
||||||
if s.configuration.StartSubCLICommandRequestNOSEQ.OK {
|
if s.configuration.StartSubREQnCliCommand.OK {
|
||||||
{
|
{
|
||||||
fmt.Printf("Starting CLICommand NOSEQ Request subscriber: %#v\n", s.nodeName)
|
fmt.Printf("Starting CLICommand Not Sequential Request subscriber: %#v\n", s.nodeName)
|
||||||
sub := newSubject(CLICommandRequestNOSEQ, s.nodeName)
|
sub := newSubject(REQnCliCommand, s.nodeName)
|
||||||
proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, s.configuration.StartSubCLICommandRequestNOSEQ.Values, nil)
|
proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, s.configuration.StartSubREQnCliCommand.Values, nil)
|
||||||
go proc.spawnWorker(s)
|
go proc.spawnWorker(s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ const (
|
||||||
// done. No order are preserved.
|
// done. No order are preserved.
|
||||||
// The data field is a slice of strings where the first string
|
// The data field is a slice of strings where the first string
|
||||||
// value should be the command, and the following the arguments.
|
// value should be the command, and the following the arguments.
|
||||||
CLICommandRequestNOSEQ Method = "CLICommandRequestNOSEQ"
|
REQnCliCommand Method = "REQnCliCommand"
|
||||||
// Will generate a reply for a CLICommandRequest.
|
// Will generate a reply for a CLICommandRequest.
|
||||||
// This type is normally not used by the user when creating
|
// This type is normally not used by the user when creating
|
||||||
// a message. It is used in creating the reply message with
|
// a message. It is used in creating the reply message with
|
||||||
|
@ -119,7 +119,7 @@ func (m Method) GetMethodsAvailable() MethodsAvailable {
|
||||||
REQCliCommand: methodREQCliCommand{
|
REQCliCommand: methodREQCliCommand{
|
||||||
commandOrEvent: CommandACK,
|
commandOrEvent: CommandACK,
|
||||||
},
|
},
|
||||||
CLICommandRequestNOSEQ: methodCLICommandRequestNOSEQ{
|
REQnCliCommand: methodREQnCliCommand{
|
||||||
commandOrEvent: CommandACK,
|
commandOrEvent: CommandACK,
|
||||||
},
|
},
|
||||||
CLICommandReply: methodCLICommandReply{
|
CLICommandReply: methodCLICommandReply{
|
||||||
|
@ -447,11 +447,11 @@ func (m methodREQCliCommand) handler(proc process, message Message, node string)
|
||||||
|
|
||||||
// --- methodCLICommandRequestNOSEQ
|
// --- methodCLICommandRequestNOSEQ
|
||||||
|
|
||||||
type methodCLICommandRequestNOSEQ struct {
|
type methodREQnCliCommand struct {
|
||||||
commandOrEvent CommandOrEvent
|
commandOrEvent CommandOrEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m methodCLICommandRequestNOSEQ) getKind() CommandOrEvent {
|
func (m methodREQnCliCommand) getKind() CommandOrEvent {
|
||||||
return m.commandOrEvent
|
return m.commandOrEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ func (m methodCLICommandRequestNOSEQ) getKind() CommandOrEvent {
|
||||||
// The NOSEQ method will process messages as they are recived,
|
// The NOSEQ method will process messages as they are recived,
|
||||||
// and the reply back will be sent as soon as the process is
|
// and the reply back will be sent as soon as the process is
|
||||||
// done. No order are preserved.
|
// done. No order are preserved.
|
||||||
func (m methodCLICommandRequestNOSEQ) handler(proc process, message Message, node string) ([]byte, error) {
|
func (m methodREQnCliCommand) handler(proc process, message Message, node string) ([]byte, error) {
|
||||||
log.Printf("<--- CLICommand REQUEST received from: %v, containing: %v", message.FromNode, message.Data)
|
log.Printf("<--- CLICommand REQUEST received from: %v, containing: %v", message.FromNode, message.Data)
|
||||||
|
|
||||||
// Execute the CLI command in it's own go routine, so we are able
|
// Execute the CLI command in it's own go routine, so we are able
|
||||||
|
|
Loading…
Reference in a new issue