referencedfilelist.hpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*##############################################################################
  2. Copyright (C) 2012 HPCC Systems.
  3. All rights reserved. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ############################################################################## */
  14. #ifndef REFFILE_LIST_HPP
  15. #define REFFILE_LIST_HPP
  16. #include "jlib.hpp"
  17. #include "workunit.hpp"
  18. #include "package.h"
  19. #include "dfuutil.hpp"
  20. #define RefFileNone 0x000
  21. #define RefFileIndex 0x001
  22. #define RefFileNotOnCluster 0x002
  23. #define RefFileNotFound 0x004
  24. #define RefFileRemote 0x008
  25. #define RefFileForeign 0x010
  26. #define RefFileSuper 0x020
  27. #define RefSubFile 0x040
  28. #define RefFileCopyInfoFailed 0x080
  29. #define RefFileCloned 0x100
  30. #define RefFileInPackage 0x200
  31. #define RefFileNotOnSource 0x400
  32. interface IReferencedFile : extends IInterface
  33. {
  34. virtual const char *getLogicalName() const =0;
  35. virtual unsigned getFlags() const =0;
  36. virtual const SocketEndpoint &getForeignIP(SocketEndpoint &ep) const =0;
  37. virtual const char *queryPackageId() const =0;
  38. };
  39. interface IReferencedFileIterator : extends IIteratorOf<IReferencedFile> { };
  40. interface IReferencedFileList : extends IInterface
  41. {
  42. virtual void addFilesFromWorkUnit(IConstWorkUnit *cw)=0;
  43. virtual void addFilesFromQuery(IConstWorkUnit *cw, const IHpccPackageMap *pm, const char *queryid)=0;
  44. virtual void addFilesFromQuery(IConstWorkUnit *cw, const IHpccPackage *pkg)=0;
  45. virtual void addFilesFromPackageMap(IPropertyTree *pm)=0;
  46. virtual void addFile(const char *ln, const char *daliip=NULL, const char *sourceProcessCluster=NULL, const char *remotePrefix=NULL)=0;
  47. virtual void addFiles(StringArray &files)=0;
  48. virtual IReferencedFileIterator *getFiles()=0;
  49. virtual void resolveFiles(const char *process, const char *remoteIP, const char * remotePrefix, const char *srcCluster, bool checkLocalFirst, bool addSubFiles, bool resolveForeign=false)=0;
  50. virtual void cloneAllInfo(IDFUhelper *helper, bool overwrite, bool cloneSuperInfo, bool cloneForeign=false)=0;
  51. virtual void cloneFileInfo(IDFUhelper *helper, bool overwrite, bool cloneSuperInfo, bool cloneForeign=false)=0;
  52. virtual void cloneRelationships()=0;
  53. };
  54. extern WORKUNIT_API const char *skipForeign(const char *name, StringBuffer *ip=NULL);
  55. extern WORKUNIT_API IReferencedFileList *createReferencedFileList(const char *user, const char *pw, bool allowForeignFiles);
  56. extern WORKUNIT_API void splitDfsLocation(const char *address, StringBuffer &cluster, StringBuffer &ip, StringBuffer &prefix, const char *defaultCluster);
  57. 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);
  58. #endif //REFFILE_LIST_HPP