thmfilemanager.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 _THMFILEMANAGER_HPP
  14. #define _THMFILEMANAGER_HPP
  15. #ifdef MFILEMANAGER_EXPORTS
  16. #define thmfilemanager_decl DECL_EXPORT
  17. #else
  18. #define thmfilemanager_decl DECL_IMPORT
  19. #endif
  20. #include "jarray.hpp"
  21. #include "jfile.hpp"
  22. #include "jptree.hpp"
  23. #include "jsocket.hpp"
  24. #include "jtime.hpp"
  25. #include "dafdesc.hpp"
  26. #include "thormisc.hpp"
  27. #define PAUSETMPSCOPE "thorpause"
  28. class CJobBase;
  29. interface IDistributedFile;
  30. interface IThorFileManager : extends IInterface
  31. {
  32. virtual void noteFileRead(CJobBase &job, IDistributedFile *file, bool extended=false) = 0;
  33. virtual IDistributedFile *lookup(CJobBase &job, const char *logicalName, bool temporary, bool optional, bool reportOptional, bool privilegedUser, bool updateAccessed=true) = 0;
  34. virtual IFileDescriptor *create(CJobBase &job, const char *logicalName, StringArray &groupNames, IArrayOf<IGroup> &groups, bool overwriteok, unsigned helperFlags=0, bool nonLocalIndex=false, unsigned restrictedWidth=0) = 0;
  35. virtual void publish(CJobBase &job, const char *logicalName, IFileDescriptor &file, Owned<IDistributedFile> *publishedFile=NULL) = 0;
  36. virtual void clearCacheEntry(const char *name) = 0;
  37. virtual StringBuffer &mangleLFN(CJobBase &job, const char *lfn, StringBuffer &out) = 0;
  38. virtual StringBuffer &addScope(CJobBase &job, const char *logicalname, StringBuffer &ret, bool temporary=false, bool paused=false) = 0;
  39. virtual StringBuffer &getPhysicalName(CJobBase &job, const char *logicalName, unsigned partno, StringBuffer &res) = 0;
  40. virtual StringBuffer &getPublishPhysicalName(CJobBase &job, const char *logicalName, unsigned partno, StringBuffer &res) = 0;
  41. virtual unsigned __int64 getFileOffset(CJobBase &job, const char *logicalName, unsigned partno) = 0;
  42. virtual bool scanLogicalFiles(CJobBase &job, const char *_pattern, StringArray &results) = 0;
  43. };
  44. extern thmfilemanager_decl void initFileManager();
  45. extern thmfilemanager_decl IThorFileManager &queryThorFileManager();
  46. extern thmfilemanager_decl IFileDescriptor *getConfiguredFileDescriptor(IDistributedFile &file);
  47. extern thmfilemanager_decl unsigned getGroupOffset(IGroup &fileGroup, IGroup &group);
  48. extern thmfilemanager_decl void fillClusterArray(CJobBase &job, const char *filename, StringArray &clusters, IArrayOf<IGroup> &groups);
  49. #endif