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

Renamed REQSub to REQSUB

This commit is contained in:
postmannen 2022-06-14 07:09:20 +02:00
parent 1895fcb398
commit c4e384b987
2 changed files with 10 additions and 10 deletions

View file

@ -110,9 +110,9 @@ const (
// Generated by the source to send initial information to the destination.
REQCopyDst Method = "REQCopyDst"
// Read the source file to be copied to some node.
REQSubCopySrc Method = "REQSubCopySrc"
REQSUBCopySrc Method = "REQSUBCopySrc"
// Write the destination copied to some node.
REQSubCopyDst Method = "REQSubCopyDst"
REQSUBCopyDst Method = "REQSUBCopyDst"
// Send Hello I'm here message.
REQHello Method = "REQHello"
// Error log methods to centralError node.
@ -240,10 +240,10 @@ func (m Method) GetMethodsAvailable() MethodsAvailable {
REQCopyDst: methodREQCopyDst{
event: EventACK,
},
REQSubCopySrc: methodREQSub{
REQSUBCopySrc: methodREQSUB{
event: EventACK,
},
REQSubCopyDst: methodREQSub{
REQSUBCopyDst: methodREQSUB{
event: EventACK,
},
REQHello: methodREQHello{
@ -393,15 +393,15 @@ func (m methodREQInitial) handler(proc process, message Message, node string) ([
// Methods used in sub processes are defined within the the requests
// they are spawned in, so this type is primarily for us to use the
// same logic with sub process requests as we do with normal requests.
type methodREQSub struct {
type methodREQSUB struct {
event Event
}
func (m methodREQSub) getKind() Event {
func (m methodREQSUB) getKind() Event {
return m.event
}
func (m methodREQSub) handler(proc process, message Message, node string) ([]byte, error) {
func (m methodREQSUB) handler(proc process, message Message, node string) ([]byte, error) {
// proc.procFuncCh <- message
ackMsg := []byte("confirmed from: " + node + ": " + fmt.Sprint(message.ID))
return ackMsg, nil
@ -420,7 +420,7 @@ type MethodsAvailable struct {
// will be returned.
func (ma MethodsAvailable) CheckIfExists(m Method) (methodHandler, bool) {
// First check if it is a sub process.
if strings.HasPrefix(string(m), "REQSub") {
if strings.HasPrefix(string(m), "REQSUB") {
// Strip of the uuid after the method name.
sp := strings.Split(string(m), ".")
m = Method(sp[0])

View file

@ -91,7 +91,7 @@ func (m methodREQCopySrc) handler(proc process, message Message, node string) ([
// Create a subject for one copy request
uid := uuid.New()
subProcessName = fmt.Sprintf("REQSubCopySrc.%v", uid.String())
subProcessName = fmt.Sprintf("REQSUBCopySrc.%v", uid.String())
dstDir := filepath.Dir(DstFilePath)
dstFile := filepath.Base(DstFilePath)
@ -206,7 +206,7 @@ func (m methodREQCopyDst) handler(proc process, message Message, node string) ([
ctx, _ := getContextForMethodTimeout(proc.ctx, message)
// Create a subject for one copy request
subProcessName = fmt.Sprintf("REQSubCopyDst.%v", cia.UUID)
subProcessName = fmt.Sprintf("REQSUBCopyDst.%v", cia.UUID)
m := Method(subProcessName)
sub := newSubjectNoVerifyHandler(m, node)