daft.hpp 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 DAFT_HPP
  14. #define DAFT_HPP
  15. #ifdef DALIFT_EXPORTS
  16. #define DALIFT_API DECL_EXPORT
  17. #else
  18. #define DALIFT_API DECL_IMPORT
  19. #endif
  20. #include "dadfs.hpp"
  21. interface IFile;
  22. interface IMultiException;
  23. interface IDaftProgress
  24. {
  25. virtual void onProgress(unsigned __int64 sizeDone, unsigned __int64 totalSize, unsigned numNodes) = 0; // how much has been done
  26. virtual void setRange(unsigned __int64 sizeReadBefore, unsigned __int64 totalSize, unsigned totalNodes) = 0; // how much has been done
  27. };
  28. interface IDaftCopyProgress
  29. {
  30. virtual void onProgress(const char * source) = 0; // which file is being copied
  31. };
  32. enum DaftReplicateMode
  33. {
  34. DRMreplicatePrimary,
  35. DRMreplicateSecondary,
  36. DRMcreateMissing
  37. };
  38. interface IRemoteConnection;
  39. interface IAbortRequestCallback;
  40. interface IDistributedFileSystem : public IInterface
  41. {
  42. //operations on multiple files.
  43. virtual void copy(IDistributedFile * from, IDistributedFile * to, IPropertyTree * recovery, IRemoteConnection * recoveryConnection, IDFPartFilter *filter, IPropertyTree * options, IDaftProgress * progress , IAbortRequestCallback * abort=NULL , const char *wuid=NULL) = 0;
  44. virtual void exportFile(IDistributedFile * from, IFileDescriptor * to, IPropertyTree * recovery, IRemoteConnection * recoveryConnection, IDFPartFilter *filter, IPropertyTree * options, IDaftProgress * progress , IAbortRequestCallback * abort=NULL , const char *wuid=NULL) = 0;
  45. virtual void import(IFileDescriptor * from, IDistributedFile * to, IPropertyTree * recovery, IRemoteConnection * recoveryConnection, IDFPartFilter *filter, IPropertyTree * options, IDaftProgress * progress , IAbortRequestCallback * abort=NULL , const char *wuid=NULL) = 0;
  46. virtual void move(IDistributedFile * from, IDistributedFile * to, IPropertyTree * recovery, IRemoteConnection * recoveryConnection, IDFPartFilter *filter, IPropertyTree * options, IDaftProgress * progress , IAbortRequestCallback * abort=NULL , const char *wuid=NULL) = 0;
  47. virtual void replicate(IDistributedFile * from, IGroup *destgroup, IPropertyTree * recovery, IRemoteConnection * recoveryConnection, IDFPartFilter *filter, IPropertyTree * options, IDaftProgress * progress , IAbortRequestCallback * abort=NULL , const char *wuid=NULL) = 0; // create new set of copies assumes partname and dir location same as src (only nodes differ) will raise exception if nodes clash
  48. virtual void replicate(IFileDescriptor * fd, DaftReplicateMode mode, IPropertyTree * recovery, IRemoteConnection * recoveryConnection, IDFPartFilter *filter, IPropertyTree * options, IDaftProgress * progress , IAbortRequestCallback * abort=NULL , const char *wuid=NULL) = 0; // create new set of copies (between copy 0 to copy 1 depending on the mode) @crc set in options to copy if crc differs @sizedate if size/date differ.
  49. virtual void transfer(IFileDescriptor * from, IFileDescriptor * to, IPropertyTree * recovery, IRemoteConnection * recoveryConnection, IDFPartFilter *filter, IPropertyTree * options, IDaftProgress * progress , IAbortRequestCallback * abort=NULL , const char *wuid=NULL) = 0; // copy between external files, must have
  50. virtual void directory(const char * directory, IGroup * machines, IPropertyTree * options, IPropertyTree * result) = 0; // @recurse=false @time=true @crc=false
  51. virtual void physicalCopy(const char * source, const char * target, IPropertyTree * options, IDaftCopyProgress * progress = NULL) = 0; // options can include @recurse @copyMissing @copyExisting @preserveTimes @preserveIfNewer @verboseFull @verbose
  52. virtual void physicalCopy(IPropertyTree * source, const char * target, IPropertyTree * options, IDaftCopyProgress * progress = NULL) = 0; // property tree is same structure as result of directory
  53. //operations on a single file.
  54. virtual offset_t getSize(IDistributedFile * file,
  55. bool forceget=false, // if true gets physical size (ignores cached attribute)
  56. bool dontsetattr=true) = 0; // if true doesn't set attribute when physical size got
  57. virtual bool compress(IDistributedFile * file) = 0;
  58. virtual offset_t getCompressedSize(IDistributedFile * part) = 0;
  59. //operations on a file part
  60. virtual IFile *getIFile(IDistributedFilePart * part, unsigned copy=0) = 0; // get IFile for reading/writing file part
  61. virtual offset_t getSize(IDistributedFilePart * part,
  62. bool forceget=false, // if true gets physical size (ignores cached attribute)
  63. bool dontsetattr=true) = 0; // if true doesn't set attribute when physical size got
  64. virtual void replicate(IDistributedFilePart * part, INode *node) = 0; // creates single copy
  65. virtual bool compress(IDistributedFilePart * part) = 0;
  66. virtual offset_t getCompressedSize(IDistributedFilePart * part) = 0;
  67. };
  68. extern DALIFT_API IDistributedFileSystem & queryDistributedFileSystem();
  69. extern DALIFT_API const char * queryFtSlaveLogDir();
  70. extern DALIFT_API void setFtSlaveLogDir(const char *dir);
  71. #endif