mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
69995f76ca
updated references removed tui client removed ringbuffer persist store removed ringbuffer enabled audit logging moved audit logging to message readers disabled goreleaser update readme, cbor, zstd removed request type ping and pong update readme testing with cmd.WaitDelay for clicommand fixed readme removed ringbuffer flag default serialization set to cbor, default compression set to zstd, fixed race, removed event type ack and nack, also removed from subject. Fixed file stat error for copy log file removed remaining elements of the event type removed comments renamed toRingbufferCh to samToSendCh renamed directSAMSCh ro samSendLocalCh removed handler interface agpl3 license added license-change.md
51 lines
1.5 KiB
Go
51 lines
1.5 KiB
Go
package ctrl
|
|
|
|
// ---- Template that can be used for creating request methods
|
|
|
|
// func (m methodREQCopyFileTo) handler(proc process, message Message, node string) ([]byte, error) {
|
|
//
|
|
// proc.processes.wg.Add(1)
|
|
// go func() {
|
|
// defer proc.processes.wg.Done()
|
|
//
|
|
// ctx, cancel := context.WithTimeout(proc.ctx, time.Second*time.Duration(message.MethodTimeout))
|
|
// defer cancel()
|
|
//
|
|
// // Put data that should be the result of the action done in the inner
|
|
// // go routine on the outCh.
|
|
// outCh := make(chan []byte)
|
|
// // Put errors from the inner go routine on the errCh.
|
|
// errCh := make(chan error)
|
|
//
|
|
// proc.processes.wg.Add(1)
|
|
// go func() {
|
|
// defer proc.processes.wg.Done()
|
|
//
|
|
// // Do some work here....
|
|
//
|
|
// }()
|
|
//
|
|
// // Wait for messages received from the inner go routine.
|
|
// select {
|
|
// case <-ctx.Done():
|
|
// fmt.Printf(" ** DEBUG: got ctx.Done\n")
|
|
//
|
|
// er := fmt.Errorf("error: methodREQ...: got <-ctx.Done(): %v", message.MethodArgs)
|
|
// sendErrorLogMessage(proc.configuration, proc.processes.metrics, proc.toRingbufferCh, proc.node, er)
|
|
// return
|
|
//
|
|
// case er := <-errCh:
|
|
// sendErrorLogMessage(proc.configuration, proc.processes.metrics, proc.toRingbufferCh, proc.node, er)
|
|
// return
|
|
//
|
|
// case out := <-outCh:
|
|
// replyData := fmt.Sprintf("info: succesfully created and wrote the file %v\n", out)
|
|
// newReplyMessage(proc, message, []byte(replyData))
|
|
// return
|
|
// }
|
|
//
|
|
// }()
|
|
//
|
|
// ackMsg := []byte("confirmed from: " + node + ": " + fmt.Sprint(message.ID))
|
|
// return ackMsg, nil
|
|
// }
|