|
@@ -530,7 +530,7 @@ FILESERVICES_API void FILESERVICES_CALL fsCmdProcess2(unsigned & tgtLen, char *
|
|
|
}
|
|
|
|
|
|
|
|
|
-void blockUntilComplete(const char * label, IClientFileSpray &server, ICodeContext *ctx, const char * wuid, int timeOut, StringBuffer *stateout=NULL, bool monitoringok=false)
|
|
|
+static void blockUntilComplete(const char * label, IClientFileSpray &server, ICodeContext *ctx, const char * wuid, int timeOut, StringBuffer *stateout=NULL, bool monitoringok=false)
|
|
|
{
|
|
|
if (!wuid || strcmp(wuid, "") == 0)
|
|
|
return;
|
|
@@ -632,7 +632,7 @@ void blockUntilComplete(const char * label, IClientFileSpray &server, ICodeConte
|
|
|
}
|
|
|
|
|
|
|
|
|
-void setServerAccess(CClientFileSpray &server, IConstWorkUnit * wu)
|
|
|
+static void setServerAccess(CClientFileSpray &server, IConstWorkUnit * wu)
|
|
|
{
|
|
|
StringBuffer user, password, wuid, token;
|
|
|
wu->getSecurityToken(StringBufferAdaptor(token));
|
|
@@ -974,10 +974,10 @@ ReplaceSuperFile(const varstring lsuperfn,const varstring lfn,const varstring by
|
|
|
FinishSuperFileTransaction(boolean rollback=false);
|
|
|
*/
|
|
|
|
|
|
-static bool lookupSuperFile(ICodeContext *ctx, const char *lsuperfn, Owned<IDistributedSuperFile> &file,IDistributedFileTransaction *&transaction, bool throwerr, StringBuffer &lsfn, bool fixmissing, bool allowforeign, bool cacheFiles=false)
|
|
|
+static bool lookupSuperFile(ICodeContext *ctx, const char *lsuperfn, Owned<IDistributedSuperFile> &file, bool throwerr, StringBuffer &lsfn, bool fixmissing, bool allowforeign, bool cacheFiles=false)
|
|
|
{
|
|
|
lsfn.clear();
|
|
|
- transaction = ctx->querySuperFileTransaction();
|
|
|
+ IDistributedFileTransaction *transaction = ctx->querySuperFileTransaction();
|
|
|
constructLogicalName(ctx, lsuperfn, lsfn);
|
|
|
if (!allowforeign) {
|
|
|
CDfsLogicalFileName dlfn;
|
|
@@ -1056,8 +1056,7 @@ FILESERVICES_API void FILESERVICES_CALL fsDeleteSuperFile(ICodeContext *ctx, con
|
|
|
// Note because deleting a superfile, not within transaction (currently)
|
|
|
Owned<IDistributedSuperFile> file;
|
|
|
StringBuffer lsfn;
|
|
|
- IDistributedFileTransaction *transaction;
|
|
|
- bool found = lookupSuperFile(ctx, lsuperfn, file, transaction, false, lsfn, true, false);
|
|
|
+ bool found = lookupSuperFile(ctx, lsuperfn, file, false, lsfn, true, false);
|
|
|
if (found) {
|
|
|
CheckNotInTransaction(ctx,"DeleteSuperFile");
|
|
|
if (deletesub)
|
|
@@ -1076,10 +1075,9 @@ FILESERVICES_API unsigned FILESERVICES_CALL fsGetSuperFileSubCount(ICodeContext
|
|
|
Owned<ISimpleSuperFileEnquiry> enq = getSimpleSuperFileEnquiry(ctx, lsuperfn);
|
|
|
if (enq)
|
|
|
return enq->numSubFiles();
|
|
|
- IDistributedFileTransaction *transaction;
|
|
|
Owned<IDistributedSuperFile> file;
|
|
|
StringBuffer lsfn;
|
|
|
- lookupSuperFile(ctx, lsuperfn, file, transaction, true, lsfn, false, true);
|
|
|
+ lookupSuperFile(ctx, lsuperfn, file, true, lsfn, false, true);
|
|
|
return file->numSubFiles();
|
|
|
}
|
|
|
|
|
@@ -1094,10 +1092,9 @@ FILESERVICES_API char * FILESERVICES_CALL fsGetSuperFileSubName(ICodeContext *c
|
|
|
return CTXSTRDUP(parentCtx, "");
|
|
|
return ret.detach();
|
|
|
}
|
|
|
- IDistributedFileTransaction *transaction;
|
|
|
Owned<IDistributedSuperFile> file;
|
|
|
StringBuffer lsfn;
|
|
|
- lookupSuperFile(ctx, lsuperfn, file,transaction, true, lsfn, false, true);
|
|
|
+ lookupSuperFile(ctx, lsuperfn, file, true, lsfn, false, true);
|
|
|
if (!filenum||filenum>file->numSubFiles())
|
|
|
return CTXSTRDUP(parentCtx, "");
|
|
|
ret.append(file->querySubFile(filenum-1).queryLogicalName());
|
|
@@ -1113,10 +1110,9 @@ FILESERVICES_API unsigned FILESERVICES_CALL fsFindSuperFileSubName(ICodeContext
|
|
|
unsigned n = enq->findSubName(lfn.str());
|
|
|
return (n==NotFound)?0:n+1;
|
|
|
}
|
|
|
- IDistributedFileTransaction *transaction;
|
|
|
Owned<IDistributedSuperFile> file;
|
|
|
StringBuffer lsfn;
|
|
|
- lookupSuperFile(ctx, lsuperfn, file,transaction, true, lsfn, false, true);
|
|
|
+ lookupSuperFile(ctx, lsuperfn, file, true, lsfn, false, true);
|
|
|
unsigned n = 0;
|
|
|
// could do with better version of this TBD
|
|
|
Owned<IDistributedFileIterator> iter = file->getSubFileIterator();
|
|
@@ -1149,15 +1145,15 @@ FILESERVICES_API void FILESERVICES_CALL fsAddSuperFile(IGlobalCodeContext *gctx,
|
|
|
|
|
|
FILESERVICES_API void FILESERVICES_CALL fslAddSuperFile(ICodeContext *ctx, const char *lsuperfn,const char *_lfn,unsigned atpos,bool addcontents, bool strict)
|
|
|
{
|
|
|
- IDistributedFileTransaction *transaction;
|
|
|
Owned<IDistributedSuperFile> file;
|
|
|
StringBuffer lsfn;
|
|
|
// NB: if adding contents, tell lookupSuperFile to cache the subfiles in the transaction
|
|
|
- if (!lookupSuperFile(ctx, lsuperfn, file,transaction, strict, lsfn, false, false, addcontents)) {
|
|
|
+ if (!lookupSuperFile(ctx, lsuperfn, file, strict, lsfn, false, false, addcontents)) {
|
|
|
// auto create
|
|
|
fsCreateSuperFile(ctx,lsuperfn,false,false);
|
|
|
- lookupSuperFile(ctx, lsuperfn, file,transaction, true, lsfn, false, false);
|
|
|
+ lookupSuperFile(ctx, lsuperfn, file, true, lsfn, false, false);
|
|
|
}
|
|
|
+ IDistributedFileTransaction *transaction = ctx->querySuperFileTransaction();
|
|
|
StringBuffer lfn;
|
|
|
constructLogicalName(ctx, _lfn, lfn);
|
|
|
if (strict||addcontents) {
|
|
@@ -1195,13 +1191,13 @@ FILESERVICES_API void FILESERVICES_CALL fsRemoveSuperFile(IGlobalCodeContext *gc
|
|
|
|
|
|
FILESERVICES_API void FILESERVICES_CALL fslRemoveSuperFile(ICodeContext *ctx, const char *lsuperfn,const char *_lfn,bool del,bool remcontents)
|
|
|
{
|
|
|
- IDistributedFileTransaction *transaction;
|
|
|
Owned<IDistributedSuperFile> file;
|
|
|
StringBuffer lsfn;
|
|
|
StringBuffer lfn;
|
|
|
if (_lfn)
|
|
|
constructLogicalName(ctx, _lfn, lfn);
|
|
|
- lookupSuperFile(ctx, lsuperfn, file,transaction, true, lsfn, true, false);
|
|
|
+ lookupSuperFile(ctx, lsuperfn, file, true, lsfn, true, false);
|
|
|
+ IDistributedFileTransaction *transaction = ctx->querySuperFileTransaction();
|
|
|
file->removeSubFile(_lfn?lfn.str():NULL,del,del,remcontents,transaction);
|
|
|
StringBuffer s;
|
|
|
if (_lfn)
|
|
@@ -1241,14 +1237,14 @@ FILESERVICES_API void FILESERVICES_CALL fsSwapSuperFile(IGlobalCodeContext *gctx
|
|
|
|
|
|
FILESERVICES_API void FILESERVICES_CALL fslSwapSuperFile(ICodeContext *ctx, const char *lsuperfn1,const char *lsuperfn2)
|
|
|
{
|
|
|
- IDistributedFileTransaction *transaction;
|
|
|
- IDistributedFileTransaction *transaction2; // not used
|
|
|
StringBuffer lsfn1;
|
|
|
StringBuffer lsfn2;
|
|
|
Owned<IDistributedSuperFile> file1;
|
|
|
Owned<IDistributedSuperFile> file2;
|
|
|
- lookupSuperFile(ctx, lsuperfn1, file1,transaction, true, lsfn1,false,false);
|
|
|
- lookupSuperFile(ctx, lsuperfn2, file2,transaction2, true,lsfn2,false,false);
|
|
|
+ lookupSuperFile(ctx, lsuperfn1, file1, true, lsfn1,false,false);
|
|
|
+ lookupSuperFile(ctx, lsuperfn2, file2, true,lsfn2,false,false);
|
|
|
+
|
|
|
+ IDistributedFileTransaction *transaction = ctx->querySuperFileTransaction();
|
|
|
file1->swapSuperFile(file2,transaction);
|
|
|
StringBuffer s("SwapSuperFile ('");
|
|
|
s.append(lsfn1).append("', '");
|
|
@@ -1572,11 +1568,9 @@ FILESERVICES_API void FILESERVICES_CALL fsSuperFileContents(ICodeContext *ctx, s
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
-
|
|
|
- IDistributedFileTransaction *transaction;
|
|
|
Owned<IDistributedSuperFile> file;
|
|
|
StringBuffer lsfn;
|
|
|
- lookupSuperFile(ctx, lsuperfn, file,transaction, true, lsfn, false, true);
|
|
|
+ lookupSuperFile(ctx, lsuperfn, file, true, lsfn, false, true);
|
|
|
Owned<IDistributedFileIterator> iter = file->getSubFileIterator(recurse);
|
|
|
StringBuffer name;
|
|
|
ForEach(*iter) {
|