mirror of
https://github.com/postmannen/ctrl.git
synced 2025-03-15 10:57:42 +00:00
Renamed REQSub to REQSUB
This commit is contained in:
parent
1895fcb398
commit
c4e384b987
2 changed files with 10 additions and 10 deletions
16
requests.go
16
requests.go
|
@ -110,9 +110,9 @@ const (
|
||||||
// Generated by the source to send initial information to the destination.
|
// Generated by the source to send initial information to the destination.
|
||||||
REQCopyDst Method = "REQCopyDst"
|
REQCopyDst Method = "REQCopyDst"
|
||||||
// Read the source file to be copied to some node.
|
// Read the source file to be copied to some node.
|
||||||
REQSubCopySrc Method = "REQSubCopySrc"
|
REQSUBCopySrc Method = "REQSUBCopySrc"
|
||||||
// Write the destination copied to some node.
|
// Write the destination copied to some node.
|
||||||
REQSubCopyDst Method = "REQSubCopyDst"
|
REQSUBCopyDst Method = "REQSUBCopyDst"
|
||||||
// Send Hello I'm here message.
|
// Send Hello I'm here message.
|
||||||
REQHello Method = "REQHello"
|
REQHello Method = "REQHello"
|
||||||
// Error log methods to centralError node.
|
// Error log methods to centralError node.
|
||||||
|
@ -240,10 +240,10 @@ func (m Method) GetMethodsAvailable() MethodsAvailable {
|
||||||
REQCopyDst: methodREQCopyDst{
|
REQCopyDst: methodREQCopyDst{
|
||||||
event: EventACK,
|
event: EventACK,
|
||||||
},
|
},
|
||||||
REQSubCopySrc: methodREQSub{
|
REQSUBCopySrc: methodREQSUB{
|
||||||
event: EventACK,
|
event: EventACK,
|
||||||
},
|
},
|
||||||
REQSubCopyDst: methodREQSub{
|
REQSUBCopyDst: methodREQSUB{
|
||||||
event: EventACK,
|
event: EventACK,
|
||||||
},
|
},
|
||||||
REQHello: methodREQHello{
|
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
|
// 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
|
// 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.
|
// same logic with sub process requests as we do with normal requests.
|
||||||
type methodREQSub struct {
|
type methodREQSUB struct {
|
||||||
event Event
|
event Event
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m methodREQSub) getKind() Event {
|
func (m methodREQSUB) getKind() Event {
|
||||||
return m.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
|
// proc.procFuncCh <- message
|
||||||
ackMsg := []byte("confirmed from: " + node + ": " + fmt.Sprint(message.ID))
|
ackMsg := []byte("confirmed from: " + node + ": " + fmt.Sprint(message.ID))
|
||||||
return ackMsg, nil
|
return ackMsg, nil
|
||||||
|
@ -420,7 +420,7 @@ type MethodsAvailable struct {
|
||||||
// will be returned.
|
// will be returned.
|
||||||
func (ma MethodsAvailable) CheckIfExists(m Method) (methodHandler, bool) {
|
func (ma MethodsAvailable) CheckIfExists(m Method) (methodHandler, bool) {
|
||||||
// First check if it is a sub process.
|
// 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.
|
// Strip of the uuid after the method name.
|
||||||
sp := strings.Split(string(m), ".")
|
sp := strings.Split(string(m), ".")
|
||||||
m = Method(sp[0])
|
m = Method(sp[0])
|
||||||
|
|
|
@ -91,7 +91,7 @@ func (m methodREQCopySrc) handler(proc process, message Message, node string) ([
|
||||||
|
|
||||||
// Create a subject for one copy request
|
// Create a subject for one copy request
|
||||||
uid := uuid.New()
|
uid := uuid.New()
|
||||||
subProcessName = fmt.Sprintf("REQSubCopySrc.%v", uid.String())
|
subProcessName = fmt.Sprintf("REQSUBCopySrc.%v", uid.String())
|
||||||
|
|
||||||
dstDir := filepath.Dir(DstFilePath)
|
dstDir := filepath.Dir(DstFilePath)
|
||||||
dstFile := filepath.Base(DstFilePath)
|
dstFile := filepath.Base(DstFilePath)
|
||||||
|
@ -206,7 +206,7 @@ func (m methodREQCopyDst) handler(proc process, message Message, node string) ([
|
||||||
ctx, _ := getContextForMethodTimeout(proc.ctx, message)
|
ctx, _ := getContextForMethodTimeout(proc.ctx, message)
|
||||||
|
|
||||||
// Create a subject for one copy request
|
// Create a subject for one copy request
|
||||||
subProcessName = fmt.Sprintf("REQSubCopyDst.%v", cia.UUID)
|
subProcessName = fmt.Sprintf("REQSUBCopyDst.%v", cia.UUID)
|
||||||
|
|
||||||
m := Method(subProcessName)
|
m := Method(subProcessName)
|
||||||
sub := newSubjectNoVerifyHandler(m, node)
|
sub := newSubjectNoVerifyHandler(m, node)
|
||||||
|
|
Loading…
Add table
Reference in a new issue