File: ListThread_InodeAction.cpp

package info (click to toggle)
ultracopier 2.2.6.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 40,480 kB
  • sloc: ansic: 60,903; cpp: 59,790; sh: 6,882; asm: 723; xml: 675; makefile: 320; perl: 264
file content (91 lines) | stat: -rwxr-xr-x 5,025 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/** \file ListThread_InodeAction.cpp
\brief To be included into ListThread.cpp, to optimize and prevent code duplication
\see ListThread.cpp */

#ifdef LISTTHREAD_H

//do the inode action
ActionToDoInode& currentActionToDoInode=actionToDoListInode[int_for_internal_loop];
switch(currentActionToDoInode.type)
{
    case ActionType_RealMove:
        ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"launch real move, source: "+TransferThread::internalStringTostring(currentActionToDoInode.source)+
                                 ", destination: "+TransferThread::internalStringTostring(currentActionToDoInode.destination));
        mkPathQueue.addPath(currentActionToDoInode.source,currentActionToDoInode.destination,currentActionToDoInode.type);
        currentActionToDoInode.isRunning=true;
        numberOfInodeOperation++;
        if(numberOfInodeOperation>=inodeThreads)
            return;
    break;
    case ActionType_MkPath:
        ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"launch mkpath, source: "+TransferThread::internalStringTostring(currentActionToDoInode.source)+
                                 ", destination: "+TransferThread::internalStringTostring(currentActionToDoInode.destination));
        mkPathQueue.addPath(currentActionToDoInode.source,currentActionToDoInode.destination,currentActionToDoInode.type);
        currentActionToDoInode.isRunning=true;
        numberOfInodeOperation++;
        if(numberOfInodeOperation>=inodeThreads)
            return;
    break;
    #ifdef ULTRACOPIER_PLUGIN_RSYNC
    case ActionType_RmSync:
        ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"launch rmsync, source: "+TransferThread::internalStringTostring(currentActionToDoInode.source)+
                                 ", destination: "+TransferThread::internalStringTostring(currentActionToDoInode.destination));
        mkPathQueue.addPath(currentActionToDoInode.destination,currentActionToDoInode.destination,currentActionToDoInode.type);
        currentActionToDoInode.isRunning=true;
        numberOfInodeOperation++;
        if(numberOfInodeOperation>=inodeThreads)
            return;
    break;
    #endif
    case ActionType_MovePath:
        //then empty (no file), can try remove it
        if(currentActionToDoInode.size==0 || actionToDoListTransfer.empty())//don't put afterTheTransfer because actionToDoListInode_afterTheTransfer -> already afterTheTransfer
        {
            ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"launch rmpath: source: "+TransferThread::internalStringTostring(currentActionToDoInode.source)+
                                     ", destination: "+TransferThread::internalStringTostring(currentActionToDoInode.destination));
            mkPathQueue.addPath(currentActionToDoInode.source,currentActionToDoInode.destination,currentActionToDoInode.type);
            currentActionToDoInode.isRunning=true;
            numberOfInodeOperation++;
            if(numberOfInodeOperation>=inodeThreads)
                return;
        }
        else //have do the destination, put the remove to after
        {
            currentActionToDoInode.size=0;//why just not do .size--?
            actionToDoListInode_afterTheTransfer.push_back(currentActionToDoInode);
            actionToDoListInode.erase(actionToDoListInode.cbegin()+int_for_internal_loop);
            int_for_internal_loop--;
            actionToDoListInode_count--;
            if(numberOfInodeOperation>=inodeThreads)
                return;
        }
    break;
    case ActionType_SyncDate:
        //then empty (no file), can try remove it
        if(currentActionToDoInode.size==0 || actionToDoListTransfer.empty())//don't put afterTheTransfer because actionToDoListInode_afterTheTransfer -> already afterTheTransfer
        {
            ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"launch rmpath: source: "+TransferThread::internalStringTostring(currentActionToDoInode.source)+
                                     ", destination: "+TransferThread::internalStringTostring(currentActionToDoInode.destination));
            mkPathQueue.addPath(currentActionToDoInode.source,currentActionToDoInode.destination,currentActionToDoInode.type);
            currentActionToDoInode.isRunning=true;
            numberOfInodeOperation++;
            if(numberOfInodeOperation>=inodeThreads)
                return;
        }
        else //have do the destination, put the remove to after
        {
            currentActionToDoInode.size=0;//why just not do .size--?
            actionToDoListInode_afterTheTransfer.push_back(currentActionToDoInode);
            actionToDoListInode.erase(actionToDoListInode.cbegin()+int_for_internal_loop);
            int_for_internal_loop--;
            actionToDoListInode_count--;
            if(numberOfInodeOperation>=inodeThreads)
                return;
        }
    break;
    default:
        ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Wrong type at inode action");
    return;
}

#endif