referencedfilelist.hpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef REFFILE_LIST_HPP
  14. #define REFFILE_LIST_HPP
  15. #include "jlib.hpp"
  16. #include "workunit.hpp"
  17. #include "package.h"
  18. #include "dfuutil.hpp"
  19. #define RefFileNone 0x0000
  20. #define RefFileIndex 0x0001
  21. #define RefFileNotOnCluster 0x0002
  22. #define RefFileNotFound 0x0004
  23. #define RefFileRemote 0x0008
  24. #define RefFileForeign 0x0010
  25. #define RefFileSuper 0x0020
  26. #define RefSubFile 0x0040
  27. #define RefFileCopyInfoFailed 0x0080
  28. #define RefFileCloned 0x0100
  29. #define RefFileInPackage 0x0200
  30. #define RefFileNotOnSource 0x0400
  31. #define RefFileOptional 0x0800 //File referenced in more than one place can be both optional and not optional
  32. #define RefFileNotOptional 0x1000
  33. interface IReferencedFile : extends IInterface
  34. {
  35. virtual const char *getLogicalName() const =0;
  36. virtual unsigned getFlags() const =0;
  37. virtual const SocketEndpoint &getForeignIP(SocketEndpoint &ep) const =0;
  38. virtual const char *queryPackageId() const =0;
  39. virtual __int64 getFileSize()=0;
  40. virtual unsigned getNumParts()=0;
  41. virtual const StringArray &getSubFileNames() const =0;
  42. };
  43. interface IReferencedFileIterator : extends IIteratorOf<IReferencedFile> { };
  44. interface IReferencedFileList : extends IInterface
  45. {
  46. virtual void addFilesFromWorkUnit(IConstWorkUnit *cw)=0;
  47. virtual bool addFilesFromQuery(IConstWorkUnit *cw, const IHpccPackageMap *pm, const char *queryid)=0;
  48. virtual bool addFilesFromQuery(IConstWorkUnit *cw, const IHpccPackage *pkg)=0;
  49. virtual void addFilesFromPackageMap(IPropertyTree *pm)=0;
  50. virtual void addFile(const char *ln, const char *daliip=NULL, const char *sourceProcessCluster=NULL, const char *remotePrefix=NULL)=0;
  51. virtual void addFiles(StringArray &files)=0;
  52. virtual IReferencedFileIterator *getFiles()=0;
  53. virtual void resolveFiles(const StringArray &locations, const char *remoteIP, const char * remotePrefix, const char *srcCluster, bool checkLocalFirst, bool addSubFiles, bool trackSubFiles, bool resolveForeign=false)=0;
  54. virtual void cloneAllInfo(const char *dstCluster, unsigned updateFlags, IDFUhelper *helper, bool cloneSuperInfo, bool cloneForeign, unsigned redundancy, unsigned channelsPerNode, int replicateOffset, const char *defRepFolder)=0;
  55. virtual void cloneFileInfo(const char *dstCluster, unsigned updateFlags, IDFUhelper *helper, bool cloneSuperInfo, bool cloneForeign, unsigned redundancy, unsigned channelsPerNode, int replicateOffset, const char *defRepFolder)=0;
  56. virtual void cloneRelationships()=0;
  57. };
  58. extern WORKUNIT_API const char *skipForeign(const char *name, StringBuffer *ip=NULL);
  59. extern WORKUNIT_API IReferencedFileList *createReferencedFileList(const char *user, const char *pw, bool allowForeignFiles, bool allowFileSizeCalc);
  60. extern WORKUNIT_API IReferencedFileList *createReferencedFileList(IUserDescriptor *userDesc, bool allowForeignFiles, bool allowFileSizeCalc);
  61. extern WORKUNIT_API void splitDfsLocation(const char *address, StringBuffer &cluster, StringBuffer &ip, StringBuffer &prefix, const char *defaultCluster);
  62. extern WORKUNIT_API void splitDerivedDfsLocation(const char *address, StringBuffer &cluster, StringBuffer &ip, StringBuffer &prefix, const char *defaultCluster, const char *baseCluster, const char *baseIP, const char *basePrefix);
  63. #endif //REFFILE_LIST_HPP