summaryrefslogtreecommitdiff
path: root/plugins/CopyEngine/Ultracopier-Spec/ListThread_InodeAction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/CopyEngine/Ultracopier-Spec/ListThread_InodeAction.cpp')
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ListThread_InodeAction.cpp91
1 files changed, 91 insertions, 0 deletions
diff --git a/plugins/CopyEngine/Ultracopier-Spec/ListThread_InodeAction.cpp b/plugins/CopyEngine/Ultracopier-Spec/ListThread_InodeAction.cpp
new file mode 100755
index 0000000..b26cb35
--- /dev/null
+++ b/plugins/CopyEngine/Ultracopier-Spec/ListThread_InodeAction.cpp
@@ -0,0 +1,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