From af6a282b6a87485b81c35fbb7dba95206cfedba8 Mon Sep 17 00:00:00 2001 From: postmannen Date: Wed, 24 Feb 2021 07:39:14 +0100 Subject: [PATCH] refactoring --- getmessagefromfile.go | 2 +- incommmingBuffer.db | Bin 32768 -> 32768 bytes publisher.go => server.go | 10 +++++----- 3 files changed, 6 insertions(+), 6 deletions(-) rename publisher.go => server.go (99%) diff --git a/getmessagefromfile.go b/getmessagefromfile.go index 511bd1f..7a7f885 100644 --- a/getmessagefromfile.go +++ b/getmessagefromfile.go @@ -70,7 +70,7 @@ func jsonFromFileData(b []byte) ([]subjectAndMessage, error) { for _, m := range MsgSlice { s := Subject{ - Node: string(m.ToNode), + ToNode: string(m.ToNode), CommandOrEvent: m.CommandOrEvent, Method: m.Method, } diff --git a/incommmingBuffer.db b/incommmingBuffer.db index 38997341985f6651bbf38b6420a381e315c1b21a..139fb9825ee3d1d28f16c41a6f8a9e3c5925a89c 100644 GIT binary patch delta 101 zcmZo@U}|V!n&2Ry#{dC`N`HC1F~2{1v!cNU{z(E30=iHMMXu@pyNtEgLL?M)ChItO rF`7;;cd+L)saEoIQL-{L*}UJuk$;ncj=*Fc1)${Sa)nO*MF9o?-nAXJ delta 101 zcmZo@U}|V!n&2Ry#Q*_r^R|}>gq#xJtZ1--f0BTMfHqX(`7tBMgLk>oArcBYlXV=t r7)>^pJ9P4IGSCs2tfK(rPA*rl=QOTX@^n$MGBn=2U%`=oQGfveho>B* diff --git a/publisher.go b/server.go similarity index 99% rename from publisher.go rename to server.go index 5fcb308..a8a824b 100644 --- a/publisher.go +++ b/server.go @@ -228,7 +228,7 @@ func (s *server) handleMessagesInRingbuffer() { // by using the goto at the end redo the process for this specific message. log.Printf("info: did not find that specific subject, starting new process for subject: %v\n", subjName) - sub := newSubject(sam.Subject.Method, sam.Subject.CommandOrEvent, sam.Subject.Node) + sub := newSubject(sam.Subject.Method, sam.Subject.CommandOrEvent, sam.Subject.ToNode) proc := s.processPrepareNew(sub, s.errorCh, processKindPublisher) // fmt.Printf("*** %#v\n", proc) go s.processSpawnWorker(proc) @@ -249,7 +249,7 @@ type node string // specific process type Subject struct { // node, the name of the node - Node string `json:"node" yaml:"node"` + ToNode string `json:"node" yaml:"toNode"` // messageType, command/event CommandOrEvent CommandOrEvent `json:"commandOrEvent" yaml:"commandOrEvent"` // method, what is this message doing, etc. shellCommand, syslog, etc. @@ -263,7 +263,7 @@ type Subject struct { // to receive new messages on the specific subject. func newSubject(method Method, commandOrEvent CommandOrEvent, node string) Subject { return Subject{ - Node: node, + ToNode: node, CommandOrEvent: commandOrEvent, Method: method, messageCh: make(chan Message), @@ -274,7 +274,7 @@ func newSubject(method Method, commandOrEvent CommandOrEvent, node string) Subje type subjectName string func (s Subject) name() subjectName { - return subjectName(fmt.Sprintf("%s.%s.%s", s.Method, s.CommandOrEvent, s.Node)) + return subjectName(fmt.Sprintf("%s.%s.%s", s.Method, s.CommandOrEvent, s.ToNode)) } // processKind are either kindSubscriber or kindPublisher, and are @@ -313,7 +313,7 @@ func (s *server) processPrepareNew(subject Subject, errCh chan errProcess, proce proc := process{ messageID: 0, subject: subject, - node: node(subject.Node), + node: node(subject.ToNode), processID: s.lastProcessID, errorCh: errCh, processKind: processKind,