package.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 WUPACKAGE_H
  14. #define WUPACKAGE_H
  15. #include "errorlist.h"
  16. #include "dadfs.hpp"
  17. #include "workunit.hpp"
  18. #include "rtldynfield.hpp"
  19. // error codes
  20. #define PACKAGE_TARGET_NOT_FOUND PACKAGE_ERROR_START
  21. #define PACKAGE_MISSING_ID PACKAGE_ERROR_START+1
  22. #define PACKAGE_NO_SUBFILES PACKAGE_ERROR_START+2
  23. #define PACKAGE_NOT_FOUND PACKAGE_ERROR_START+3
  24. #define PACKAGE_QUERY_NOT_FOUND PACKAGE_ERROR_START+4
  25. interface IHpccPackage : extends IInterface
  26. {
  27. virtual ISimpleSuperFileEnquiry *resolveSuperFile(const char *superFileName) const = 0;
  28. virtual bool hasSuperFile(const char *superFileName) const = 0;
  29. virtual const char *locateSuperFile(const char *superFileName) const = 0;
  30. virtual const char *queryEnv(const char *varname) const = 0;
  31. virtual RecordTranslationMode getEnableFieldTranslation() const = 0;
  32. virtual bool isCompulsory() const = 0;
  33. virtual bool isPreload() const = 0;
  34. virtual const IPropertyTree *queryTree() const = 0;
  35. virtual hash64_t queryHash() const = 0;
  36. virtual const char *queryId() const = 0;
  37. };
  38. interface IHpccPackageMap : extends IInterface
  39. {
  40. virtual const IHpccPackage *queryPackage(const char *name) const = 0;
  41. virtual const IHpccPackage *matchPackage(const char *name) const = 0;
  42. virtual const char *queryPackageId() const = 0;
  43. virtual bool isActive() const = 0;
  44. virtual bool validate(const StringArray &queriesToVerify, const StringArray &queriesToIgnore, StringArray &warn, StringArray &err, StringArray &unmatchedQueries, StringArray &unusedPackages, StringArray &unmatchedFiles, bool ignoreOptionalFiles) const = 0;
  45. virtual void gatherFileMappingForQuery(const char *queryname, IPropertyTree *fileInfo) const = 0;
  46. virtual const StringArray &getPartIds() const = 0;
  47. };
  48. interface IHpccPackageSet : extends IInterface
  49. {
  50. virtual const IHpccPackageMap *queryActiveMap(const char *queryset) const = 0;
  51. };
  52. extern WORKUNIT_API IHpccPackageMap *createPackageMapFromXml(const char *xml, const char *queryset, const char *id);
  53. extern WORKUNIT_API IHpccPackageMap *createPackageMapFromPtree(IPropertyTree *t, const char *queryset, const char *id);
  54. extern WORKUNIT_API IHpccPackageSet *createPackageSet(const char *process);
  55. extern WORKUNIT_API IPropertyTree * getPackageMapById(const char * id, bool readonly);
  56. extern WORKUNIT_API IPropertyTree * getPackageMapById(const char *target, const char * id, bool readonly);
  57. extern WORKUNIT_API IPropertyTree * getPackageSetById(const char * id, bool readonly);
  58. extern WORKUNIT_API IPropertyTree * resolvePackageSetRegistry(const char *process, bool readonly);
  59. extern WORKUNIT_API IPropertyTree * resolveActivePackageMap(const char *process, const char *target, bool readonly);
  60. extern WORKUNIT_API hash64_t pkgHash64Data(size32_t len, const void *buf, hash64_t hval);
  61. #endif