File.ecl 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. /*##############################################################################
  2. ## HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems. All rights reserved.
  3. ############################################################################## */
  4. EXPORT File := MODULE
  5. IMPORT lib_fileservices;
  6. /*------------------------------------- Various types and constants -----------------------------------------------*/
  7. /**
  8. * A record containing information about filename. Includes name, size and when last modified.
  9. * ??rename?
  10. */
  11. EXPORT FsFilenameRecord := lib_fileservices.FsFilenameRecord;
  12. /**
  13. * A record containing a logical filename.
  14. */
  15. EXPORT FsLogicalFileName := lib_fileservices.FsLogicalFileName;
  16. /**
  17. * A record containing a logical filename.
  18. */
  19. EXPORT FsLogicalFileNameRecord := lib_fileservices.FsLogicalFileNameRecord;
  20. /**
  21. * A record containing information about a logical file.
  22. */
  23. EXPORT FsLogicalFileInfoRecord := lib_fileservices.FsLogicalFileInfoRecord;
  24. /**
  25. * A record containing information about a super file.
  26. */
  27. EXPORT FsLogicalSuperSubRecord := lib_fileservices.FsLogicalSuperSubRecord;
  28. /**
  29. * A record containing information about the relationship between two files.
  30. */
  31. EXPORT FsFileRelationshipRecord := lib_fileservices.FsFileRelationshipRecord;
  32. /** ??
  33. * Constant that indicates IBM RECFM V format file. Can be passed to SprayFixed for the record size.
  34. */
  35. EXPORT INTEGER4 RECFMV_RECSIZE := lib_fileservices.RECFMV_RECSIZE;
  36. /** ??
  37. * Constant that indicates IBM RECFM VB format file. Can be passed to SprayFixed for the record size.
  38. */
  39. EXPORT INTEGER4 RECFMVB_RECSIZE := lib_fileservices.RECFMVB_RECSIZE;
  40. /**
  41. * Constant that indicates a variable little endian 4 byte length prefixed file. Can be passed to SprayFixed for the record size.
  42. */
  43. EXPORT INTEGER4 PREFIX_VARIABLE_RECSIZE := lib_fileservices.PREFIX_VARIABLE_RECSIZE;
  44. /**
  45. * Constant that indicates a variable big endian 4 byte length prefixed file. Can be passed to SprayFixed for the record size.
  46. */
  47. EXPORT INTEGER4 PREFIX_VARIABLE_BIGENDIAN_RECSIZE := lib_fileservices.PREFIX_VARIABLE_BIGENDIAN_RECSIZE;
  48. /*------------------------------------- Spray functions -----------------------------------------------------------*/
  49. /**
  50. * Returns whether the file exists.
  51. *
  52. * @param lfn The logical name of the file.
  53. * @param physical Whether to also check for the physical existance on disk. Defaults to false.
  54. * @return whether the file exists
  55. */
  56. EXPORT boolean FileExists(varstring lfn, boolean physical=false) :=
  57. lib_fileservices.FileServices.FileExists(lfn, physical);
  58. /**
  59. * Removes the logical file from the system, and deletes from the disk.
  60. *
  61. * @param lfn The logical name of the file.
  62. * @param allow_missing Whether to suppress an error if the filename does not exist. Defaults to false.
  63. */
  64. EXPORT DeleteLogicalFile(varstring lfn, boolean allow_missing=false) :=
  65. lib_fileservices.FileServices.DeleteLogicalFile(lfn, allow_missing);
  66. /**
  67. * Changes whether access to a file is read only or not.
  68. *
  69. * @param lfn The logical name of the file.
  70. * @param ro Whether updates to the file are disallowed. Defaults to true.
  71. */
  72. EXPORT SetReadOnly(varstring lfn, boolean ro) :=
  73. lib_fileservices.FileServices.SetReadOnly(lfn, ro);
  74. /**
  75. * Changes the name of a logical file.
  76. *
  77. * @param oldname The current name of the file to be renamed.
  78. * @param newname The new logical name of the file.
  79. */
  80. EXPORT RenameLogicalFile(varstring oldname, varstring newname) :=
  81. lib_fileservices.FileServices.RenameLogicalFile(oldname, newname);
  82. /**
  83. * Returns a logical filename that can be used to refer to a logical file in a local or remote dali.
  84. *
  85. * @param name The logical name of the file.
  86. * @param foreigndali The IP address of the foreign dali used to resolve the file. If blank then the file is resolved
  87. * locally. Defaults to blank.
  88. * @param abspath Should a tilde (~) be prepended to the resulting logical file name. Defaults to false.
  89. */
  90. EXPORT varstring ForeignLogicalFileName(varstring name, varstring foreigndali='', boolean abspath=false) :=
  91. lib_fileservices.FileServices.ForeignLogicalFileName(name, foreigndali, abspath);
  92. /**
  93. * Returns an encoded logical filename that can be used to refer to a external file. Examples include directly
  94. * reading from a landing zone. Upper case characters and other details are escaped.
  95. *
  96. * @param location The IP address of the remote machine. '.' can be used for the local machine.
  97. * @param path The path/name of the file on the remote machine.
  98. * @param abspath Should a tilde (~) be prepended to the resulting logical file name. Defaults to true.
  99. * @return The encoded logical filename.
  100. */
  101. EXPORT varstring ExternalLogicalFileName(varstring location, varstring path, boolean abspath=true) :=
  102. lib_fileservices.FileServices.ExternalLogicalFileName(location, path, abspath);
  103. /**
  104. * Returns a string containing the description information associated with the specified filename. This description
  105. * is set either through ECL watch or by using the FileServices.SetFileDescription function.
  106. *
  107. * @param lfn The logical name of the file.
  108. */
  109. EXPORT varstring GetFileDescription(varstring lfn) :=
  110. lib_fileservices.FileServices.GetFileDescription(lfn);
  111. /**
  112. * Sets the description associated with the specified filename.
  113. *
  114. * @param lfn The logical name of the file.
  115. * @param val The description to be associated with the file.
  116. */
  117. EXPORT SetFileDescription(varstring lfn, varstring val) :=
  118. lib_fileservices.FileServices.SetFileDescription(lfn, val);
  119. /**
  120. * Returns a dataset containing a list of files from the specified machineIP and directory.
  121. *
  122. * @param machineIP The IP address of the remote machine.
  123. * @param directory The path to the directory to read. This must be in the appropriate format for the operating
  124. * system running on the remote machine.
  125. * @param mask The filemask specifying which files to include in the result. Defaults to '*' (all files).
  126. * @param recurse Whether to include files from subdirectories under the directory. Defaults to FALSE.
  127. */
  128. EXPORT dataset(FsFilenameRecord) RemoteDirectory(varstring machineIP, varstring dir, varstring mask='*', boolean recurse=FALSE) :=
  129. lib_fileservices.FileServices.RemoteDirectory(machineIP, dir, mask, recurse);
  130. /**
  131. * Removes a dataset of information about the logical files known to the the system.
  132. *
  133. * @param namepattern The mask of the files to list. Defaults to '*' (all files).
  134. * @param includenormal Whether to include �normal� files. Defaults to TRUE.
  135. * @param includesuper Whether to include SuperFiles. Defaults to FALSE.
  136. * @param unknownszero Whether to set file sizes that are unknown to zero(0) instead of minus-one (-1). Defaults to FALSE.
  137. * @param foreigndali The IP address of the foreign dali used to resolve the file. If blank then the file is resolved
  138. * locally. Defaults to blank.
  139. */
  140. EXPORT dataset(FsLogicalFileInfoRecord) LogicalFileList(varstring namepattern='*', boolean includenormal=true, boolean includesuper=false, boolean unknownszero=false, varstring foreigndali='') :=
  141. lib_fileservices.FileServices.LogicalFileList(namepattern, includenormal, includesuper, unknownszero, foreigndali);
  142. /**
  143. * Compares two files, and returns a result indicating how well they match.
  144. *
  145. * @param file1 The logical name of the first file.
  146. * @param file2 The logical name of the second file.
  147. * @param logical_only Whether to only compare logical information in the system datastore (Dali), and ignore physical
  148. information on disk. [Default true]
  149. * @param use_crcs Whether to compare physical CRCs of all the parts on disk. This may be slow on large files.
  150. Defaults to FALSE.
  151. * @return 0 if file1 and file2 match exactly
  152. * 1 if file1 and file2 contents match, but file1 is newer than file2
  153. * -1 if file1 and file2 contents match, but file2 is newer than file1
  154. * 2 if file1 and file2 contents do not match and file1 is newer than file2
  155. * -2 if file1 and file2 contents do not match and file2 is newer than file1
  156. */
  157. EXPORT INTEGER4 CompareFiles(varstring lfn1, varstring lfn2, boolean logical_only=true, boolean use_crcs=false) :=
  158. lib_fileservices.FileServices.CompareFiles(lfn1, lfn2, logical_only, use_crcs);
  159. /**
  160. * Checks the system datastore (Dali) information for the file against the physical parts on disk.
  161. *
  162. * @param lfn The name of the file to check.
  163. * @param use_crcs Whether to compare physical CRCs of all the parts on disk. This may be slow on large files.
  164. * @return 'OK' - The file parts match the datastore informaion
  165. * 'Could not find file: <filename>' - The logical filename was not found
  166. * 'Could not find part file: <partname>' - The partname was not found
  167. * 'Modified time differs for: <partname>' - The partname has a different timestamp
  168. * 'File size differs for: <partname>' - The partname has a file size
  169. * 'File CRC differs for: <partname>' - The partname has a different CRC
  170. */
  171. EXPORT varstring VerifyFile(varstring lfn, boolean usecrcs) :=
  172. lib_fileservices.FileServices.VerifyFile(lfn, usecrcs);
  173. /**
  174. * Defines the relationship between two files. These may be DATASETs or INDEXes. Each record in the primary file
  175. * should be uniquely defined by the primaryfields (ideally), preferably efficiently. This information is used
  176. * by the roxie browser to link files together.
  177. *
  178. * @param primary The logical filename of the primary file.
  179. * @param secondary The logical filename of the secondary file.</para>
  180. * @param primaryfields The name of the primary key field for the primary file. The value "__fileposition__"
  181. * indicates the secondary is an INDEX that must use FETCH to access non-keyed fields.
  182. * @param secondaryfields The name of the foreign key field relating to the primary file.
  183. * @param relationship The type of relationship between the primary and secondary files.
  184. * Containing either �link� or �view�. Default is "link".
  185. * @param cardinality The cardinality of the relationship. The format is <primary>:<secondary>. Valid values are
  186. * "1" or "M".
  187. * @param payload Indicates whether the primary or secondary are payload INDEXes.
  188. * @param description The desciption of the relationship.
  189. */
  190. EXPORT AddFileRelationship(varstring primary, varstring secondary, varstring primaryflds, varstring secondaryflds, varstring kind='link', varstring cardinality, boolean payload, varstring description='') :=
  191. lib_fileservices.FileServices.AddFileRelationship(primary, secondary, primaryflds, secondaryflds, kind, cardinality, payload, description);
  192. /**
  193. * Returns a dataset of relationships. The return records are structured in the FsFileRelationshipRecord format.
  194. *
  195. * @param primary The logical filename of the primary file.
  196. * @param secondary The logical filename of the secondary file.</para>
  197. * @param primaryfields The name of the primary key field for the primary file.
  198. * @param secondaryfields The name of the foreign key field relating to the primary file.
  199. * @param relationship The type of relationship between the primary and secondary files.
  200. * Containing either �link� or �view�. Default is "link".
  201. */
  202. EXPORT dataset(FsFileRelationshipRecord) FileRelationshipList(varstring primary, varstring secondary, varstring primflds='', varstring secondaryflds='', varstring kind='link') :=
  203. lib_fileservices.FileServices.FileRelationshipList(primary, secondary, primflds, secondaryflds, kind);
  204. /**
  205. * Removes a relationship between two files.
  206. *
  207. * @param primary The logical filename of the primary file.
  208. * @param secondary The logical filename of the secondary file.</para>
  209. * @param primaryfields The name of the primary key field for the primary file.
  210. * @param secondaryfields The name of the foreign key field relating to the primary file.
  211. * @param relationship The type of relationship between the primary and secondary files.
  212. * Containing either �link� or �view�. Default is "link".
  213. */
  214. EXPORT RemoveFileRelationship(varstring primary, varstring secondary, varstring primaryflds='', varstring secondaryflds='', varstring kind='link') :=
  215. lib_fileservices.FileServices.RemoveFileRelationship(primary, secondary, primaryflds, secondaryflds, kind);
  216. /**
  217. * Returns the field mappings for the file, in the same format specified for the SetColumnMapping function.
  218. *
  219. * @param lfn The logical filename of the primary file.
  220. */
  221. EXPORT varstring GetColumnMapping(varstring lfn) :=
  222. lib_fileservices.FileServices.GetColumnMapping(lfn);
  223. /**
  224. * Defines how the data in the fields of the file mist be transformed between the actual data storage format and the
  225. * input format used to query that data. This is used by the user interface of the roxie browser.
  226. *
  227. * @param lfn The logical filename of the primary file.
  228. * @param mapping A string containing a comma separated list of field mappings.
  229. */
  230. EXPORT SetColumnMapping(varstring lfn, varstring mapping) :=
  231. lib_fileservices.FileServices.SetColumnMapping(lfn, mapping);
  232. /**
  233. * Returns a string that can be used in a DATASET declaration to read data from an RFS (Remote File Server) instance
  234. * (e.g. rfsmysql) on another node.
  235. *
  236. * @param server A string containing the ip:port address for the remote file server.
  237. * @param query The text of the query to send to the server
  238. */
  239. EXPORT varstring EncodeRfsQuery(varstring server, varstring query) :=
  240. lib_fileservices.FileServices.RfsQuery(server, query);
  241. /**
  242. * Sends the query to the rfs server.
  243. *
  244. * @param server A string containing the ip:port address for the remote file server.
  245. * @param query The text of the query to send to the server
  246. */
  247. EXPORT RfsAction(varstring server, varstring query) :=
  248. lib_fileservices.FileServices.RfsAction(server, query);
  249. /**
  250. * Moves the single physical file between two locations on the same remote machine. The
  251. * dafileserv utility program must be running on the location machine.
  252. *
  253. * @param location The IP address of the remote machine.
  254. * @param frompath The path/name of the file to move.
  255. * @param topath The path/name of the target file.
  256. */
  257. EXPORT MoveExternalFile(varstring location, varstring frompath, varstring topath) :=
  258. lib_fileservices.FileServices.MoveExternalFile(location, frompath, topath);
  259. /**
  260. * Removes a single physical file from a remote machine. The
  261. * dafileserv utility program must be running on the location machine.
  262. *
  263. * @param location The IP address of the remote machine.
  264. * @param path The path/name of the file to remove.
  265. */
  266. EXPORT DeleteExternalFile(varstring location, varstring path) :=
  267. lib_fileservices.FileServices.DeleteExternalFile(location, path);
  268. /**
  269. * Creates the path on the location (if it does not already exist). The
  270. * dafileserv utility program must be running on the location machine.
  271. *
  272. * @param location The IP address of the remote machine.
  273. * @param path The path/name of the file to remove.
  274. */
  275. EXPORT CreateExternalDirectory(varstring location, varstring path) :=
  276. lib_fileservices.FileServices.CreateExternalDirectory(location, path);
  277. EXPORT varstring GetLogicalFileAttribute(varstring lfn, varstring attrname) :=
  278. lib_fileservices.FileServices.GetLogicalFileAttribute(lfn, attrname);
  279. EXPORT ProtectLogicalFile(varstring lfn, boolean value=true) :=
  280. lib_fileservices.FileServices.ProtectLogicalFile(lfn, value);
  281. EXPORT DfuPlusExec(varstring cmdline) :=
  282. lib_fileservices.FileServices.DfuPlusExec(cmdline);
  283. /*------------------------------------- Spray functions -----------------------------------------------------------*/
  284. EXPORT SprayFixed(varstring sourceIP, varstring sourcePath, integer4 recordSize, varstring destinationGroup, varstring destinationLogicalName, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowoverwrite=false, boolean replicate=false, boolean compress=false, boolean failifnosourcefile=false) :=
  285. lib_fileservices.FileServices.SprayFixed(sourceIP, sourcePath, recordSize, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowoverwrite, replicate, compress, failIfNoSourceFile);
  286. // SprayVariable is now called SprayDelimited (but the old name is available for backward compatibility)
  287. EXPORT SprayVariable(varstring sourceIP, varstring sourcePath, integer4 sourceMaxRecordSize=8192, varstring sourceCsvSeparate='\\,', varstring sourceCsvTerminate='\\n,\\r\\n', varstring sourceCsvQuote='\'', varstring destinationGroup, varstring destinationLogicalName, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowoverwrite=false, boolean replicate=false, boolean compress=false, varstring sourceCsvEscape='', boolean failifnosourcefile=false, boolean recordStructurePresent=false) :=
  288. lib_fileservices.FileServices.SprayVariable(sourceIP, sourcePath, sourceMaxRecordSize, sourceCsvSeparate, sourceCsvTerminate, sourceCsvQuote, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowoverwrite, replicate, compress, sourceCsvEscape, failIfNoSourceFile, recordStructurePresent);
  289. EXPORT SprayDelimited(varstring sourceIP, varstring sourcePath, integer4 sourceMaxRecordSize=8192, varstring sourceCsvSeparate='\\,', varstring sourceCsvTerminate='\\n,\\r\\n', varstring sourceCsvQuote='\'', varstring destinationGroup, varstring destinationLogicalName, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowoverwrite=false, boolean replicate=false, boolean compress=false, varstring sourceCsvEscape='', boolean failifnosourcefile=false, boolean recordStructurePresent=false) :=
  290. lib_fileservices.FileServices.SprayVariable(sourceIP, sourcePath, sourceMaxRecordSize, sourceCsvSeparate, sourceCsvTerminate, sourceCsvQuote, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowoverwrite, replicate, compress, sourceCsvEscape, failIfNoSourceFile, recordStructurePresent);
  291. EXPORT SprayXml(varstring sourceIP, varstring sourcePath, integer4 sourceMaxRecordSize=8192, varstring sourceRowTag, varstring sourceEncoding='utf8', varstring destinationGroup, varstring destinationLogicalName, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowoverwrite=false, boolean replicate=false, boolean compress=false, boolean failifnosourcefile=false) :=
  292. lib_fileservices.FileServices.SprayXml(sourceIP, sourcePath, sourceMaxRecordSize, sourceRowTag, sourceEncoding, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowoverwrite, replicate, compress, failIfNoSourceFile);
  293. EXPORT Despray(varstring logicalName, varstring destinationIP, varstring destinationPath, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowoverwrite=false) :=
  294. lib_fileservices.FileServices.Despray(logicalName, destinationIP, destinationPath, timeOut, espServerIpPort, maxConnections, allowoverwrite);
  295. EXPORT Copy(varstring sourceLogicalName, varstring destinationGroup, varstring destinationLogicalName, varstring sourceDali='', integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowoverwrite=false, boolean replicate=false, boolean asSuperfile=false, boolean compress=false, boolean forcePush=false, integer4 transferBufferSize=0) :=
  296. lib_fileservices.FileServices.Copy(sourceLogicalName, destinationGroup, destinationLogicalName, sourceDali, timeOut, espServerIpPort, maxConnections, allowoverwrite, replicate, asSuperfile, compress, forcePush, transferBufferSize);
  297. EXPORT Replicate(varstring logicalName, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  298. lib_fileservices.FileServices.Replicate(logicalName, timeOut, espServerIpPort);
  299. EXPORT varstring fSprayFixed(varstring sourceIP, varstring sourcePath, integer4 recordSize, varstring destinationGroup, varstring destinationLogicalName, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowoverwrite=false, boolean replicate=false, boolean compress=false, boolean failifnosourcefile=false) :=
  300. lib_fileservices.FileServices.fSprayFixed(sourceIP, sourcePath, recordSize, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowoverwrite, replicate, compress, failIfNoSourceFile);
  301. // fSprayVariable is now called fSprayDelimited (but the old name is available for backward compatibility)
  302. EXPORT varstring fSprayVariable(varstring sourceIP, varstring sourcePath, integer4 sourceMaxRecordSize=8192, varstring sourceCsvSeparate='\\,', varstring sourceCsvTerminate='\\n,\\r\\n', varstring sourceCsvQuote='\'', varstring destinationGroup, varstring destinationLogicalName, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowoverwrite=false, boolean replicate=false, boolean compress=false, varstring sourceCsvEscape='', boolean failifnosourcefile=false, boolean recordStructurePresent=false) :=
  303. lib_fileservices.FileServices.fSprayVariable(sourceIP, sourcePath, sourceMaxRecordSize, sourceCsvSeparate, sourceCsvTerminate, sourceCsvQuote, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowoverwrite, replicate, compress, sourceCsvEscape, failIfNoSourceFile, recordStructurePresent);
  304. EXPORT varstring fSprayDelimited(varstring sourceIP, varstring sourcePath, integer4 sourceMaxRecordSize=8192, varstring sourceCsvSeparate='\\,', varstring sourceCsvTerminate='\\n,\\r\\n', varstring sourceCsvQuote='\'', varstring destinationGroup, varstring destinationLogicalName, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowoverwrite=false, boolean replicate=false, boolean compress=false, varstring sourceCsvEscape='', boolean failifnosourcefile=false, boolean recordStructurePresent=false) :=
  305. lib_fileservices.FileServices.fSprayVariable(sourceIP, sourcePath, sourceMaxRecordSize, sourceCsvSeparate, sourceCsvTerminate, sourceCsvQuote, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowoverwrite, replicate, compress, sourceCsvEscape, failIfNoSourceFile, recordStructurePresent);
  306. EXPORT varstring fSprayXml(varstring sourceIP, varstring sourcePath, integer4 sourceMaxRecordSize=8192, varstring sourceRowTag, varstring sourceEncoding='utf8', varstring destinationGroup, varstring destinationLogicalName, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowoverwrite=false, boolean replicate=false, boolean compress=false, boolean failifnosourcefile=false) :=
  307. lib_fileservices.FileServices.fSprayXml(sourceIP, sourcePath, sourceMaxRecordSize, sourceRowTag, sourceEncoding, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowoverwrite, replicate, compress, failIfNoSourceFile);
  308. EXPORT varstring fDespray(varstring logicalName, varstring destinationIP, varstring destinationPath, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowoverwrite=false) :=
  309. lib_fileservices.FileServices.fDespray(logicalName, destinationIP, destinationPath, timeOut, espServerIpPort, maxConnections, allowoverwrite);
  310. EXPORT varstring fCopy(varstring sourceLogicalName, varstring destinationGroup, varstring destinationLogicalName, varstring sourceDali='', integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowoverwrite=false, boolean replicate=false, boolean asSuperfile=false, boolean compress=false, boolean forcePush=false, integer4 transferBufferSize=0) :=
  311. lib_fileservices.FileServices.fCopy(sourceLogicalName, destinationGroup, destinationLogicalName, sourceDali, timeOut, espServerIpPort, maxConnections, allowoverwrite, replicate, asSuperfile, compress, forcePush, transferBufferSize);
  312. EXPORT varstring fMonitorLogicalFileName(varstring event_name, varstring name, integer4 shotcount=1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  313. lib_fileservices.FileServices.fMonitorLogicalFileName(event_name, name, shotcount, espServerIpPort);
  314. EXPORT varstring fMonitorFile(varstring event_name, varstring ip, varstring filename, boolean subdirs=false, integer4 shotcount=1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  315. lib_fileservices.FileServices.fMonitorFile(event_name, ip, filename, subdirs, shotcount, espServerIpPort);
  316. EXPORT varstring fReplicate(varstring logicalName, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  317. lib_fileservices.FileServices.fReplicate(logicalName, timeOut, espServerIpPort);
  318. EXPORT varstring WaitDfuWorkunit(varstring wuid, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  319. lib_fileservices.FileServices.WaitDfuWorkunit(wuid, timeOut, espServerIpPort);
  320. EXPORT AbortDfuWorkunit(varstring wuid, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  321. lib_fileservices.FileServices.AbortDfuWorkunit(wuid, espServerIpPort);
  322. EXPORT MonitorLogicalFileName(varstring event_name, varstring name, integer4 shotcount=1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  323. lib_fileservices.FileServices.MonitorLogicalFileName(event_name, name, shotcount, espServerIpPort);
  324. EXPORT MonitorFile(varstring event_name, varstring ip, varstring filename, boolean subdirs=false, integer4 shotcount=1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  325. lib_fileservices.FileServices.MonitorFile(event_name, ip, filename, subdirs, shotcount, espServerIpPort);
  326. EXPORT RemotePull(varstring remoteEspFsURL, varstring sourceLogicalName, varstring destinationGroup, varstring destinationLogicalName, integer4 timeOut=-1, integer4 maxConnections=-1, boolean allowoverwrite=false, boolean replicate=false, boolean asSuperfile=false, boolean forcePush=false, integer4 transferBufferSize=0, boolean wrap=false, boolean compress=false) :=
  327. lib_fileservices.FileServices.RemotePull(remoteEspFsURL, sourceLogicalName, destinationGroup, destinationLogicalName, timeOut, maxConnections, allowoverwrite, replicate, asSuperfile, forcePush, transferBufferSize, wrap, compress);
  328. EXPORT varstring fRemotePull(varstring remoteEspFsURL, varstring sourceLogicalName, varstring destinationGroup, varstring destinationLogicalName, integer4 timeOut=-1, integer4 maxConnections=-1, boolean allowoverwrite=false, boolean replicate=false, boolean asSuperfile=false, boolean forcePush=false, integer4 transferBufferSize=0, boolean wrap=false, boolean compress=false) :=
  329. lib_fileservices.FileServices.fRemotePull(remoteEspFsURL, sourceLogicalName, destinationGroup, destinationLogicalName, timeOut, maxConnections, allowoverwrite, replicate, asSuperfile, forcePush, transferBufferSize, wrap, compress);
  330. /*------------------------------------- Superfile functions -------------------------------------------------------*/
  331. /**
  332. * Creates an empty superfile. This function is not included in a superfile transaction.
  333. *
  334. * @param lsuperfn The logical name of the superfile.
  335. * @param sequentialparts Whether the sub-files must be sequentially ordered. Default to FALSE.
  336. * @param allow_exist Indicating whether to post an error if the superfile already exists. If TRUE, no error is
  337. * posted. Defaults to FALSE.
  338. */
  339. EXPORT CreateSuperFile(varstring lsuperfn, boolean sequentialparts=false, boolean allow_exist=false) :=
  340. lib_fileservices.FileServices.CreateSuperFile(lsuperfn, sequentialparts, allow_exist);
  341. /**
  342. * Checks if the specified filename is present in the Distributed File Utility (DFU) and is a SuperFile.
  343. *
  344. * @param lsuperfn The logical name of the superfile.
  345. * @see FileExists
  346. */
  347. EXPORT boolean SuperFileExists(varstring lsuperfn) :=
  348. lib_fileservices.FileServices.SuperFileExists(lsuperfn);
  349. /**
  350. * Deletes the super file from
  351. *
  352. * @param lsuperfn The logical name of the superfile.
  353. * @see FileExists
  354. */
  355. EXPORT DeleteSuperFile(varstring lsuperfn, boolean deletesub=false) :=
  356. lib_fileservices.FileServices.DeleteSuperFile(lsuperfn, deletesub);
  357. EXPORT unsigned4 GetSuperFileSubCount(varstring lsuperfn) :=
  358. lib_fileservices.FileServices.GetSuperFileSubCount(lsuperfn);
  359. EXPORT varstring GetSuperFileSubName(varstring lsuperfn, unsigned4 filenum, boolean abspath=false) :=
  360. lib_fileservices.FileServices.GetSuperFileSubName(lsuperfn, filenum, abspath);
  361. EXPORT unsigned4 FindSuperFileSubName(varstring lsuperfn, varstring lfn) :=
  362. lib_fileservices.FileServices.FindSuperFileSubName(lsuperfn, lfn);
  363. EXPORT StartSuperFileTransaction() :=
  364. lib_fileservices.FileServices.StartSuperFileTransaction();
  365. EXPORT AddSuperFile(varstring lsuperfn, varstring lfn, unsigned4 atpos=0, boolean addcontents=false, boolean strict=false) :=
  366. lib_fileservices.FileServices.AddSuperFile(lsuperfn, lfn, atpos, addcontents, strict);
  367. EXPORT RemoveSuperFile(varstring lsuperfn, varstring lfn, boolean del=false, boolean remcontents=false) :=
  368. lib_fileservices.FileServices.RemoveSuperFile(lsuperfn, lfn, del, remcontents);
  369. EXPORT ClearSuperFile(varstring lsuperfn, boolean del=false) :=
  370. lib_fileservices.FileServices.ClearSuperFile(lsuperfn, del);
  371. EXPORT RemoveOwnedSubFiles(varstring lsuperfn, boolean del=false) :=
  372. lib_fileservices.FileServices.RemoveOwnedSubFiles(lsuperfn, del);
  373. EXPORT DeleteOwnedSubFiles(varstring lsuperfn) := // Obsolete, use RemoteOwnedSubFiles
  374. lib_fileservices.FileServices.DeleteOwnedSubFiles(lsuperfn);
  375. EXPORT SwapSuperFile(varstring lsuperfn1, varstring lsuperfn2) :=
  376. lib_fileservices.FileServices.SwapSuperFile(lsuperfn1, lsuperfn2);
  377. EXPORT ReplaceSuperFile(varstring lsuperfn, varstring lfn, varstring bylfn) :=
  378. lib_fileservices.FileServices.ReplaceSuperFile(lsuperfn, lfn, bylfn);
  379. EXPORT FinishSuperFileTransaction(boolean rollback=false) :=
  380. lib_fileservices.FileServices.FinishSuperFileTransaction(rollback);
  381. EXPORT dataset(FsLogicalFileNameRecord) SuperFileContents(varstring lsuperfn, boolean recurse=false) :=
  382. lib_fileservices.FileServices.SuperFileContents(lsuperfn, recurse);
  383. EXPORT dataset(FsLogicalFileNameRecord) LogicalFileSuperOwners(varstring lfn) :=
  384. lib_fileservices.FileServices.LogicalFileSuperOwners(lfn);
  385. EXPORT dataset(FsLogicalSuperSubRecord) LogicalFileSuperSubList() :=
  386. lib_fileservices.FileServices.LogicalFileSuperSubList();
  387. EXPORT PromoteSuperFileList(set of varstring lsuperfns, varstring addhead='', boolean deltail=false, boolean createonlyonesuperfile=false, boolean reverse=false) :=
  388. lib_fileservices.FileServices.PromoteSuperFileList(lsuperfns, addhead, deltail, createonlyonesuperfile, reverse);
  389. EXPORT varstring fPromoteSuperFileList(set of varstring lsuperfns, varstring addhead='', boolean deltail=false, boolean createonlyonesuperfile=false, boolean reverse=false) :=
  390. lib_fileservices.FileServices.fPromoteSuperFileList(lsuperfns, addhead, deltail, createonlyonesuperfile, reverse);
  391. END;