1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

fixed spelling ReqHello to REQHello

This commit is contained in:
postmannen 2021-04-06 05:46:07 +02:00
parent ee749ae714
commit 8f2c4b0db7
5 changed files with 24 additions and 24 deletions

View file

@ -96,13 +96,13 @@ type Configuration struct {
CentralNodeName string
// Make the current node send hello messages to central at given interval in seconds
StartPubReqHello int
StartPubREQHello int
// Start the central error logger.
// Takes a comma separated string of nodes to receive from or "*" for all nodes.
StartSubErrorLog flagNodeSlice
// Subscriber for hello messages
StartSubReqHello flagNodeSlice
StartSubREQHello flagNodeSlice
// Subscriber for text logging
StartSubREQTextToLogFile flagNodeSlice
// Subscriber for Echo Request
@ -131,11 +131,11 @@ func newConfigurationDefaults() Configuration {
PromHostAndPort: "",
DefaultMessageTimeout: 10,
DefaultMessageRetries: 1,
StartPubReqHello: 30,
StartPubREQHello: 30,
SubscribersDataFolder: "./data",
CentralNodeName: "",
StartSubErrorLog: flagNodeSlice{Values: []node{}},
StartSubReqHello: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQHello: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubREQTextToLogFile: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubEchoRequest: flagNodeSlice{OK: true, Values: []node{"*"}},
StartSubEchoReply: flagNodeSlice{OK: true, Values: []node{"*"}},
@ -171,10 +171,10 @@ func (c *Configuration) CheckFlags() error {
flag.StringVar(&c.SubscribersDataFolder, "subscribersDataFolder", fc.SubscribersDataFolder, "The data folder where subscribers are allowed to write their data if needed")
flag.StringVar(&c.CentralNodeName, "centralNodeName", fc.CentralNodeName, "The name of the central node to receive messages published by this node")
flag.IntVar(&c.StartPubReqHello, "startPubReqHello", fc.StartPubReqHello, "Make the current node send hello messages to central at given interval in seconds")
flag.IntVar(&c.StartPubREQHello, "startPubREQHello", fc.StartPubREQHello, "Make the current node send hello messages to central at given interval in seconds")
flag.Var(&c.StartSubErrorLog, "startSubErrorLog", "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.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.")

View file

@ -6,7 +6,7 @@ DefaultMessageTimeout = 5
NodeName = "central"
ProfilingPort = ""
PromHostAndPort = ":2112"
StartPubReqHello = 0
StartPubREQHello = 0
SubscribersDataFolder = "./data"
[StartSubEchoReply]
@ -25,6 +25,10 @@ SubscribersDataFolder = "./data"
OK = true
Values = ["*"]
[StartSubREQHello]
OK = true
Values = ["*"]
[StartSubREQTextToConsole]
OK = true
Values = ["*"]
@ -36,7 +40,3 @@ SubscribersDataFolder = "./data"
[StartSubREQnCliCommand]
OK = true
Values = ["*"]
[StartSubReqHello]
OK = true
Values = ["*"]

View file

@ -2,6 +2,6 @@
{
"toNode": "central",
"data": [""],
"method":"ReqHello"
"method":"REQHello"
}
]

View file

@ -31,11 +31,11 @@ func (s *server) ProcessesStart() {
}
// Start a subscriber for Hello messages
if s.configuration.StartSubReqHello.OK {
if s.configuration.StartSubREQHello.OK {
{
fmt.Printf("Starting Hello subscriber: %#v\n", s.nodeName)
sub := newSubject(ReqHello, s.nodeName)
proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, s.configuration.StartSubReqHello.Values, nil)
sub := newSubject(REQHello, s.nodeName)
proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindSubscriber, s.configuration.StartSubREQHello.Values, nil)
proc.procFuncCh = make(chan Message)
// The reason for running the say hello subscriber as a procFunc is that
@ -131,10 +131,10 @@ func (s *server) ProcessesStart() {
// Define a process of kind publisher with subject for SayHello to central,
// and register a procFunc with the process that will handle the actual
// sending of say hello.
if s.configuration.StartPubReqHello != 0 {
if s.configuration.StartPubREQHello != 0 {
fmt.Printf("Starting Hello Publisher: %#v\n", s.nodeName)
sub := newSubject(ReqHello, s.configuration.CentralNodeName)
sub := newSubject(REQHello, s.configuration.CentralNodeName)
proc := newProcess(s.processes, s.toRingbufferCh, s.configuration, sub, s.errorKernel.errorCh, processKindPublisher, []node{}, nil)
// Define the procFunc to be used for the process.
@ -149,7 +149,7 @@ func (s *server) ProcessesStart() {
ToNode: "central",
FromNode: node(s.nodeName),
Data: []string{d},
Method: ReqHello,
Method: REQHello,
}
sam, err := newSAM(m)
@ -158,7 +158,7 @@ func (s *server) ProcessesStart() {
log.Printf("error: ProcessesStart: %v\n", err)
}
proc.toRingbufferCh <- []subjectAndMessage{sam}
time.Sleep(time.Second * time.Duration(s.configuration.StartPubReqHello))
time.Sleep(time.Second * time.Duration(s.configuration.StartPubREQHello))
}
})
go proc.spawnWorker(s)

View file

@ -85,7 +85,7 @@ const (
// slice will be written to the log file.
REQTextToLogFile Method = "REQTextToLogFile"
// Send Hello I'm here message.
ReqHello Method = "ReqHello"
REQHello Method = "REQHello"
// Error log methods to centralError node.
ErrorLog Method = "ErrorLog"
// Echo request will ask the subscriber for a
@ -125,7 +125,7 @@ func (m Method) GetMethodsAvailable() MethodsAvailable {
REQTextToLogFile: methodREQTextToLogFile{
commandOrEvent: EventACK,
},
ReqHello: methodReqHello{
REQHello: methodREQHello{
commandOrEvent: EventNACK,
},
ErrorLog: methodErrorLog{
@ -319,15 +319,15 @@ func (m methodREQTextToLogFile) handler(proc process, message Message, node stri
// -----
type methodReqHello struct {
type methodREQHello struct {
commandOrEvent CommandOrEvent
}
func (m methodReqHello) getKind() CommandOrEvent {
func (m methodREQHello) getKind() CommandOrEvent {
return m.commandOrEvent
}
func (m methodReqHello) handler(proc process, message Message, node string) ([]byte, error) {
func (m methodREQHello) handler(proc process, message Message, node string) ([]byte, error) {
log.Printf("<--- Received hello from %#v\n", message.FromNode)