mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
renamed inmsg to steward.sock
This commit is contained in:
parent
04f7ca013b
commit
899d2e1f09
6 changed files with 15 additions and 15 deletions
18
README.md
18
README.md
|
@ -161,7 +161,7 @@ methodTimeout
|
|||
|
||||
### How to send a Message
|
||||
|
||||
Right now the API for sending a message from one node to another node is by pasting a structured JSON object into a file called `inmsg.txt` living alongside the binary. This file will be watched continously, and when updated the content will be picked up, umarshaled, and if OK it will be sent a message to the node specified in the `toNode` field.
|
||||
Right now the API for sending a message from one node to another node is by pasting a structured JSON object into a file called `steward.sock` living alongside the binary. This file will be watched continously, and when updated the content will be picked up, umarshaled, and if OK it will be sent a message to the node specified in the `toNode` field.
|
||||
|
||||
The `method` is what defines what the event will do. The preconfigured methods are:
|
||||
|
||||
|
@ -213,7 +213,7 @@ NB: Both the keys and the values used are case sensitive.
|
|||
|
||||
#### Sending a command from one Node to Another Node
|
||||
|
||||
Example JSON for appending a message of type command into the `inmsg.txt` file
|
||||
Example JSON for appending a message of type command into the `steward.sock` file
|
||||
|
||||
```json
|
||||
[
|
||||
|
@ -267,11 +267,11 @@ To send a message with custom timeout and amount of retries
|
|||
]
|
||||
```
|
||||
|
||||
You can save the content to myfile.JSON and append it to `inmsg.txt`
|
||||
You can save the content to myfile.JSON and append it to `steward.sock`
|
||||
|
||||
`cat myfile.json >> inmsg.txt`
|
||||
`cat myfile.json >> steward.sock`
|
||||
|
||||
The content of `inmsg.txt` will be erased as messages a processed.
|
||||
The content of `steward.sock` will be erased as messages a processed.
|
||||
|
||||
#### Sending a message of type Event
|
||||
|
||||
|
@ -286,11 +286,11 @@ The content of `inmsg.txt` will be erased as messages a processed.
|
|||
]
|
||||
```
|
||||
|
||||
You can save the content to myfile.JSON and append it to `inmsg.txt`
|
||||
You can save the content to myfile.JSON and append it to `steward.sock`
|
||||
|
||||
`cat myfile.json >> inmsg.txt`
|
||||
`cat myfile.json >> steward.sock`
|
||||
|
||||
The content of `inmsg.txt` will be erased as messages a processed.
|
||||
The content of `steward.sock` will be erased as messages a processed.
|
||||
|
||||
## Concepts/Ideas
|
||||
|
||||
|
@ -319,7 +319,7 @@ and for a shell command of type command to a host named "ship2"
|
|||
|
||||
## TODO
|
||||
|
||||
- FIX so it can handle multiple slices of input for inmsg.txt
|
||||
- FIX so it can handle multiple slices of input for steward.sock
|
||||
|
||||
- Make a scraper that first send an EventACK, and the content of the scraping is returned by a node as a new EventACK back the where the initial event originated.
|
||||
|
||||
|
|
|
@ -11,5 +11,5 @@ StartSayHelloSubscriber = false
|
|||
SubscribersDataFolder = "./data"
|
||||
|
||||
[StartCentralErrorLogger]
|
||||
OK = false
|
||||
Values = []
|
||||
OK = true
|
||||
Values = ["*"]
|
||||
|
|
|
@ -122,7 +122,7 @@ func newSAM(m Message) (subjectAndMessage, error) {
|
|||
// A []byte will be returned with the content read.
|
||||
func readTruncateMessageFile(fileName string) ([]byte, error) {
|
||||
|
||||
f, err := os.OpenFile(fileName, os.O_APPEND|os.O_RDWR, os.ModeAppend)
|
||||
f, err := os.OpenFile(fileName, os.O_APPEND|os.O_RDWR|os.O_CREATE, os.ModeAppend)
|
||||
if err != nil {
|
||||
log.Printf("error: readTruncateMessageFile: Failed to open file: %v\n", err)
|
||||
return nil, err
|
||||
|
@ -169,7 +169,7 @@ func fileWatcherStart(directoryToCheck string, fileUpdated chan bool) {
|
|||
select {
|
||||
case event := <-watcher.Events:
|
||||
if event.Op&fsnotify.Write == fsnotify.Write {
|
||||
// log.Println("info: inmsg.txt file updated, processing input: ", event.Name)
|
||||
// log.Println("info: steward.sock file updated, processing input: ", event.Name)
|
||||
//testing with an update chan to get updates
|
||||
fileUpdated <- true
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ func (r *ringBuffer) fillBuffer(inCh chan subjectAndMessage, samValueBucket stri
|
|||
}
|
||||
|
||||
// Check for incomming messages. These are typically comming from
|
||||
// the go routine who reads inmsg.txt.
|
||||
// the go routine who reads steward.sock.
|
||||
for v := range inCh {
|
||||
|
||||
// Check if the command or event exists in commandOrEvent.go
|
||||
|
|
|
@ -117,7 +117,7 @@ func (s *server) Start() {
|
|||
go s.startMetrics()
|
||||
|
||||
// Start the checking the input file for new messages from operator.
|
||||
go s.getMessagesFromFile("./", "inmsg.txt", s.newMessagesCh)
|
||||
go s.getMessagesFromFile("./", "steward.sock", s.newMessagesCh)
|
||||
|
||||
// // if enabled, start the sayHello I'm here service at the given interval
|
||||
// // REMOVED:
|
||||
|
|
Loading…
Reference in a new issue