mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
putting all elements into cia at src at creation
This commit is contained in:
parent
c7eec5a196
commit
10579e0e5d
1 changed files with 16 additions and 4 deletions
|
@ -98,9 +98,18 @@ func (m methodREQCopySrc) handler(proc process, message Message, node string) ([
|
||||||
dstFile := filepath.Base(DstFilePath)
|
dstFile := filepath.Base(DstFilePath)
|
||||||
m := Method(subProcessName)
|
m := Method(subProcessName)
|
||||||
|
|
||||||
|
// Also choosing to create the naming for the dst method here so
|
||||||
|
// we can have all the information in the cia from the beginning
|
||||||
|
// at both ends.
|
||||||
|
dstSubProcessName := fmt.Sprintf("REQSUBCopyDst.%v", uid.String())
|
||||||
|
dstM := Method(dstSubProcessName)
|
||||||
|
|
||||||
cia := copyInitialData{
|
cia := copyInitialData{
|
||||||
UUID: uid.String(),
|
UUID: uid.String(),
|
||||||
|
SrcNode: proc.node,
|
||||||
SrcMethod: m,
|
SrcMethod: m,
|
||||||
|
DstNode: Node(DstNode),
|
||||||
|
DstMethod: dstM,
|
||||||
SrcFilePath: SrcFilePath,
|
SrcFilePath: SrcFilePath,
|
||||||
DstDir: dstDir,
|
DstDir: dstDir,
|
||||||
DstFile: dstFile,
|
DstFile: dstFile,
|
||||||
|
@ -209,10 +218,9 @@ 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(cia.DstMethod, node)
|
||||||
sub := newSubjectNoVerifyHandler(m, node)
|
|
||||||
|
|
||||||
// Create a new sub process that will do the actual file copying.
|
// Create a new sub process that will do the actual file copying.
|
||||||
copyDstSubProc := newProcess(ctx, proc.server, sub, processKindSubscriber, nil)
|
copyDstSubProc := newProcess(ctx, proc.server, sub, processKindSubscriber, nil)
|
||||||
|
@ -288,6 +296,7 @@ func copySrcSubProcFunc(proc process, cia copyInitialData) func(context.Context,
|
||||||
|
|
||||||
// Do action based on copyStatus received.
|
// Do action based on copyStatus received.
|
||||||
for {
|
for {
|
||||||
|
fmt.Printf("\n * DEBUG: copySrcSubProcFunc: cia contains: %+v\n\n", cia)
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
log.Printf(" * copySrcProcFunc ENDED: %v\n", proc.processName)
|
log.Printf(" * copySrcProcFunc ENDED: %v\n", proc.processName)
|
||||||
|
@ -362,6 +371,8 @@ func copyDstSubProcFunc(proc process, cia copyInitialData, message Message) func
|
||||||
Data: csaSerialized,
|
Data: csaSerialized,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Printf("\n ***** DEBUG: copyDstSubProcFunc: cia.SrcMethod: %v\n\n ", cia.SrcMethod)
|
||||||
|
|
||||||
sam, err := newSubjectAndMessage(msg)
|
sam, err := newSubjectAndMessage(msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("copyDstProcSubFunc: newSubjectAndMessage failed: %v\n", err)
|
log.Fatalf("copyDstProcSubFunc: newSubjectAndMessage failed: %v\n", err)
|
||||||
|
@ -370,6 +381,7 @@ func copyDstSubProcFunc(proc process, cia copyInitialData, message Message) func
|
||||||
proc.toRingbufferCh <- []subjectAndMessage{sam}
|
proc.toRingbufferCh <- []subjectAndMessage{sam}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
fmt.Printf("\n * DEBUG: copyDstSubProcFunc: cia contains: %+v\n\n", cia)
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
log.Printf(" * copyDstProcFunc ended: %v\n", proc.processName)
|
log.Printf(" * copyDstProcFunc ended: %v\n", proc.processName)
|
||||||
|
|
Loading…
Reference in a new issue