1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-01-07 12:59:15 +00:00

Renamed REQToAppendFile to REQToFileAppend

This commit is contained in:
postmannen 2021-04-13 15:54:04 +02:00
parent ac751ee4b5
commit dba69fd90c
11 changed files with 23 additions and 23 deletions

View file

@ -166,7 +166,7 @@ clone the repository, then cd `./steward/cmd` and do `go build -o steward`, and
Specify comma separated list for nodes to allow messages from. Use "*" for from all. Value RST will turn off subscriber. Specify comma separated list for nodes to allow messages from. Use "*" for from all. Value RST will turn off subscriber.
-startSubREQTextToConsole value -startSubREQTextToConsole value
Specify comma separated list for nodes to allow messages from. Use "*" for from all. Value RST will turn off subscriber. Specify comma separated list for nodes to allow messages from. Use "*" for from all. Value RST will turn off subscriber.
-startSubREQTextToLogFile value -startSubREQToFileAppend value
Specify comma separated list for nodes to allow messages from. Use "*" for from all. Value RST will turn off subscriber. Specify comma separated list for nodes to allow messages from. Use "*" for from all. Value RST will turn off subscriber.
-startSubREQnCliCommand value -startSubREQnCliCommand value
Specify comma separated list for nodes to allow messages from. Use "*" for from all. Value RST will turn off subscriber. Specify comma separated list for nodes to allow messages from. Use "*" for from all. Value RST will turn off subscriber.

View file

@ -105,7 +105,7 @@ type Configuration struct {
// Subscriber for hello messages // Subscriber for hello messages
StartSubREQHello flagNodeSlice StartSubREQHello flagNodeSlice
// Subscriber for text logging // Subscriber for text logging
StartSubREQTextToLogFile flagNodeSlice StartSubREQToFileAppend flagNodeSlice
// Subscriber for writing to file // Subscriber for writing to file
StartSubREQTextToFile flagNodeSlice StartSubREQTextToFile flagNodeSlice
// Subscriber for Echo Request // Subscriber for Echo Request
@ -145,7 +145,7 @@ func newConfigurationDefaults() Configuration {
CentralNodeName: "", CentralNodeName: "",
StartSubREQErrorLog: flagNodeSlice{Values: []node{}}, StartSubREQErrorLog: flagNodeSlice{Values: []node{}},
StartSubREQHello: flagNodeSlice{OK: true, Values: []node{"*"}}, StartSubREQHello: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQTextToLogFile: flagNodeSlice{OK: true, Values: []node{"*"}}, StartSubREQToFileAppend: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQTextToFile: flagNodeSlice{OK: true, Values: []node{"*"}}, StartSubREQTextToFile: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQPing: flagNodeSlice{OK: true, Values: []node{"*"}}, StartSubREQPing: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQPong: flagNodeSlice{OK: true, Values: []node{"*"}}, StartSubREQPong: flagNodeSlice{OK: true, Values: []node{"*"}},
@ -188,7 +188,7 @@ func (c *Configuration) CheckFlags() error {
flag.Var(&c.StartSubREQErrorLog, "startSubREQErrorLog", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") flag.Var(&c.StartSubREQErrorLog, "startSubREQErrorLog", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
flag.Var(&c.StartSubREQHello, "startSubREQHello", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") flag.Var(&c.StartSubREQHello, "startSubREQHello", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
flag.Var(&c.StartSubREQTextToLogFile, "startSubREQTextToLogFile", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") flag.Var(&c.StartSubREQToFileAppend, "startSubREQToFileAppend", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
flag.Var(&c.StartSubREQTextToFile, "startSubREQTextToFile", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") flag.Var(&c.StartSubREQTextToFile, "startSubREQTextToFile", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
flag.Var(&c.StartSubREQPing, "startSubREQPing", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") flag.Var(&c.StartSubREQPing, "startSubREQPing", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")
flag.Var(&c.StartSubREQPong, "startSubREQPong", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.") flag.Var(&c.StartSubREQPong, "startSubREQPong", "Specify comma separated list for nodes to allow messages from. Use \"*\" for from all. Value RST will turn off subscriber.")

View file

@ -45,7 +45,7 @@ SubscribersDataFolder = "./var"
OK = true OK = true
Values = ["*"] Values = ["*"]
[StartSubREQTextToLogFile] [StartSubREQToFileAppend]
OK = true OK = true
Values = ["*"] Values = ["*"]

View file

@ -5,6 +5,6 @@
"toNode": "central", "toNode": "central",
"data": ["some message sent from a ship for testing\n"], "data": ["some message sent from a ship for testing\n"],
"commandOrEvent":"EventACK", "commandOrEvent":"EventACK",
"method":"REQTextToLogFile" "method":"REQToFileAppend"
} }
] ]

View file

@ -5,7 +5,7 @@
"toNode": "ship1", "toNode": "ship1",
"data": ["bash","-c","sleep 5 & tree ./"], "data": ["bash","-c","sleep 5 & tree ./"],
"method":"REQCliCommand", "method":"REQCliCommand",
"replyMethod":"REQTextToLogFile", "replyMethod":"REQToFileAppend",
"timeout":5, "timeout":5,
"retries":3, "retries":3,
"replyTimeout":5, "replyTimeout":5,

View file

@ -4,7 +4,7 @@
"fileExtension":".result", "fileExtension":".result",
"toNode": "ship1", "toNode": "ship1",
"data": ["bash","-c","tree ../"], "data": ["bash","-c","tree ../"],
"replyMethod":"REQTextToLogFile", "replyMethod":"REQToFileAppend",
"method":"REQnCliCommand", "method":"REQnCliCommand",
"timeout":3, "timeout":3,
"retries":3, "retries":3,

View file

@ -12,7 +12,7 @@
"allowedNodes": ["central","node1"] "allowedNodes": ["central","node1"]
} }
}, },
"replyMethod":"REQTextToLogFile", "replyMethod":"REQToFileAppend",
"timeout":3, "timeout":3,
"retries":3, "retries":3,
"replyTimeout":3, "replyTimeout":3,

View file

@ -13,7 +13,7 @@
"receivingNode": "ship2" "receivingNode": "ship2"
} }
}, },
"replyMethod":"REQTextToLogFile", "replyMethod":"REQToFileAppend",
"timeout":3, "timeout":3,
"retries":3, "retries":3,
"replyTimeout":3, "replyTimeout":3,

View file

@ -8,7 +8,7 @@
"operation":{ "operation":{
"opCmd":"ps" "opCmd":"ps"
}, },
"replyMethod":"REQTextToLogFile", "replyMethod":"REQToFileAppend",
"timeout":3, "timeout":3,
"retries":3, "retries":3,
"replyTimeout":3, "replyTimeout":3,

View file

@ -23,8 +23,8 @@ func (p process) ProcessesStart() {
} }
// Start a subscriber for textLogging messages // Start a subscriber for textLogging messages
if p.configuration.StartSubREQTextToLogFile.OK { if p.configuration.StartSubREQToFileAppend.OK {
p.startup.subREQTextToLogFile(p) p.startup.subREQToFileAppend(p)
} }
// Start a subscriber for text to file messages // Start a subscriber for text to file messages
@ -235,10 +235,10 @@ func (s startup) subREQTextToFile(p process) {
go proc.spawnWorker(p.processes, p.natsConn) go proc.spawnWorker(p.processes, p.natsConn)
} }
func (s startup) subREQTextToLogFile(p process) { func (s startup) subREQToFileAppend(p process) {
fmt.Printf("Starting text logging subscriber: %#v\n", p.node) fmt.Printf("Starting text logging subscriber: %#v\n", p.node)
sub := newSubject(REQTextToLogFile, string(p.node)) sub := newSubject(REQToFileAppend, string(p.node))
proc := newProcess(p.natsConn, p.processes, p.toRingbufferCh, p.configuration, sub, p.errorCh, processKindSubscriber, p.configuration.StartSubREQTextToLogFile.Values, nil) proc := newProcess(p.natsConn, p.processes, p.toRingbufferCh, p.configuration, sub, p.errorCh, processKindSubscriber, p.configuration.StartSubREQToFileAppend.Values, nil)
// fmt.Printf("*** %#v\n", proc) // fmt.Printf("*** %#v\n", proc)
go proc.spawnWorker(p.processes, p.natsConn) go proc.spawnWorker(p.processes, p.natsConn)
} }

View file

@ -93,7 +93,7 @@ const (
// the receiving end. // the receiving end.
// The data field is a slice of strings where the values of the // The data field is a slice of strings where the values of the
// slice will be written to the log file. // slice will be written to the log file.
REQTextToLogFile Method = "REQTextToLogFile" REQToFileAppend Method = "REQToFileAppend"
// Send text to some host by overwriting the existing content of // Send text to some host by overwriting the existing content of
// the fileoutput to a file. If the file do not exist we create it. // the fileoutput to a file. If the file do not exist we create it.
// A file with the full subject+hostName will be created on // A file with the full subject+hostName will be created on
@ -146,7 +146,7 @@ func (m Method) GetMethodsAvailable() MethodsAvailable {
REQTextToConsole: methodREQTextToConsole{ REQTextToConsole: methodREQTextToConsole{
commandOrEvent: EventACK, commandOrEvent: EventACK,
}, },
REQTextToLogFile: methodREQTextToLogFile{ REQToFileAppend: methodREQToFileAppend{
commandOrEvent: EventACK, commandOrEvent: EventACK,
}, },
REQTextToFile: methodREQTextToFile{ REQTextToFile: methodREQTextToFile{
@ -335,7 +335,7 @@ func (m methodREQOpCommand) handler(proc process, message Message, nodeName stri
// publisher process will have the name of the node to receive the message, // publisher process will have the name of the node to receive the message,
// and not just the local node name as with subscriber processes. // and not just the local node name as with subscriber processes.
// receive the message we need to specify // receive the message we need to specify
// Process name example: ship2.REQTextToLogFile.EventACK_subscriber // Process name example: ship2.REQToFileAppend.EventACK_subscriber
sub := newSubject(arg.Method, string(arg.RecevingNode)) sub := newSubject(arg.Method, string(arg.RecevingNode))
processName := processNameGet(sub.name(), arg.Kind) processName := processNameGet(sub.name(), arg.Kind)
@ -394,7 +394,7 @@ func newReplyMessage(proc process, message Message, outData []byte) {
// If no replyMethod is set we default to writing to writing to // If no replyMethod is set we default to writing to writing to
// a log file. // a log file.
if message.ReplyMethod == "" { if message.ReplyMethod == "" {
message.ReplyMethod = REQTextToLogFile message.ReplyMethod = REQToFileAppend
} }
//-- //--
// Create a new message for the reply, and put it on the // Create a new message for the reply, and put it on the
@ -420,15 +420,15 @@ func newReplyMessage(proc process, message Message, outData []byte) {
//-- //--
} }
type methodREQTextToLogFile struct { type methodREQToFileAppend struct {
commandOrEvent CommandOrEvent commandOrEvent CommandOrEvent
} }
func (m methodREQTextToLogFile) getKind() CommandOrEvent { func (m methodREQToFileAppend) getKind() CommandOrEvent {
return m.commandOrEvent return m.commandOrEvent
} }
func (m methodREQTextToLogFile) handler(proc process, message Message, node string) ([]byte, error) { func (m methodREQToFileAppend) handler(proc process, message Message, node string) ([]byte, error) {
// If it was a request type message we want to check what the initial messages // If it was a request type message we want to check what the initial messages
// method, so we can use that in creating the file name to store the data. // method, so we can use that in creating the file name to store the data.