Bläddra i källkod

HPCC-16630 Add expiry parameter to spray commands

Add 'expireDays' parameter to Spray, in Std.File ECl code and DfuPlus CLI.

Signed-off-by: Attila Vamos <attila.vamos@gmail.com>
Attila Vamos 8 år sedan
förälder
incheckning
5905ef42ad

+ 64 - 62
dali/dfu/dfurun.cpp

@@ -16,7 +16,7 @@
 ############################################################################## */
 
 /* todo
-test multiclusteradd 
+test multiclusteradd
 test multiclusteradd with replicate
 */
 
@@ -120,7 +120,7 @@ class CDFUengine: public CInterface, implements IDFUengine
         {
             if (repmode==REPbefore)
                 percentDone /= 2;
-            else 
+            else
                 if (repmode==REPduring)
                     percentDone = percentDone/2+50;
             progress->setProgress(percentDone, secsLeft, timeLeft, scaledDone, scaledTotal, scale,
@@ -155,14 +155,14 @@ class CDFUengine: public CInterface, implements IDFUengine
         }
         virtual bool abortRequested()
         {
-            if (abort&&!last) 
+            if (abort&&!last)
                 PROGLOG("ABORT checked");
             last = abort;
             return abort;
         }
-        void notifyAbort() 
+        void notifyAbort()
         {
-            if (!abort) 
+            if (!abort)
                 PROGLOG("ABORT notified");
             abort = true;
         }
@@ -193,10 +193,10 @@ class CDFUengine: public CInterface, implements IDFUengine
             }
             mask.clear().appendf("Job[@wuid=\"%s\"]",wuid);
             if (set&&!t->hasProp(mask.str())) {
-                
+
                 t->addPropTree("Job",createPTree())->setProp("@wuid",wuid);
             }
-            else 
+            else
                 t->removeProp(mask.str());
             serverstatus->commitProperties();
         }
@@ -272,12 +272,12 @@ class CDFUengine: public CInterface, implements IDFUengine
                                 PROGLOG("DFU %s waiting on queue %s",serv,queuename.get());
                             }
                             break;
-                        case DFUservermode_stop: 
+                        case DFUservermode_stop:
                             if (cancelling||(msTick()-start>5000))
                                 return 0;
                             start = msTick(); // remove enqueued stops
                             break;
-                        case DFUservermode_cycle: 
+                        case DFUservermode_cycle:
                                 onCycle();
                             break;
                         default:
@@ -289,7 +289,7 @@ class CDFUengine: public CInterface, implements IDFUengine
                         EXCLOG(e, "DFURUN Server Exception(1): ");
                         e->Release();
                     }
-                    
+
                 }
             }
             catch (IException *e) {
@@ -325,7 +325,7 @@ class CDFUengine: public CInterface, implements IDFUengine
         }
         virtual void onCycle()
         {
-            parent->monitorCycle(cancelling);           
+            parent->monitorCycle(cancelling);
         }
     };
 
@@ -334,7 +334,7 @@ class CDFUengine: public CInterface, implements IDFUengine
         unsigned mode = RTM_CREATE_QUERY | RTM_LOCK_READ | RTM_DELETE_ON_DISCONNECT;
         IRemoteConnection *runningconn = querySDS().connect(path, myProcessSession(), mode, SDS_CONNECT_TIMEOUT);
         if (runningconn) {
-            runningconn->queryRoot()->setPropBool("", true);    
+            runningconn->queryRoot()->setPropBool("", true);
             runningconn->commit();
         }
         return runningconn;
@@ -353,13 +353,13 @@ class CDFUengine: public CInterface, implements IDFUengine
         }
         ClusterPartDiskMapSpec spec;
         unsigned cn = file.findCluster(cluster);
-        if (cn!=NotFound) 
+        if (cn!=NotFound)
             spec = file.queryPartDiskMapping(cn);
         if (repeatlast)
             spec.setRepeatedCopies(file.numParts()-1,onlyrepeated);
         if (dir.length())
             spec.setDefaultBaseDir(dir.str());
-        if (cn==NotFound) 
+        if (cn==NotFound)
             file.addCluster(cluster,spec);
         else
             file.updatePartDiskMapping(cluster,spec);
@@ -441,14 +441,14 @@ class CDFUengine: public CInterface, implements IDFUengine
 
     Owned<IScheduleEventPusher> eventpusher;
     IArrayOf<cDFUlistener> listeners;
-    
+
     CriticalSection monitorsect;
     CriticalSection subcopysect;
     atomic_t runningflag;
 
 public:
     IMPLEMENT_IINTERFACE;
-    
+
     CDFUengine()
     {
         defaultTransferBufferSize = 0;
@@ -500,9 +500,9 @@ public:
             auditflags |= DALI_LDAP_WRITE_WANTED;
         SecAccessFlags perm = queryDistributedFileDirectory().getFDescPermissions(fd,user,auditflags);
         IDFS_Exception *e = NULL;
-        if (!HASREADPERMISSION(perm)) 
+        if (!HASREADPERMISSION(perm))
             throw MakeStringException(DFSERR_LookupAccessDenied,"Lookup permission denied for physical file(s)");
-        if (write&&!HASWRITEPERMISSION(perm)) 
+        if (write&&!HASWRITEPERMISSION(perm))
             throw MakeStringException(DFSERR_CreateAccessDenied,"Create permission denied for physical file(s)");
     }
 
@@ -522,7 +522,7 @@ public:
                 // check for other owner here TBD
                 iter->getId(wuid.clear());
                 Owned<IDFUWorkUnit> wu = factory->updateWorkUnit(wuid.str(),true);
-                if (!wu) 
+                if (!wu)
                     continue;
                 IDFUmonitor *monitor = wu->queryUpdateMonitor();
                 if (!monitor)
@@ -532,13 +532,13 @@ public:
                 if (monitor->getHandlerEp(handler)) {
                     if (!me->endpoint().equals(handler)) {
                         Owned<IGroup> grp = createIGroup(1,&handler);
-                        Owned<ICommunicator> comm = createCommunicator(grp,true); 
+                        Owned<ICommunicator> comm = createCommunicator(grp,true);
                         if (comm->verifyConnection(0,1000*60))  // shouldn't take long
                             continue;   // other handler running
                         monitor->setHandlerEp(me->endpoint());
                     }
                 }
-                else 
+                else
                     monitor->setHandlerEp(me->endpoint());
 
                 Owned<IUserDescriptor> userdesc = createUserDescriptor();
@@ -580,8 +580,8 @@ public:
 
     bool performMonitor(IDFUWorkUnit *wu,IDFUmonitor *monitor,IConstDFUfileSpec *source, bool raiseexception, StringAttrArray *eventstriggered, StringAttrArray *eventsfile, IUserDescriptor *user)
     {
-        
-        
+
+
         bool sub = monitor->getSub();
         StringBuffer lfn;
         source->getLogicalName(lfn);
@@ -695,7 +695,7 @@ public:
         return false;
     }
 
-    INode *getForeignDali(IConstDFUfileSpec *source) 
+    INode *getForeignDali(IConstDFUfileSpec *source)
     {
         SocketEndpoint ep;
         if (!source->getForeignDali(ep))
@@ -710,7 +710,7 @@ public:
         IDFUWorkUnitFactory *wufactory;
         IUserDescriptor *srcuser;
         IUserDescriptor *user;
-        IConstDFUWorkUnit *superwu;  
+        IConstDFUWorkUnit *superwu;
         IConstDFUfileSpec *superdestination;
         IConstDFUoptions *superoptions;
         IDFUprogress *superprogress;
@@ -743,7 +743,7 @@ public:
     bool doSubFileCopy(sSuperCopyContext &ctx,const char *dstlfn,INode *srcdali,const char *srclfn,StringAttr &wuid, bool iskey, const char *roxieprefix)
     {
         StringBuffer saveinprogress;
-        {   
+        {
             CriticalBlock block(subcopysect);
             Owned<IDFUWorkUnit> wu = ctx.wufactory->createWorkUnit();
             ctx.superprogress->getSubInProgress(saveinprogress);
@@ -868,7 +868,7 @@ public:
         // first see if target exists (and remove if does and overwrite specified)
         Owned<IDistributedFile> dfile = queryDistributedFileDirectory().lookup(dlfn,ctx.user,true);
         if (dfile) {
-            if (!ctx.superoptions->getOverwrite()) 
+            if (!ctx.superoptions->getOverwrite())
                 throw MakeStringException(-1,"Destination file %s already exists",dlfn.get());
             if (!dfile->querySuperFile())
             {
@@ -911,7 +911,7 @@ public:
                 if ((ctx.level==1)&&ctx.feedback)
                     ctx.feedback->displayProgress(numtodo?(numdone*100/numtodo):0,0,"unknown",0,0,"",0,0,0);
             }
-            // now construct the superfile          
+            // now construct the superfile
             Owned<IDistributedSuperFile> sfile = queryDistributedFileDirectory().createSuperFile(dlfn.get(),ctx.user,true,false);
             if (!sfile)
                 throw MakeStringException(-1,"SuperFile %s could not be created",dlfn.get());
@@ -949,11 +949,11 @@ public:
         }
         StringBuffer srcname;
         source->getLogicalName(srcname);
-        if (!srcname.length()) 
+        if (!srcname.length())
             throw MakeStringException(-1,"Source file not specified");
         StringBuffer dstname;
         destination->getLogicalName(dstname);
-        if (!dstname.length()) 
+        if (!dstname.length())
             throw MakeStringException(-1,"Destination not specified");
         sSuperCopyContext ctx;
         ctx.wufactory = wufactory;
@@ -1033,7 +1033,7 @@ public:
         wu->queryRecoveryStore(recoveryconn,recovery,runningpath.clear());
         DFUstate s = progress->getState();
         switch (s) {
-        case DFUstate_aborting:                     
+        case DFUstate_aborting:
         case DFUstate_started:                      // not sure what this for
             progress->setState(DFUstate_aborted);
             /* no break */
@@ -1080,13 +1080,13 @@ public:
             bool foreigncopy = false;
             // first check for 'specials' (e.g. multi-cluster keydiff etc)
             switch (cmd) {
-            case DFUcmd_copy: 
+            case DFUcmd_copy:
                 {
                     source->getDiffKey(tmp.clear());
-                    if (tmp.length()) 
+                    if (tmp.length())
                         diffNameSrc.set(tmp.str());
                     destination->getDiffKey(tmp.clear());
-                    if (tmp.length()) 
+                    if (tmp.length())
                         diffNameDst.set(tmp.str());
                     source->getLogicalName(tmp.clear());
                     CDfsLogicalFileName srclfn;
@@ -1117,7 +1117,7 @@ public:
             case DFUcmd_export:
                 {
                     source->getLogicalName(tmp.clear());
-                    if (!tmp.length()) 
+                    if (!tmp.length())
                         throw MakeStringException(-1,"Source file not specified");
                     foreigncopy = false;
                     if ((cmd==DFUcmd_copy)||multiclustermerge) {
@@ -1151,20 +1151,20 @@ public:
                                 opttree->setProp("@slave",progpath.str());
                             }
                         }
-                        if (options->getSubfileCopy()) 
+                        if (options->getSubfileCopy())
                             opttree->setPropBool("@compress",foreignfdesc->isCompressed());
                     }
-                    else { 
+                    else {
                         srcFile.setown(fdir.lookup(tmp.str(),userdesc,
                               (cmd==DFUcmd_move)||(cmd==DFUcmd_rename)||((cmd==DFUcmd_copy)&&multiclusterinsert)));
-                        if (!srcFile) 
+                        if (!srcFile)
                             throw MakeStringException(-1,"Source file %s could not be found",tmp.str());
                         oldRoxiePrefix.set(srcFile->queryAttributes().queryProp("@roxiePrefix"));
                         iskey = isFileKey(srcFile);
                         kind.set(srcFile->queryAttributes().queryProp("@kind"));
                         if (destination->getWrap()||(iskey&&(cmd==DFUcmd_copy)))    // keys default wrap for copy
                             destination->setNumPartsOverride(srcFile->numParts());
-                        if (options->getSubfileCopy()) 
+                        if (options->getSubfileCopy())
                             opttree->setPropBool("@compress",srcFile->isCompressed());
                     }
                     if (destination->getMultiCopy()&&!destination->getWrap()) {
@@ -1185,7 +1185,7 @@ public:
                 {
                     destination->getLogicalName(tmp.clear());
                     if (tmp.length()) {
-                        CDfsLogicalFileName tmpdlfn;        
+                        CDfsLogicalFileName tmpdlfn;
                         StringBuffer newroxieprefix;
                         constructDestinationName(tmp.str(),oldRoxiePrefix,destination,tmpdlfn,newroxieprefix);
                         tmp.clear().append(tmpdlfn.get());
@@ -1196,12 +1196,12 @@ public:
                             if (grp.get()) {
                                 switch (queryOS(grp->queryNode(0).endpoint())) {
                                 case MachineOsW2K:
-                                    destination->setWindowsOS(true); 
+                                    destination->setWindowsOS(true);
                                     iswin = false;
                                     break;
                                 case MachineOsSolaris:
                                 case MachineOsLinux:
-                                    destination->setWindowsOS(false); 
+                                    destination->setWindowsOS(false);
                                     iswin = false;
                                     break;
                                 };
@@ -1209,7 +1209,7 @@ public:
                         }
                         if (destination->getWrap()) {
                             Owned<IFileDescriptor> fdesc = source?source->getFileDescriptor():NULL;
-                            if (fdesc) 
+                            if (fdesc)
                                 destination->setNumPartsOverride(fdesc->numParts());
                         }
 
@@ -1219,6 +1219,8 @@ public:
                         if (options->getRecordStructurePresent())
                             opttree->setPropBool("@recordStructurePresent", true);
 
+                        opttree->setPropInt("@expireDays", options->getExpireDays());
+
                         opttree->setPropBool("@quotedTerminator", options->getQuotedTerminator());
                         Owned<IFileDescriptor> fdesc = destination->getFileDescriptor(iskey,options->getSuppressNonKeyRepeats()&&!iskey);
                         if (fdesc) {
@@ -1241,7 +1243,7 @@ public:
                             }
                             else if (multiclustermerge) {
                                 dstFile.setown(fdir.lookup(tmp.str(),userdesc,true));
-                                if (!dstFile) 
+                                if (!dstFile)
                                     throw MakeStringException(-1,"Destination for merge %s does not exist",tmp.str());
                                 StringBuffer err;
                                 if (!dstFile->checkClusterCompatible(*fdesc,err))
@@ -1272,7 +1274,7 @@ public:
                                 fdesc->queryProperties().setProp("@kind", "key");
                             else if (kind.length()) // JCSMORE may not really need separate "if (iskey)" line above
                                 fdesc->queryProperties().setProp("@kind", kind);
-                            if (multiclusterinsert||multiclustermerge) 
+                            if (multiclusterinsert||multiclustermerge)
                                 multifdesc.setown(fdesc.getClear());
                             else
                                 dstFile.setown(fdir.createNew(fdesc));
@@ -1290,7 +1292,7 @@ public:
                 opttree->setPropInt("@transferBufferSize",defaultTransferBufferSize);
 
             switch (cmd) {
-            case DFUcmd_none: 
+            case DFUcmd_none:
                 break;
             case DFUcmd_copymerge:
             case DFUcmd_copy:
@@ -1301,9 +1303,9 @@ public:
                         if (diffNameSrc.get()||diffNameDst.get()) {
                             Owned<IFileDescriptor> newf;
                             Owned<IFileDescriptor> oldf;
-                            if (foreigncopy) 
+                            if (foreigncopy)
                                 newf.set(foreignfdesc);
-                            else 
+                            else
                                 newf.setown(srcFile->getFileDescriptor());
                             oldf.setown(queryDistributedFileDirectory().getFileDescriptor(diffNameSrc,foreigncopy?foreignuserdesc:userdesc,foreigncopy?foreigndalinode:NULL));
                             if (!oldf.get()) {
@@ -1323,7 +1325,7 @@ public:
                         ClusterPartDiskMapSpec mspec;
                         if (destination) {
                             if (destination->numClusters()==1) {
-                                destination->getClusterPartDiskMapSpec(0,mspec);  
+                                destination->getClusterPartDiskMapSpec(0,mspec);
                                 if (!mspec.isReplicated())
                                     needrep = false;
                             }
@@ -1336,16 +1338,16 @@ public:
                         }
                         if (needrep)
                             feedback.repmode=cProgressReporter::REPbefore;
-                        if (foreigncopy) 
+                        if (foreigncopy)
                             checkPhysicalFilePermissions(foreignfdesc,userdesc,false);
                         if (patchf) { // patch assumes only 1 cluster
                             // need to create dstpatchf
                             StringBuffer gname;
-                            destination->getGroupName(0,gname);  
+                            destination->getGroupName(0,gname);
                             if (!gname.length())
                                 throw MakeStringException(-1,"No cluster specified for destination");
                             Owned<IGroup> grp = queryNamedGroupStore().lookup(gname.str());
-                            if (!grp) 
+                            if (!grp)
                                 throw MakeStringException(-1,"Destination cluster %s not found",gname.str());
                             StringBuffer lname;
                             destination->getLogicalName(lname);
@@ -1367,7 +1369,7 @@ public:
                             doKeyPatch(olddstf,newf,dstpatchf);
                             removePartFiles(dstpatchf);
                             if (!abortnotify.abortRequested()) {
-                                if (needrep) 
+                                if (needrep)
                                     replicating = true;
                                 else
                                     dstFile->attach(dstName.get(), userdesc);
@@ -1377,7 +1379,7 @@ public:
                         else if (foreigncopy||auxfdesc) {
                             fsys.import(auxfdesc.get()?auxfdesc.get():foreignfdesc.get(), dstFile, recovery, recoveryconn, filter, opttree, &feedback, &abortnotify, dfuwuid);
                             if (!abortnotify.abortRequested()) {
-                                if (needrep) 
+                                if (needrep)
                                     replicating = true;
                                 else
                                     dstFile->attach(dstName.get(), userdesc);
@@ -1387,7 +1389,7 @@ public:
                         else if (multiclusterinsert||multiclustermerge) {
                             fsys.exportFile(srcFile, multifdesc, recovery, recoveryconn, filter, opttree, &feedback, &abortnotify, dfuwuid);
                             if (!abortnotify.abortRequested()) {
-                                if (needrep) 
+                                if (needrep)
                                     replicating = true;
                                 else {
                                     StringBuffer cname;
@@ -1402,7 +1404,7 @@ public:
                         else {
                             fsys.copy(srcFile,dstFile,recovery, recoveryconn, filter, opttree, &feedback, &abortnotify, dfuwuid);
                             if (!abortnotify.abortRequested()) {
-                                if (needrep) 
+                                if (needrep)
                                     replicating = true;
                                 else
                                     dstFile->attach(dstName.get(),userdesc);
@@ -1422,7 +1424,7 @@ public:
                         Audit("REMOVE",userdesc,tmp.clear(),NULL);
                         runningconn.clear();
                     }
-                    else { 
+                    else {
                         throw MakeStringException(-1,"No target name specified for remove");
                     }
                 }
@@ -1471,7 +1473,7 @@ public:
                 {
                     runningconn.setown(setRunning(runningpath.str()));
                     DaftReplicateMode mode = DRMreplicatePrimary;
-                    StringBuffer repcluster; 
+                    StringBuffer repcluster;
                     bool repeatlast;
                     bool onlyrepeated;
                     switch (options->getReplicateMode(repcluster,repeatlast,onlyrepeated)) {
@@ -1506,7 +1508,7 @@ public:
                         ClusterPartDiskMapSpec mspec;
                         if (destination) {
                             if (destination->numClusters()==1) {
-                                destination->getClusterPartDiskMapSpec(0,mspec); 
+                                destination->getClusterPartDiskMapSpec(0,mspec);
                                 if (!mspec.isReplicated())
                                     needrep = false;
                             }
@@ -1521,7 +1523,7 @@ public:
                             feedback.repmode=cProgressReporter::REPbefore;
                         fsys.import(fdesc, dstFile, recovery, recoveryconn, filter, opttree, &feedback, &abortnotify, dfuwuid);
                         if (!abortnotify.abortRequested()) {
-                            if (needrep) 
+                            if (needrep)
                                 replicating = true;
                             else
                                 dstFile->attach(dstName.get(), userdesc);
@@ -1563,7 +1565,7 @@ public:
                     runningconn.clear();
                 }
                 break;
-            case DFUcmd_monitor: 
+            case DFUcmd_monitor:
                 {
                     CriticalBlock block(monitorsect);
                     // first check done when WU received
@@ -1591,7 +1593,7 @@ public:
             if (replicating) {
                 switch (cmd) {
                 case DFUcmd_copymerge:
-                case DFUcmd_copy:   
+                case DFUcmd_copy:
                 case DFUcmd_import:{
                         if (feedback.repmode==cProgressReporter::REPbefore)
                             feedback.repmode=cProgressReporter::REPduring;

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 168 - 158
dali/dfu/dfuwu.cpp


+ 35 - 33
dali/dfu/dfuwu.hpp

@@ -50,16 +50,16 @@ enum DFUstate
 
 enum DFUcmd
 {
-    DFUcmd_none, 
-    DFUcmd_copy, 
-    DFUcmd_remove, 
-    DFUcmd_move, 
-    DFUcmd_rename, 
-    DFUcmd_replicate, 
-    DFUcmd_import, 
-    DFUcmd_export, 
-    DFUcmd_add, 
-    DFUcmd_transfer, 
+    DFUcmd_none,
+    DFUcmd_copy,
+    DFUcmd_remove,
+    DFUcmd_move,
+    DFUcmd_rename,
+    DFUcmd_replicate,
+    DFUcmd_import,
+    DFUcmd_export,
+    DFUcmd_add,
+    DFUcmd_transfer,
     DFUcmd_savemap,             // Cmd line only currently
     DFUcmd_addgroup,            // Cmd line only currently
     DFUcmd_server,              // Cmd line only
@@ -68,7 +68,7 @@ enum DFUcmd
     DFUcmd_supercopy
 };
 
-enum DFUreplicateMode 
+enum DFUreplicateMode
 {
     DFURMprimary,
     DFURMsecondary,
@@ -128,8 +128,8 @@ enum DFUsortfield
 
 enum DFUclusterPartDiskMapping // legacy - should use ClusterPartDiskMapSpec instead
 {
-    DFUcpdm_c_replicated_by_d = 0,   // default 
-    DFUcpdm_c_only,                 
+    DFUcpdm_c_replicated_by_d = 0,   // default
+    DFUcpdm_c_only,
     DFUcpdm_d_only,
     DFUcpdm_c_then_d
 };
@@ -160,7 +160,7 @@ interface IConstDFUoptions : extends IInterface
     virtual const char * querySplitPrefix() const = 0;
     virtual bool getCrcCheck() const = 0;
     virtual bool getNoRecover() const = 0;
-    virtual bool getIfNewer() const = 0;    
+    virtual bool getIfNewer() const = 0;
     virtual bool getIfModified() const = 0;                             // for 'smart' super copy
     virtual bool getSlavePathOverride(StringBuffer &path) const = 0;
     virtual bool getSuppressNonKeyRepeats() const = 0;
@@ -172,6 +172,7 @@ interface IConstDFUoptions : extends IInterface
     virtual bool getQuotedTerminator() const = 0;
     virtual bool getPreserveCompression() const = 0;
     virtual StringBuffer &getUMask(StringBuffer &str)const =0;
+    virtual int getExpireDays() const = 0;
 };
 
 interface IDFUoptions : extends IConstDFUoptions
@@ -200,7 +201,7 @@ interface IDFUoptions : extends IConstDFUoptions
     virtual void setSplitPrefix(const char *str) = 0;
     virtual void setCrcCheck(bool val=true) = 0;
     virtual void setNoRecover(bool val=true) = 0;
-    virtual void setIfNewer(bool val=true) = 0;         
+    virtual void setIfNewer(bool val=true) = 0;
     virtual void setIfModified(bool val=true) = 0;                  // for 'smart' super copy
     virtual void setSlavePathOverride(const char *path) = 0;
     virtual void setSuppressNonKeyRepeats(bool val=true) = 0;
@@ -211,6 +212,7 @@ interface IDFUoptions : extends IConstDFUoptions
     virtual void setQuotedTerminator(bool val=true) = 0;
     virtual void setPreserveCompression(bool val=true) = 0;
     virtual void setUMask(const char *val) = 0;
+    virtual void setExpireDays(int val) = 0;
 };
 
 interface IConstDFUfileSpec: extends IInterface
@@ -224,8 +226,8 @@ interface IConstDFUfileSpec: extends IInterface
     virtual StringBuffer &getGroupName(unsigned cluster,StringBuffer &str) const = 0;       // i.e. cluster name if known
     virtual IPropertyTree *queryProperties() const = 0;
     virtual size32_t getRecordSize() const = 0;
-    virtual size32_t getMaxRecordSize() const = 0;  
-    virtual DFUfileformat getFormat() const = 0; 
+    virtual size32_t getMaxRecordSize() const = 0;
+    virtual DFUfileformat getFormat() const = 0;
     virtual StringBuffer &getPartUrl(unsigned clustnum,unsigned partidx, StringBuffer &url,bool iskey=false) const = 0; // idx 0 based
     virtual RemoteFilename &getPartFilename(unsigned clustnum,unsigned partidx, RemoteFilename &rfn, bool iskey=false) const = 0; // idx 0 based
     virtual IPropertyTree *queryPartProperties(unsigned partidx) const = 0;
@@ -233,7 +235,7 @@ interface IConstDFUfileSpec: extends IInterface
     virtual StringBuffer &getRowTag(StringBuffer &str)const =0;
     virtual void setForeignDali(const SocketEndpoint &ep)=0; // only used for source of copy (for inter-dali copy)
     virtual bool getForeignDali(SocketEndpoint &ep) const =0;
-    virtual void setForeignUser(const char *user,const char *password)=0; 
+    virtual void setForeignUser(const char *user,const char *password)=0;
     virtual bool getForeignUser(StringBuffer &user,StringBuffer &password) const =0; // only if foreign dali set
     virtual bool isCompressed() const = 0;
     virtual bool getWrap() const = 0;
@@ -257,16 +259,16 @@ interface IDFUfileSpec: extends IConstDFUfileSpec
 // only subsets of these are used for setup depending on src/dest type
 // see testDFUWU in dfuwu.cpp for examples
     virtual void setLogicalName(const char *val) = 0;
-    virtual void setDirectory(const char *val)  = 0;                
-    virtual void setFileMask(const char *val) = 0;                  
-    virtual void setGroupName(const char *val) = 0;                 // i.e. cluster name 
-    virtual void setFromFileDescriptor(IFileDescriptor &fd) = 0;    // alter 
+    virtual void setDirectory(const char *val)  = 0;
+    virtual void setFileMask(const char *val) = 0;
+    virtual void setGroupName(const char *val) = 0;                 // i.e. cluster name
+    virtual void setFromFileDescriptor(IFileDescriptor &fd) = 0;    // alter
     virtual void setSingleFilename(RemoteFilename &rfn) = 0;
     virtual void setMultiFilename(RemoteMultiFilename &rmfn) = 0;
     virtual void setTitle(const char *val) = 0; //used for error messages etc (defaults to logical name)
     virtual void setRecordSize(size32_t size) = 0; // may need to be supplied for non 1-1 splits
-    virtual void setMaxRecordSize(size32_t size) = 0; 
-    virtual void setFormat(DFUfileformat format) = 0; 
+    virtual void setMaxRecordSize(size32_t size) = 0;
+    virtual void setFormat(DFUfileformat format) = 0;
     virtual void setCsvOptions(const char *separate=NULL,const char *terminate=NULL,const char *quote=NULL,const char *escape=NULL,bool quotedTerminator=true) = 0;  // NULL for default
     virtual void setRowTag(const char *str) = 0;
     virtual void setFromXML(const char *xml) = 0;
@@ -275,9 +277,9 @@ interface IDFUfileSpec: extends IConstDFUfileSpec
     virtual void setReplicateOffset(int val) = 0;           // sets for all clusters
     virtual void setDiffKey(const char *keyname) = 0;
     virtual void setMultiCopy(bool val) = 0;
-    virtual void setClusterPartDiskMapSpec(const char* clustername,ClusterPartDiskMapSpec &spec) = 0; 
-    virtual void setClusterPartDefaultBaseDir(const char* clustername,const char *basedir) = 0; 
-    virtual void setClusterPartDiskMapping(DFUclusterPartDiskMapping val,const char *basedir, const char *clustername, bool repeatlast=false, bool onlyrepeated=false) = 0; 
+    virtual void setClusterPartDiskMapSpec(const char* clustername,ClusterPartDiskMapSpec &spec) = 0;
+    virtual void setClusterPartDefaultBaseDir(const char* clustername,const char *basedir) = 0;
+    virtual void setClusterPartDiskMapping(DFUclusterPartDiskMapping val,const char *basedir, const char *clustername, bool repeatlast=false, bool onlyrepeated=false) = 0;
     virtual IPropertyTree *setProperties(IPropertyTree *val) = 0;   // takes ownershop of val
     virtual IPropertyTree *queryUpdateProperties() = 0;
     virtual IPropertyTree *queryUpdatePartProperties(unsigned partidx) = 0;
@@ -410,11 +412,11 @@ interface IDFUWorkUnit : extends IConstDFUWorkUnit
     virtual IDFUprogress *queryUpdateProgress() = 0;
     virtual IDFUmonitor *queryUpdateMonitor() = 0;
     virtual void closeUpdate() = 0;                     // called before WU obtained by openUpdate is released
-    virtual void queryRecoveryStore(IRemoteConnection *& conn,IPropertyTree *&tree,StringBuffer &runningpath) = 0; // not nice - needed by daft 
+    virtual void queryRecoveryStore(IRemoteConnection *& conn,IPropertyTree *&tree,StringBuffer &runningpath) = 0; // not nice - needed by daft
     virtual void removeRecoveryStore() = 0;
     virtual void addException(IException *e)=0;
     virtual void setTimeScheduled(const CDateTime &val) = 0;
-    virtual unsigned getEdition(bool local) = 0;            
+    virtual unsigned getEdition(bool local) = 0;
     virtual void setApplicationValue(const char * application, const char * propname, const char * value, bool overwrite) = 0;
     virtual void setApplicationValueInt(const char * application, const char * propname, int value, bool overwrite) = 0;
     virtual void setDebugValue(const char *propname, const char *value, bool overwrite) = 0;
@@ -439,7 +441,7 @@ interface IDFUWorkUnitFactory : extends IInterface
     virtual bool deleteWorkUnit(const char * wuid) = 0;
     virtual IConstDFUWorkUnit * openWorkUnit(const char * wuid, bool lock) = 0;
     virtual IConstDFUWorkUnitIterator * getWorkUnitsByXPath(const char *xpath) = 0;
-    virtual IConstDFUWorkUnitIterator * getWorkUnitsByOwner(const char * owner) = 0; 
+    virtual IConstDFUWorkUnitIterator * getWorkUnitsByOwner(const char * owner) = 0;
     virtual IConstDFUWorkUnitIterator * getWorkUnitsByState(DFUstate state) = 0;
     // more get functions (e.g. by date) could be added
     virtual IDFUWorkUnit * updateWorkUnit(const char * wuid,bool exclusive=false) = 0;
@@ -448,7 +450,7 @@ interface IDFUWorkUnitFactory : extends IInterface
                                                         const void *filterbuf,      // list of 0 termintated strings for filter values
                                                         unsigned startoffset,
                                                         unsigned maxnum,
-                                                        const char *queryowner, 
+                                                        const char *queryowner,
                                                         __int64 *cachehint,         // set to NULL if caching not required
                                                         unsigned *total) = 0;       // set to NULL if caching not required
     virtual unsigned numWorkUnits()=0;
@@ -482,7 +484,7 @@ class CDFUfileformat
     DFF_MAP1(DFUff_recfmvb,             "recfmvb") \
     DFF_MAP1(DFUff_recfmv,              "recfmv") \
     DFF_MAP1(DFUff_variablebigendian,   "variablebigendian") \
-    DFF_MAP1(DFUff_fixed,               "fixed") 
+    DFF_MAP1(DFUff_fixed,               "fixed")
 public:
     static inline DFUfileformat decode(const char * str)
     {
@@ -510,5 +512,5 @@ extern dfuwu_decl unsigned queuedJobs(const char *queuename,StringAttrArray &wul
 extern dfuwu_decl IDfuFileCopier *createRemoteFileCopier(const char *qname,const char *clustername, const char *jobname, bool replicate);
 
 
-#endif 
+#endif
 

+ 6 - 0
dali/dfuplus/dfuplus.cpp

@@ -350,6 +350,9 @@ bool CDfuPlusHelper::fixedSpray(const char* srcxml,const char* srcip,const char*
     if(globals->hasProp("failIfNoSourceFile"))
         req->setFailIfNoSourceFile(globals->getPropBool("failIfNoSourceFile",false));
 
+    if(globals->hasProp("expireDays"))
+        req->setExpireDays(globals->getPropInt("expireDays"));
+
     if(srcxml == NULL)
         info("\nFixed spraying from %s on %s to %s\n", srcfile, srcip, dstname);
     else
@@ -494,6 +497,9 @@ bool CDfuPlusHelper::variableSpray(const char* srcxml,const char* srcip,const ch
     if(globals->hasProp("quotedTerminator"))
         req->setQuotedTerminator(globals->getPropBool("quotedTerminator",true));
 
+    if(globals->hasProp("expireDays"))
+        req->setExpireDays(globals->getPropInt("expireDays"));
+
     if(srcxml == NULL)
         info("\nVariable spraying from %s on %s to %s\n", srcfile, srcip, dstname);
     else

+ 1 - 0
dali/dfuplus/main.cpp

@@ -69,6 +69,7 @@ void handleSyntax()
     out.append("        dstcluster=<cluster-name>\n");
     out.append("        format=fixed|csv|delimited|xml|json|variable|recfmv|recfmvb\n");
     out.append("        prefix=filename{:length},filesize{:[B|L][1-8]}\n");
+    out.append("        expireDays=<days-to-auto-delete-file>  -- optional, default is '' (empty), no expire\n");
     out.append("        options for fixed:\n");
     out.append("            recordsize=<record-size>\n");
     out.append("        options for csv/delimited:\n");

+ 6 - 0
dali/ft/filecopy.cpp

@@ -3309,6 +3309,12 @@ void FileSprayer::updateTargetProperties()
             }
             curHistory->addPropTree("Origin",newRecord.getClear());
         }
+
+        int expireDays = options->getPropInt("@expireDays");
+        if (expireDays != -1)
+        {
+            curProps.setPropInt("@expireDays", expireDays);
+        }
     }
     if (error)
         throw error.getClear();

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 20 - 17
ecllibrary/std/File.ecl


+ 31 - 27
esp/scm/ws_fs.ecm

@@ -79,7 +79,7 @@ ESPStruct [nil_remove] DFUWorkunit
 
     // Monitor
     string MonitorEventName;
-    bool MonitorSub;                
+    bool MonitorSub;
     int MonitorShotLimit;
 
     string SourceDiffKeyName;
@@ -93,6 +93,7 @@ ESPStruct [nil_remove] DFUWorkunit
     [min_ver("1.09")] bool recordStructurePresent(false);
     [min_ver("1.10")] bool quotedTerminator(true);
     [min_ver("1.12")] bool preserveCompression(true);
+    [min_ver("1.14")] int expireDays;
 };
 
 ESPStruct [nil_remove] GroupNode
@@ -115,14 +116,14 @@ ESPStruct [nil_remove] DFUActionResult
     string Result;
 };
 
-ESPrequest 
+ESPrequest
 [
 ]
 DFUWUSearchRequest
 {
 };
 
-ESPresponse 
+ESPresponse
 [
    exceptions_inline
 ]
@@ -267,7 +268,7 @@ ESPrequest SubmitDFUWorkunit
     string wuid;
 };
 
-ESPresponse [exceptions_inline] 
+ESPresponse [exceptions_inline]
 SubmitDFUWorkunitResponse
 {
 };
@@ -277,7 +278,7 @@ ESPrequest AbortDFUWorkunit
     string wuid;
 };
 
-ESPresponse [exceptions_inline] 
+ESPresponse [exceptions_inline]
 AbortDFUWorkunitResponse
 {
 };
@@ -287,7 +288,7 @@ ESPrequest GetDFUExceptions
     string wuid;
 };
 
-ESPresponse [exceptions_inline] 
+ESPresponse [exceptions_inline]
 GetDFUExceptionsResponse
 {
     ESParray<ESPstruct DFUException> result;
@@ -327,10 +328,12 @@ ESPrequest [nil_remove] SprayFixed
     [min_ver("1.09")] bool recordStructurePresent(false);
 
     [min_ver("1.10")] bool quotedTerminator(true);
+
+    [min_ver("1.14")] int expireDays;
 };
 
-ESPresponse [exceptions_inline] 
-SprayFixedResponse 
+ESPresponse [exceptions_inline]
+SprayFixedResponse
 {
     string wuid;
 };
@@ -340,7 +343,7 @@ ESPrequest [nil_remove] SprayVariable
     string sourceIP;
     string sourcePath;
     binary srcxml;
-    
+
     int sourceMaxRecordSize;
     int sourceFormat;
     bool   NoSourceCsvSeparator(false);
@@ -357,12 +360,12 @@ ESPrequest [nil_remove] SprayVariable
     int    ReplicateOffset(1);
 
     int    maxConnections;
-    int    throttle;    
+    int    throttle;
     int    transferBufferSize;
 
     string prefix;
     bool   nosplit(false);
-    bool   norecover(false);    
+    bool   norecover(false);
     bool   compress(false);
     bool   push(false);
     bool   pull(false);
@@ -377,10 +380,11 @@ ESPrequest [nil_remove] SprayVariable
     [min_ver("1.10")] bool quotedTerminator(true);
     [min_ver("1.11")] string sourceRowPath;
     [min_ver("1.11")] bool isJSON(false);
+    [min_ver("1.14")] int expireDays;
 };
 
-ESPresponse [exceptions_inline] 
-SprayResponse 
+ESPresponse [exceptions_inline]
+SprayResponse
 {
     string wuid;
 };
@@ -392,9 +396,9 @@ ESPrequest [nil_remove] Replicate
     string cluster;
     bool   repeatLast(false);
     bool   onlyRepeated(false);
-};  
+};
 
-ESPresponse [exceptions_inline] 
+ESPresponse [exceptions_inline]
 ReplicateResponse
 {
     string wuid;
@@ -410,7 +414,7 @@ ESPrequest Despray
     bool   overwrite;
 
     int    maxConnections;
-    int    throttle;    
+    int    throttle;
     int    transferBufferSize;
 
     string splitprefix;
@@ -423,9 +427,9 @@ ESPrequest Despray
     string encrypt;
     string decrypt;
 
-};  
+};
 
-ESPresponse [exceptions_inline] 
+ESPresponse [exceptions_inline]
 DesprayResponse
 {
     string wuid;
@@ -445,7 +449,7 @@ ESPrequest [nil_remove] Copy
     int    ReplicateOffset(1);
 
     int    maxConnections;
-    int    throttle;    
+    int    throttle;
     int    transferBufferSize;
     bool   nosplit;
     bool   norecover(false);
@@ -466,7 +470,7 @@ ESPrequest [nil_remove] Copy
     [min_ver("1.12")] bool preserveCompression(true);
 };
 
-ESPresponse [exceptions_inline] 
+ESPresponse [exceptions_inline]
 CopyResponse
 {
     string result;
@@ -489,7 +493,7 @@ ESPrequest Rename
     bool   overwrite;
 };
 
-ESPresponse [exceptions_inline] 
+ESPresponse [exceptions_inline]
 RenameResponse
 {
     string wuid;
@@ -534,7 +538,7 @@ ESPresponse [exceptions_inline] FileListResponse
     int    OS;
     bool DirectoryOnly(false);
     [min_ver("1.10")] string AcceptLanguage;
-    ESParray<ESPStruct PhysicalFileStruct> files;   
+    ESParray<ESPStruct PhysicalFileStruct> files;
 };
 
 ESPrequest [nil_remove] DropZoneFileSearchRequest
@@ -600,7 +604,7 @@ ESPStruct [nil_remove] DropZone
     string NetAddress;
     string Path;
     string Computer;
-    string Linux;                          
+    string Linux;
 };
 
 ESPrequest DropZoneFilesRequest
@@ -618,8 +622,8 @@ ESPresponse [exceptions_inline, nil_remove] DropZoneFilesResponse
     string Path;
     int OS;
 
-    ESParray<ESPStruct DropZone> DropZones; 
-    ESParray<ESPStruct PhysicalFileStruct> Files;   
+    ESParray<ESPStruct DropZone> DropZones;
+    ESParray<ESPStruct PhysicalFileStruct> Files;
 };
 
 ESPrequest DeleteDropZoneFilesRequest
@@ -647,12 +651,12 @@ ESPrequest GetSprayTargetsRequest
 
 ESPresponse [exceptions_inline, nil_remove] GetSprayTargetsResponse
 {
-    ESParray<ESPstruct GroupNode, GroupNode> GroupNodes; 
+    ESParray<ESPstruct GroupNode, GroupNode> GroupNodes;
 };
 
 ESPservice [
     auth_feature("DEFERRED"),
-    version("1.13"),
+    version("1.14"),
     exceptions_inline("./smc_xslt/exceptions.xslt")] FileSpray
 {
     ESPuses ESPstruct DFUWorkunit;

+ 67 - 63
esp/services/ws_fs/ws_fsService.cpp

@@ -41,7 +41,7 @@
 #include "sacmd.hpp"
 #include "exception_util.hpp"
 
-#define DFU_WU_URL          "DfuWorkunitsAccess" 
+#define DFU_WU_URL          "DfuWorkunitsAccess"
 #define DFU_EX_URL          "DfuExceptionsAccess"
 #define FILE_SPRAY_URL      "FileSprayAccess"
 #define FILE_DESPRAY_URL    "FileDesprayAccess"
@@ -102,7 +102,7 @@ int Schedule::run()
 void CFileSprayEx::init(IPropertyTree *cfg, const char *process, const char *service)
 {
     StringBuffer xpath;
-    
+
     xpath.clear().appendf("Software/EspProcess[@name=\"%s\"]/EspService[@name=\"%s\"]/QueueLabel", process, service);
     cfg->getProp(xpath.str(), m_QueueLabel);
 
@@ -173,12 +173,12 @@ void ParsePath(const char * fullPath, StringBuffer &ip, StringBuffer &filePath,
     ptr = fullPath + strlen(fullPath) - 1;
     while(ptr > fullPath && *ptr != '\\')
         ptr--;
-    title.append(ptr + 1);  
+    title.append(ptr + 1);
 }
 
 const char * const NODATETIME="1970-01-01T00:00:00Z";
 
-// Assign from a dfuwu workunit structure to an esp request workunit structure. 
+// Assign from a dfuwu workunit structure to an esp request workunit structure.
 static void DeepAssign(IEspContext &context, IConstDFUWorkUnit *src, IEspDFUWorkunit &dest)
 {
     if(src == NULL)
@@ -199,12 +199,12 @@ static void DeepAssign(IEspContext &context, IConstDFUWorkUnit *src, IEspDFUWork
         if (clusterName && *clusterName)
         {
             StringBuffer clusterNameForDisplay(clusterName);
-            
+
             Owned<IPropertyTreeIterator> clusters= root->getElements("Software/Topology/Cluster");
             if (clusters->first())
             {
                 do {
-                    IPropertyTree &cluster = clusters->query(); 
+                    IPropertyTree &cluster = clusters->query();
                     const char* name = cluster.queryProp("@name");
                     if (!name || !*name)
                         continue;
@@ -215,7 +215,7 @@ static void DeepAssign(IEspContext &context, IConstDFUWorkUnit *src, IEspDFUWork
                     {
                         if (thorClusters->first())
                         {
-                            IPropertyTree &thorCluster = thorClusters->query();                 
+                            IPropertyTree &thorCluster = thorClusters->query();
                             const char* process = thorCluster.queryProp("@process");
                             if (process && *process)
                             {
@@ -229,7 +229,7 @@ static void DeepAssign(IEspContext &context, IConstDFUWorkUnit *src, IEspDFUWork
 
                         if (roxieClusters->first())
                         {
-                            IPropertyTree &roxieCluster = roxieClusters->query();                   
+                            IPropertyTree &roxieCluster = roxieClusters->query();
                             const char* process = roxieCluster.queryProp("@process");
                             if (process && *process)
                             {
@@ -246,7 +246,7 @@ static void DeepAssign(IEspContext &context, IConstDFUWorkUnit *src, IEspDFUWork
             dest.setClusterName(clusterNameForDisplay.str());
         }
     }
-    
+
     if ((version > 1.05) && src->getDFUServerName(tmp.clear()).length())
         dest.setDFUServerName(tmp.str());
 
@@ -286,7 +286,7 @@ static void DeepAssign(IEspContext &context, IConstDFUWorkUnit *src, IEspDFUWork
         tmpstr.append(" ");
         stoppAt.getTimeString(tmpstr);
         dest.setTimeStopped(tmpstr.str());
-        
+
         StringBuffer prgmsg;
         prog->formatProgressMessage(prgmsg);
         dest.setProgressMessage(prgmsg.str());
@@ -348,7 +348,7 @@ static void DeepAssign(IEspContext &context, IConstDFUWorkUnit *src, IEspDFUWork
                             dest.setSourceIP(socket.str());
                         }
                         const char *defaultdir = info->queryDefaultDir();
-                        if (defaultdir&&*defaultdir) 
+                        if (defaultdir&&*defaultdir)
                             addPathSepChar(dir.append(defaultdir));
                         file->getRawFileMask(dir);
                         dest.setSourceFilePath(dir.str());
@@ -426,7 +426,7 @@ static void DeepAssign(IEspContext &context, IConstDFUWorkUnit *src, IEspDFUWork
                             dest.setDestIP(socket.str());
                         }
                         const char *defaultdir = info->queryDefaultDir();
-                        if (defaultdir&&*defaultdir) 
+                        if (defaultdir&&*defaultdir)
                             addPathSepChar(dir.append(defaultdir));
                         file->getRawFileMask(dir);
                         dest.setDestFilePath(dir.str());
@@ -506,14 +506,14 @@ bool CFileSprayEx::ParseLogicalPath(const char * pLogicalPath, const char* group
                 }
             }
         }
-        else 
+        else
         {
             // Error here?
         }
     }
 
     makePhysicalPartName(pLogicalPath,0,0,folder,false,os,defaultFolder.str());
-    
+
     const char *n = pLogicalPath;
     const char* p;
     do {
@@ -531,7 +531,7 @@ bool CFileSprayEx::ParseLogicalPath(const char * pLogicalPath, StringBuffer &tit
         return false;
 
     title.clear();
-    
+
     const char *n = pLogicalPath;
     const char* p;
     do {
@@ -639,7 +639,7 @@ bool CFileSprayEx::onDFUWUSearch(IEspContext &context, IEspDFUWUSearchRequest &
             throw MakeStringException(ECLWATCH_CANNOT_GET_ENV_INFO, "Failed to get environment information.");
 
         Owned<IPropertyTreeIterator> clusterIterator = root->getElements("Software/Topology/Cluster");
-        if (clusterIterator->first()) 
+        if (clusterIterator->first())
         {
             do {
                 IPropertyTree &cluster = clusterIterator->query();
@@ -654,7 +654,7 @@ bool CFileSprayEx::onDFUWUSearch(IEspContext &context, IEspDFUWUSearchRequest &
         resp.setClusterNames(dfuclusters);
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
     return true;
@@ -694,7 +694,7 @@ int readFromCommaSeparatedString(const char *commaSeparatedString, StringBuffer*
                 strcpy(item, pStr);
                 pStr = NULL;
             }
-             
+
             output[numOfItems] = item;
             numOfItems++;
         }
@@ -711,14 +711,14 @@ bool CFileSprayEx::GetArchivedDFUWorkunits(IEspContext &context, IEspGetDFUWorku
     StringBuffer sashaAddress;
     IArrayOf<IConstTpSashaServer> sashaservers;
     CTpWrapper dummy;
-    dummy.getTpSashaServers(sashaservers);  
+    dummy.getTpSashaServers(sashaservers);
     ForEachItemIn(i, sashaservers)
     {
         IConstTpSashaServer& sashaserver = sashaservers.item(i);
         IArrayOf<IConstTpMachine> &sashaservermachine = sashaserver.getTpMachines();
         sashaAddress.append(sashaservermachine.item(0).getNetaddress());
     }
-        
+
     SocketEndpoint ep;
     ep.set(sashaAddress,DEFAULT_SASHA_PORT);
     Owned<INode> sashaserver = createINode(ep);
@@ -732,23 +732,23 @@ bool CFileSprayEx::GetArchivedDFUWorkunits(IEspContext &context, IEspGetDFUWorku
         begin = 0;
 
     Owned<ISashaCommand> cmd = createSashaCommand();
-    cmd->setAction(SCA_LIST);                           
-    cmd->setOnline(false);                              
-    cmd->setArchived(true);             
-    cmd->setDFU(true);  
+    cmd->setAction(SCA_LIST);
+    cmd->setOnline(false);
+    cmd->setArchived(true);
+    cmd->setDFU(true);
    cmd->setLimit((int) count+1);
    cmd->setStart((int)begin);
     if(req.getCluster() && *req.getCluster())
         cmd->setCluster(req.getCluster());
     if(req.getOwner() && *req.getOwner())
-        cmd->setOwner(req.getOwner());          
+        cmd->setOwner(req.getOwner());
     if(req.getJobname() && *req.getJobname())
-        cmd->setJobName(req.getJobname());          
+        cmd->setJobName(req.getJobname());
     if(req.getStateReq() && *req.getStateReq())
         cmd->setState(req.getStateReq());
     cmd->setOutputFormat("owner,jobname,cluster,state,command");//date range/owner/jobname/state*/
 
-    if (!cmd->send(sashaserver)) 
+    if (!cmd->send(sashaserver))
     {
         StringBuffer msg;
         msg.appendf("Cannot connect to archive server at %s",sashaAddress.str());
@@ -758,7 +758,7 @@ bool CFileSprayEx::GetArchivedDFUWorkunits(IEspContext &context, IEspGetDFUWorku
     IArrayOf<IEspDFUWorkunit> results;
     __int64 actualCount = cmd->numIds();
     StringBuffer s;
-    for (unsigned j=0;j<actualCount;j++) 
+    for (unsigned j=0;j<actualCount;j++)
     {
         const char *wuidStr = cmd->queryId(j);
         if (!wuidStr)
@@ -777,11 +777,11 @@ bool CFileSprayEx::GetArchivedDFUWorkunits(IEspContext &context, IEspGetDFUWorku
         if (strArray[2].length() > 0)
             resultWU->setJobName(strArray[2].str());
         if (strArray[3].length() > 0)
-            resultWU->setClusterName(strArray[3].str());   
+            resultWU->setClusterName(strArray[3].str());
         if (strArray[4].length() > 0)
-            resultWU->setStateMessage(strArray[4].str());   
+            resultWU->setStateMessage(strArray[4].str());
         if (strArray[5].length() > 0)
-            resultWU->setCommand(atoi(strArray[5].str()));   
+            resultWU->setCommand(atoi(strArray[5].str()));
 
         results.append(*resultWU.getLink());
     }
@@ -929,7 +929,7 @@ bool CFileSprayEx::onGetDFUWorkunits(IEspContext &context, IEspGetDFUWorkunits &
         if (clusters->first())
         {
             do {
-                IPropertyTree &cluster = clusters->query(); 
+                IPropertyTree &cluster = clusters->query();
                 const char* name = cluster.queryProp("@name");
                 if (!name || !*name)
                     continue;
@@ -941,7 +941,7 @@ bool CFileSprayEx::onGetDFUWorkunits(IEspContext &context, IEspGetDFUWorkunits &
                     bool bFound = false;
                     if (thorClusters->first())
                     {
-                        IPropertyTree &thorCluster = thorClusters->query();                 
+                        IPropertyTree &thorCluster = thorClusters->query();
                         const char* process = thorCluster.queryProp("@process");
                         if (process && *process)
                         {
@@ -956,7 +956,7 @@ bool CFileSprayEx::onGetDFUWorkunits(IEspContext &context, IEspGetDFUWorkunits &
 
                     if (!bFound && roxieClusters->first())
                     {
-                        IPropertyTree &roxieCluster = roxieClusters->query();                   
+                        IPropertyTree &roxieCluster = roxieClusters->query();
                         const char* process = roxieCluster.queryProp("@process");
                         if (process && *process)
                         {
@@ -1082,7 +1082,7 @@ bool CFileSprayEx::onGetDFUWorkunits(IEspContext &context, IEspGetDFUWorkunits &
             resultWU->setJobName(wu->getJobName(jobname).str());
             resultWU->setCommand(wu->getCommand());
             resultWU->setUser(wu->getUser(user).str());
-            
+
             const char* clusterName = wu->getClusterName(cluster).str();
             if (clusterName)
             {
@@ -1192,7 +1192,7 @@ bool CFileSprayEx::onGetDFUWorkunits(IEspContext &context, IEspGetDFUWorkunits &
         resp.setResults(result);
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -1216,21 +1216,21 @@ void CFileSprayEx::getInfoFromSasha(IEspContext &context, const char *sashaServe
     Owned<ISashaCommand> cmd = createSashaCommand();
     cmd->addId(wuid);
     cmd->setAction(SCA_GET);
-    cmd->setArchived(true);             
-    cmd->setDFU(true);  
+    cmd->setArchived(true);
+    cmd->setDFU(true);
     SocketEndpoint ep(sashaServer, DEFAULT_SASHA_PORT);
     Owned<INode> node = createINode(ep);
-    if (!cmd->send(node,1*60*1000)) 
+    if (!cmd->send(node,1*60*1000))
     {
         DBGLOG("Cannot connect to Sasha server at %s",sashaServer);
         throw MakeStringException(ECLWATCH_CANNOT_CONNECT_ARCHIVE_SERVER,"Cannot connect to archive server at %s.",sashaServer);
     }
-    if (cmd->numIds()==0) 
+    if (cmd->numIds()==0)
     {
         DBGLOG("Could not read archived %s",wuid);
         throw MakeStringException(ECLWATCH_CANNOT_GET_WORKUNIT,"Cannot read workunit %s.",wuid);
     }
-    
+
     unsigned num = cmd->numResults();
     if (num < 1)
         return;
@@ -1239,7 +1239,7 @@ void CFileSprayEx::getInfoFromSasha(IEspContext &context, const char *sashaServe
     cmd->getResult(0,res);
     if(res.length() < 1)
         return;
-    
+
     Owned<IPropertyTree> wu = createPTreeFromXMLString(res.str());
     if (!wu)
         return;
@@ -1296,7 +1296,7 @@ void CFileSprayEx::getInfoFromSasha(IEspContext &context, const char *sashaServe
         const char * state = progress->queryProp("@state");
         const char * timeStarted = progress->queryProp("@timestarted");
         const char * timeStopped = progress->queryProp("@timestopped");
-    
+
         if (state && *state)
             info->setStateMessage(state);
         if (timeStarted && *timeStarted)
@@ -1324,7 +1324,7 @@ bool CFileSprayEx::getArchivedWUInfo(IEspContext &context, IEspGetDFUWorkunit &r
         StringBuffer sashaAddress;
         IArrayOf<IConstTpSashaServer> sashaservers;
         CTpWrapper dummy;
-        dummy.getTpSashaServers(sashaservers);  
+        dummy.getTpSashaServers(sashaservers);
         ForEachItemIn(i, sashaservers)
         {
             IConstTpSashaServer& sashaserver = sashaservers.item(i);
@@ -1380,7 +1380,7 @@ bool CFileSprayEx::onGetDFUWorkunit(IEspContext &context, IEspGetDFUWorkunit &re
             throw MakeStringException(ECLWATCH_CANNOT_GET_WORKUNIT, "Dfu workunit %s not found.", req.getWuid());
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -1417,7 +1417,7 @@ bool CFileSprayEx::onGetDFUProgress(IEspContext &context, IEspProgressRequest &r
             StringBuffer statestr;
             encodeDFUstate(prog->getState(), statestr);
             resp.setState(statestr.str());
-            
+
             resp.setSlavesDone(prog->getSlavesDone());
 
             StringBuffer msg;
@@ -1430,7 +1430,7 @@ bool CFileSprayEx::onGetDFUProgress(IEspContext &context, IEspProgressRequest &r
         }
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -1458,7 +1458,7 @@ bool CFileSprayEx::onCreateDFUWorkunit(IEspContext &context, IEspCreateDFUWorkun
         result.setReplicate(true);
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -1510,7 +1510,7 @@ bool CFileSprayEx::onUpdateDFUWorkunit(IEspContext &context, IEspUpdateDFUWorkun
         resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(reqWU.getID()).str());
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -1654,7 +1654,7 @@ bool CFileSprayEx::onDFUWorkunitsAction(IEspContext &context, IEspDFUWorkunitsAc
         resp.setDFUActionResults(results);
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -1682,7 +1682,7 @@ bool CFileSprayEx::onDeleteDFUWorkunits(IEspContext &context, IEspDeleteDFUWorku
         resp.setRedirectUrl("/FileSpray/GetDFUWorkunits");
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -1709,7 +1709,7 @@ bool CFileSprayEx::onDeleteDFUWorkunit(IEspContext &context, IEspDeleteDFUWorkun
         resp.setRedirectUrl("/FileSpray/GetDFUWorkunits");
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -1732,7 +1732,7 @@ bool CFileSprayEx::onSubmitDFUWorkunit(IEspContext &context, IEspSubmitDFUWorkun
         resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(req.getWuid()).str());
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -1756,7 +1756,7 @@ bool CFileSprayEx::onAbortDFUWorkunit(IEspContext &context, IEspAbortDFUWorkunit
         resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(req.getWuid()).str());
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -1793,7 +1793,7 @@ bool CFileSprayEx::onGetDFUExceptions(IEspContext &context, IEspGetDFUExceptions
         resp.setResult(result);
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -1962,12 +1962,14 @@ bool CFileSprayEx::onSprayFixed(IEspContext &context, IEspSprayFixed &req, IEspS
         if (req.getRecordStructurePresent())
             options->setRecordStructurePresent(true);
 
+        options->setExpireDays(req.getExpireDays());
+
         resp.setWuid(wu->queryId());
         resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(wu->queryId()).str());
         submitDFUWorkUnit(wu.getClear());
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -2143,12 +2145,14 @@ bool CFileSprayEx::onSprayVariable(IEspContext &context, IEspSprayVariable &req,
         if (req.getRecordStructurePresent())
             options->setRecordStructurePresent(true);
 
+        options->setExpireDays(req.getExpireDays());
+
         resp.setWuid(wu->queryId());
         resp.setRedirectUrl(StringBuffer("/FileSpray/GetDFUWorkunit?wuid=").append(wu->queryId()).str());
         submitDFUWorkUnit(wu.getClear());
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -2198,7 +2202,7 @@ bool CFileSprayEx::onReplicate(IEspContext &context, IEspReplicate &req, IEspRep
         submitDFUWorkUnit(wu.getClear());
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -2377,7 +2381,7 @@ bool CFileSprayEx::onDespray(IEspContext &context, IEspDespray &req, IEspDespray
         submitDFUWorkUnit(wu.getClear());
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 
@@ -2428,12 +2432,12 @@ bool CFileSprayEx::onCopy(IEspContext &context, IEspCopy &req, IEspCopyResponse
 
         ParseLogicalPath(dstname, destNodeGroup.str(), NULL, destFolder, destTitle, defaultFolder, defaultReplicateFolder);
 
-        StringBuffer fileMask; 
+        StringBuffer fileMask;
         constructFileMask(destTitle.str(), fileMask);
 
         const char* srcDali = req.getSourceDali();
         bool supercopy = req.getSuperCopy();
-        if (supercopy) 
+        if (supercopy)
         {
             StringBuffer user, passwd;
             context.getUserID(user);
@@ -2441,7 +2445,7 @@ bool CFileSprayEx::onCopy(IEspContext &context, IEspCopy &req, IEspCopyResponse
             StringBuffer u(user);
             StringBuffer p(passwd);
             Owned<INode> foreigndali;
-            if (srcDali) 
+            if (srcDali)
             {
                 SocketEndpoint ep(srcDali);
                 foreigndali.setown(createINode(ep));
@@ -3473,7 +3477,7 @@ bool CFileSprayEx::onGetSprayTargets(IEspContext &context, IEspGetSprayTargetsRe
         resp.setGroupNodes(sprayTargets);
     }
     catch(IException* e)
-    {   
+    {
         FORWARDEXCEPTION(context, e,  ECLWATCH_INTERNAL_ERROR);
     }
 

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 81 - 28
plugins/fileservices/fileservices.cpp


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 6 - 0
plugins/fileservices/fileservices.hpp