File.ecl 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  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. * export FsFilenameRecord := RECORD
  10. * string name;
  11. * integer8 size;
  12. * string19 modified;
  13. * END;
  14. */
  15. EXPORT FsFilenameRecord := lib_fileservices.FsFilenameRecord;
  16. /**
  17. * An alias for a logical filename that is stored in a row.
  18. */
  19. EXPORT FsLogicalFileName := lib_fileservices.FsLogicalFileName;
  20. /**
  21. * A record containing a logical filename. It contains the following fields:
  22. *
  23. * @field name The logical name of the file;
  24. */
  25. EXPORT FsLogicalFileNameRecord := lib_fileservices.FsLogicalFileNameRecord;
  26. /**
  27. * A record containing information about a logical file.
  28. *
  29. * @inherits Contains all the fields in FsLogicalFileNameRecord)
  30. * @field superfile Is this a superfile?
  31. * @field size Number of bytes in the file (before compression)
  32. * @field rowcount Number of rows in the file.
  33. * @modified Timestamp when the file was last modified;
  34. * @owner The username of the owner who ran the job to create this file.
  35. * @cluster The cluster that this file was created on.
  36. */
  37. EXPORT FsLogicalFileInfoRecord := lib_fileservices.FsLogicalFileInfoRecord;
  38. /**
  39. * A record containing information about a superfile and its contents.
  40. *
  41. * @field supername The name of the superfile
  42. * @field subname The name of the sub-file
  43. */
  44. EXPORT FsLogicalSuperSubRecord := lib_fileservices.FsLogicalSuperSubRecord;
  45. /**
  46. * A record containing information about the relationship between two files.
  47. *
  48. * @field primaryfile The logical filename of the primary file
  49. * @field secondaryfile The logical filename of the secondary file.
  50. * @field primaryflds The name of the primary key field for the primary file. The value "__fileposition__"
  51. * indicates the secondary is an INDEX that must use FETCH to access non-keyed fields.
  52. * @field secondaryflds The name of the foreign key field relating to the primary file.
  53. * @field kind The type of relationship between the primary and secondary files.
  54. * Containing either 'link' or 'view'.
  55. * @field cardinality The cardinality of the relationship. The format is <primary>:<secondary>. Valid values are
  56. * "1" or "M".
  57. * @field payload Indicates whether the primary or secondary are payload INDEXes.
  58. * @field description The description of the relationship.
  59. */
  60. EXPORT FsFileRelationshipRecord := lib_fileservices.FsFileRelationshipRecord;
  61. /**
  62. * Constant that indicates IBM RECFM V format file. Can be passed to SprayFixed for the record size.
  63. */
  64. EXPORT RECFMV_RECSIZE := lib_fileservices.RECFMV_RECSIZE;
  65. /**
  66. * Constant that indicates IBM RECFM VB format file. Can be passed to SprayFixed for the record size.
  67. */
  68. EXPORT RECFMVB_RECSIZE := lib_fileservices.RECFMVB_RECSIZE;
  69. /**
  70. * Constant that indicates a variable little endian 4 byte length prefixed file. Can be passed to SprayFixed for the record size.
  71. */
  72. EXPORT INTEGER4 PREFIX_VARIABLE_RECSIZE := lib_fileservices.PREFIX_VARIABLE_RECSIZE;
  73. /**
  74. * Constant that indicates a variable big endian 4 byte length prefixed file. Can be passed to SprayFixed for the record size.
  75. */
  76. EXPORT INTEGER4 PREFIX_VARIABLE_BIGENDIAN_RECSIZE := lib_fileservices.PREFIX_VARIABLE_BIGENDIAN_RECSIZE;
  77. EXPORT FsDropZone := lib_fileservices.FsDropZone;
  78. EXPORT FsDropZoneRecord := lib_fileservices.FsDropZoneRecord;
  79. /*------------------------------------- Spray functions -----------------------------------------------------------*/
  80. /**
  81. * Returns whether the file exists.
  82. *
  83. * @param lfn The logical name of the file.
  84. * @param physical Whether to also check for the physical existence on disk. Defaults to FALSE.
  85. * @return Whether the file exists.
  86. */
  87. EXPORT boolean FileExists(varstring lfn, boolean physical=FALSE) :=
  88. lib_fileservices.FileServices.FileExists(lfn, physical);
  89. /**
  90. * Removes the logical file from the system, and deletes from the disk.
  91. *
  92. * @param lfn The logical name of the file.
  93. * @param allowMissing Whether to suppress an error if the filename does not exist. Defaults to FALSE.
  94. */
  95. EXPORT DeleteLogicalFile(varstring lfn, boolean allowMissing=FALSE) :=
  96. lib_fileservices.FileServices.DeleteLogicalFile(lfn, allowMissing);
  97. /**
  98. * Changes whether access to a file is read only or not.
  99. *
  100. * @param lfn The logical name of the file.
  101. * @param ro Whether updates to the file are disallowed. Defaults to TRUE.
  102. */
  103. EXPORT SetReadOnly(varstring lfn, boolean ro=TRUE) :=
  104. lib_fileservices.FileServices.SetReadOnly(lfn, ro);
  105. /**
  106. * Changes the name of a logical file.
  107. *
  108. * @param oldname The current name of the file to be renamed.
  109. * @param newname The new logical name of the file.
  110. * @param allowOverwrite Is it valid to overwrite an existing file of the same name? Defaults to FALSE
  111. */
  112. EXPORT RenameLogicalFile(varstring oldname, varstring newname, boolean allowOverwrite=FALSE) :=
  113. lib_fileservices.FileServices.RenameLogicalFile(oldname, newname, allowOverwrite);
  114. /**
  115. * Returns a logical filename that can be used to refer to a logical file in a local or remote dali.
  116. *
  117. * @param name The logical name of the file.
  118. * @param foreigndali The IP address of the foreign dali used to resolve the file. If blank then the file is resolved
  119. * locally. Defaults to blank.
  120. * @param abspath Should a tilde (~) be prepended to the resulting logical file name. Defaults to FALSE.
  121. */
  122. EXPORT varstring ForeignLogicalFileName(varstring name, varstring foreigndali='', boolean abspath=FALSE, boolean omitClusterPrefix=FALSE) :=
  123. lib_fileservices.FileServices.ForeignLogicalFileName(name, foreigndali, abspath, omitClusterPrefix);
  124. /**
  125. * Returns an encoded logical filename that can be used to refer to a external file. Examples include directly
  126. * reading from a landing zone. Upper case characters and other details are escaped.
  127. *
  128. * @param location The IP address of the remote machine. '.' can be used for the local machine.
  129. * @param path The path/name of the file on the remote machine.
  130. * @param abspath Should a tilde (~) be prepended to the resulting logical file name. Defaults to TRUE.
  131. * @return The encoded logical filename.
  132. */
  133. EXPORT varstring ExternalLogicalFileName(varstring location, varstring path, boolean abspath=TRUE) :=
  134. lib_fileservices.FileServices.ExternalLogicalFileName(location, path, abspath);
  135. /**
  136. * Returns a string containing the description information associated with the specified filename. This description
  137. * is set either through ECL watch or by using the FileServices.SetFileDescription function.
  138. *
  139. * @param lfn The logical name of the file.
  140. */
  141. EXPORT varstring GetFileDescription(varstring lfn) :=
  142. lib_fileservices.FileServices.GetFileDescription(lfn);
  143. /**
  144. * Sets the description associated with the specified filename.
  145. *
  146. * @param lfn The logical name of the file.
  147. * @param val The description to be associated with the file.
  148. */
  149. EXPORT SetFileDescription(varstring lfn, varstring val) :=
  150. lib_fileservices.FileServices.SetFileDescription(lfn, val);
  151. /**
  152. * Returns a dataset containing a list of files from the specified machineIP and directory.
  153. *
  154. * @param machineIP The IP address of the remote machine.
  155. * @param directory The path to the directory to read. This must be in the appropriate format for the operating
  156. * system running on the remote machine.
  157. * @param mask The filemask specifying which files to include in the result. Defaults to '*' (all files).
  158. * @param recurse Whether to include files from subdirectories under the directory. Defaults to FALSE.
  159. */
  160. EXPORT dataset(FsFilenameRecord) RemoteDirectory(varstring machineIP, varstring dir, varstring mask='*', boolean recurse=FALSE) :=
  161. lib_fileservices.FileServices.RemoteDirectory(machineIP, dir, mask, recurse);
  162. /**
  163. * Returns a dataset of information about the logical files known to the system.
  164. *
  165. * @param namepattern The mask of the files to list. Defaults to '*' (all files).
  166. * @param includenormal Whether to include 'normal' files. Defaults to TRUE.
  167. * @param includesuper Whether to include SuperFiles. Defaults to FALSE.
  168. * @param unknownszero Whether to set file sizes that are unknown to zero(0) instead of minus-one (-1). Defaults to FALSE.
  169. * @param foreigndali The IP address of the foreign dali used to resolve the file. If blank then the file is resolved
  170. * locally. Defaults to blank.
  171. */
  172. EXPORT dataset(FsLogicalFileInfoRecord) LogicalFileList(varstring namepattern='*', boolean includenormal=TRUE, boolean includesuper=FALSE, boolean unknownszero=FALSE, varstring foreigndali='') :=
  173. lib_fileservices.FileServices.LogicalFileList(namepattern, includenormal, includesuper, unknownszero, foreigndali);
  174. /**
  175. * Compares two files, and returns a result indicating how well they match.
  176. *
  177. * @param file1 The logical name of the first file.
  178. * @param file2 The logical name of the second file.
  179. * @param logical_only Whether to only compare logical information in the system datastore (Dali), and ignore physical
  180. information on disk. [Default TRUE]
  181. * @param use_crcs Whether to compare physical CRCs of all the parts on disk. This may be slow on large files.
  182. Defaults to FALSE.
  183. * @return 0 if file1 and file2 match exactly
  184. * 1 if file1 and file2 contents match, but file1 is newer than file2
  185. * -1 if file1 and file2 contents match, but file2 is newer than file1
  186. * 2 if file1 and file2 contents do not match and file1 is newer than file2
  187. * -2 if file1 and file2 contents do not match and file2 is newer than file1
  188. */
  189. EXPORT INTEGER4 CompareFiles(varstring lfn1, varstring lfn2, boolean logical_only=TRUE, boolean use_crcs=FALSE) :=
  190. lib_fileservices.FileServices.CompareFiles(lfn1, lfn2, logical_only, use_crcs);
  191. /**
  192. * Checks the system datastore (Dali) information for the file against the physical parts on disk.
  193. *
  194. * @param lfn The name of the file to check.
  195. * @param use_crcs Whether to compare physical CRCs of all the parts on disk. This may be slow on large files.
  196. * @return 'OK' - The file parts match the datastore information
  197. * 'Could not find file: <filename>' - The logical filename was not found
  198. * 'Could not find part file: <partname>' - The partname was not found
  199. * 'Modified time differs for: <partname>' - The partname has a different timestamp
  200. * 'File size differs for: <partname>' - The partname has a file size
  201. * 'File CRC differs for: <partname>' - The partname has a different CRC
  202. */
  203. EXPORT varstring VerifyFile(varstring lfn, boolean usecrcs) :=
  204. lib_fileservices.FileServices.VerifyFile(lfn, usecrcs);
  205. /**
  206. * Defines the relationship between two files. These may be DATASETs or INDEXes. Each record in the primary file
  207. * should be uniquely defined by the primaryfields (ideally), preferably efficiently. This information is used
  208. * by the roxie browser to link files together.
  209. *
  210. * @param primary The logical filename of the primary file.
  211. * @param secondary The logical filename of the secondary file.
  212. * @param primaryfields The name of the primary key field for the primary file. The value "__fileposition__"
  213. * indicates the secondary is an INDEX that must use FETCH to access non-keyed fields.
  214. * @param secondaryfields The name of the foreign key field relating to the primary file.
  215. * @param relationship The type of relationship between the primary and secondary files.
  216. * Containing either 'link' or 'view'. Default is "link".
  217. * @param cardinality The cardinality of the relationship. The format is <primary>:<secondary>. Valid values are
  218. * "1" or "M".
  219. * @param payload Indicates whether the primary or secondary are payload INDEXes.
  220. * @param description The description of the relationship.
  221. */
  222. EXPORT AddFileRelationship(varstring primary, varstring secondary, varstring primaryflds, varstring secondaryflds, varstring kind='link', varstring cardinality, boolean payload, varstring description='') :=
  223. lib_fileservices.FileServices.AddFileRelationship(primary, secondary, primaryflds, secondaryflds, kind, cardinality, payload, description);
  224. /**
  225. * Returns a dataset of relationships. The return records are structured in the FsFileRelationshipRecord format.
  226. *
  227. * @param primary The logical filename of the primary file.
  228. * @param secondary The logical filename of the secondary file.</para>
  229. * @param primaryfields The name of the primary key field for the primary file.
  230. * @param secondaryfields The name of the foreign key field relating to the primary file.
  231. * @param relationship The type of relationship between the primary and secondary files.
  232. * Containing either 'link' or 'view'. Default is "link".
  233. */
  234. EXPORT dataset(FsFileRelationshipRecord) FileRelationshipList(varstring primary, varstring secondary, varstring primflds='', varstring secondaryflds='', varstring kind='link') :=
  235. lib_fileservices.FileServices.FileRelationshipList(primary, secondary, primflds, secondaryflds, kind);
  236. /**
  237. * Removes a relationship between two files.
  238. *
  239. * @param primary The logical filename of the primary file.
  240. * @param secondary The logical filename of the secondary file.
  241. * @param primaryfields The name of the primary key field for the primary file.
  242. * @param secondaryfields The name of the foreign key field relating to the primary file.
  243. * @param relationship The type of relationship between the primary and secondary files.
  244. * Containing either 'link' or 'view'. Default is "link".
  245. */
  246. EXPORT RemoveFileRelationship(varstring primary, varstring secondary, varstring primaryflds='', varstring secondaryflds='', varstring kind='link') :=
  247. lib_fileservices.FileServices.RemoveFileRelationship(primary, secondary, primaryflds, secondaryflds, kind);
  248. /**
  249. * Returns the field mappings for the file, in the same format specified for the SetColumnMapping function.
  250. *
  251. * @param lfn The logical filename of the primary file.
  252. */
  253. EXPORT varstring GetColumnMapping(varstring lfn) :=
  254. lib_fileservices.FileServices.GetColumnMapping(lfn);
  255. /**
  256. * Defines how the data in the fields of the file mist be transformed between the actual data storage format and the
  257. * input format used to query that data. This is used by the user interface of the roxie browser.
  258. *
  259. * @param lfn The logical filename of the primary file.
  260. * @param mapping A string containing a comma separated list of field mappings.
  261. */
  262. EXPORT SetColumnMapping(varstring lfn, varstring mapping) :=
  263. lib_fileservices.FileServices.SetColumnMapping(lfn, mapping);
  264. /**
  265. * Returns a string that can be used in a DATASET declaration to read data from an RFS (Remote File Server) instance
  266. * (e.g. rfsmysql) on another node.
  267. *
  268. * @param server A string containing the ip:port address for the remote file server.
  269. * @param query The text of the query to send to the server
  270. */
  271. EXPORT varstring EncodeRfsQuery(varstring server, varstring query) :=
  272. lib_fileservices.FileServices.RfsQuery(server, query);
  273. /**
  274. * Sends the query to the rfs server.
  275. *
  276. * @param server A string containing the ip:port address for the remote file server.
  277. * @param query The text of the query to send to the server
  278. */
  279. EXPORT RfsAction(varstring server, varstring query) :=
  280. lib_fileservices.FileServices.RfsAction(server, query);
  281. /**
  282. * Moves the single physical file between two locations on the same remote machine. The
  283. * dafileserv utility program must be running on the location machine.
  284. *
  285. * @param location The IP address of the remote machine.
  286. * @param frompath The path/name of the file to move.
  287. * @param topath The path/name of the target file.
  288. */
  289. EXPORT MoveExternalFile(varstring location, varstring frompath, varstring topath) :=
  290. lib_fileservices.FileServices.MoveExternalFile(location, frompath, topath);
  291. /**
  292. * Removes a single physical file from a remote machine. The
  293. * dafileserv utility program must be running on the location machine.
  294. *
  295. * @param location The IP address of the remote machine.
  296. * @param path The path/name of the file to remove.
  297. */
  298. EXPORT DeleteExternalFile(varstring location, varstring path) :=
  299. lib_fileservices.FileServices.DeleteExternalFile(location, path);
  300. /**
  301. * Creates the path on the location (if it does not already exist). The
  302. * dafileserv utility program must be running on the location machine.
  303. *
  304. * @param location The IP address of the remote machine.
  305. * @param path The path/name of the file to remove.
  306. */
  307. EXPORT CreateExternalDirectory(varstring location, varstring path) :=
  308. lib_fileservices.FileServices.CreateExternalDirectory(location, path);
  309. /**
  310. * Returns the value of the given attribute for the specified logicalfilename.
  311. *
  312. * @param lfn The name of the logical file.
  313. * @param attrname The name of the file attribute to return.
  314. */
  315. EXPORT varstring GetLogicalFileAttribute(varstring lfn, varstring attrname) :=
  316. lib_fileservices.FileServices.GetLogicalFileAttribute(lfn, attrname);
  317. /**
  318. * Toggles protection on and off for the specified logicalfilename.
  319. *
  320. * @param lfn The name of the logical file.
  321. * @param value TRUE to enable protection, FALSE to disable.
  322. */
  323. EXPORT ProtectLogicalFile(varstring lfn, boolean value=TRUE) :=
  324. lib_fileservices.FileServices.ProtectLogicalFile(lfn, value);
  325. /**
  326. * The DfuPlusExec action executes the specified command line just as the DfuPLus.exe program would do. This
  327. * allows you to have all the functionality of the DfuPLus.exe program available within your ECL code.
  328. *
  329. * param cmdline The DFUPlus.exe command line to execute. The valid arguments are documented in the Client
  330. * Tools manual, in the section describing the DfuPlus.exe program.
  331. */
  332. EXPORT DfuPlusExec(varstring cmdline) :=
  333. lib_fileservices.FileServices.DfuPlusExec(cmdline);
  334. /*------------------------------------- Spray functions -----------------------------------------------------------*/
  335. /**
  336. * Sprays a file of fixed length records from a single machine and distributes it across the nodes of the
  337. * destination group.
  338. *
  339. * @param sourceIP The IP address of the file.
  340. * @param sourcePath The path and name of the file.
  341. * @param recordsize The size (in bytes) of the records in the file.
  342. * @param destinationGroup The name of the group to distribute the file across.
  343. * @param destinationLogicalName The logical name of the file to create.
  344. * @param timeOut The time in ms to wait for the operation to complete. A value of 0 causes the call to return immediately.
  345. * Defaults to no timeout (-1).
  346. * @param espServerIpPort The url of the ESP file copying service. Defaults to the value of ws_fs_server in the environment.
  347. * @param maxConnections The maximum number of target nodes to write to concurrently. Defaults to 1.
  348. * @param allowOverwrite Is it valid to overwrite an existing file of the same name? Defaults to FALSE
  349. * @param replicate Whether to replicate the new file. Defaults to FALSE.
  350. * @param compress Whether to compress the new file. Defaults to FALSE.
  351. * @param failIfNoSourceFile If TRUE it causes a missing source file to trigger a failure. Defaults to FALSE.
  352. * @param expireDays Number of days to auto-remove file. Default is -1, not expire.
  353. * @param dfuServerQueue Name of target DFU Server queue. Default is '' (empty) for the first DFU queue in the environment.
  354. * @param noSplit Don't split a file part to multiple target parts. Default is FALSE.
  355. * @return The DFU workunit id for the job.
  356. */
  357. 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, integer4 expireDays=-1, const varstring dfuServerQueue='', boolean noSplit=FALSE) :=
  358. lib_fileservices.FileServices.fSprayFixed(sourceIP, sourcePath, recordSize, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowOverwrite, replicate, compress, failIfNoSourceFile, expireDays, dfuServerQueue, noSplit);
  359. /**
  360. * Same as fSprayFixed, but does not return the DFU Workunit ID.
  361. *
  362. * @see fSprayFixed
  363. */
  364. 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, integer4 expireDays=-1, const varstring dfuServerQueue='', boolean noSplit=FALSE) :=
  365. lib_fileservices.FileServices.SprayFixed(sourceIP, sourcePath, recordSize, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowOverwrite, replicate, compress, failIfNoSourceFile, expireDays, dfuServerQueue, noSplit);
  366. // fSprayVariable is now called fSprayDelimited (but the old name is available for backward compatibility)
  367. 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, boolean quotedTerminator=TRUE, varstring encoding='ascii', integer4 expireDays=-1, varstring dfuServerQueue='', boolean noSplit=FALSE) :=
  368. lib_fileservices.FileServices.fSprayVariable(sourceIP, sourcePath, sourceMaxRecordSize, sourceCsvSeparate, sourceCsvTerminate, sourceCsvQuote, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowOverwrite, replicate, compress, sourceCsvEscape, failIfNoSourceFile, recordStructurePresent, quotedTerminator, encoding, expireDays, dfuServerQueue, noSplit);
  369. // SprayVariable is now called SprayDelimited (but the old name is available for backward compatibility)
  370. 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, boolean quotedTerminator=TRUE, varstring encoding='ascii', integer4 expireDays=-1, const varstring dfuServerQueue='', boolean noSplit=FALSE) :=
  371. lib_fileservices.FileServices.SprayVariable(sourceIP, sourcePath, sourceMaxRecordSize, sourceCsvSeparate, sourceCsvTerminate, sourceCsvQuote, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowOverwrite, replicate, compress, sourceCsvEscape, failIfNoSourceFile, recordStructurePresent, quotedTerminator, encoding, expireDays, dfuServerQueue, noSplit);
  372. /**
  373. * Sprays a file of fixed delimited records from a single machine and distributes it across the nodes of the
  374. * destination group.
  375. *
  376. * @param sourceIP The IP address of the file.
  377. * @param sourcePath The path and name of the file.
  378. * @param sourceCsvSeparate The character sequence which separates fields in the file.
  379. * @param sourceCsvTerminate The character sequence which separates records in the file.
  380. * @param sourceCsvQuote A string which can be used to delimit fields in the file.
  381. * @param sourceMaxRecordSize The maximum size (in bytes) of the records in the file.
  382. * @param destinationGroup The name of the group to distribute the file across.
  383. * @param destinationLogicalName The logical name of the file to create.
  384. * @param timeOut The time in ms to wait for the operation to complete. A value of 0 causes the call to return immediately.
  385. * Defaults to no timeout (-1).
  386. * @param espServerIpPort The url of the ESP file copying service. Defaults to the value of ws_fs_server in the environment.
  387. * @param maxConnections The maximum number of target nodes to write to concurrently. Defaults to 1.
  388. * @param allowOverwrite Is it valid to overwrite an existing file of the same name? Defaults to FALSE
  389. * @param replicate Whether to replicate the new file. Defaults to FALSE.
  390. * @param compress Whether to compress the new file. Defaults to FALSE.
  391. * @param sourceCsvEscape A character that is used to escape quote characters. Defaults to none.
  392. * @param failIfNoSourceFile If TRUE it causes a missing source file to trigger a failure. Defaults to FALSE.
  393. * @param recordStructurePresent If TRUE derives the record structure from the header of the file.
  394. * @param quotedTerminator Can the terminator character be included in a quoted field. Defaults to TRUE.
  395. * If FALSE it allows quicker partitioning of the file (avoiding a complete file scan).
  396. * @param encoding A null-terminated string containing the encoding.
  397. * Can be set to one of the following:
  398. * ascii, utf8, utf8n, utf16, utf16le, utf16be, utf32, utf32le,utf32be. If omitted, the default is ascii.
  399. * @param expireDays Number of days to auto-remove file. Default is -1, not expire.
  400. * @param dfuServerQueue Name of target DFU Server queue. Default is '' (empty) for the first DFU queue in the environment.
  401. * @param noSplit Don't split a file part to multiple target parts. Default is FALSE.
  402. * @return The DFU workunit id for the job.
  403. */
  404. 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, boolean quotedTerminator=TRUE, varstring encoding='ascii', integer4 expireDays=-1, const varstring dfuServerQueue='', boolean noSplit=FALSE) :=
  405. lib_fileservices.FileServices.fSprayVariable(sourceIP, sourcePath, sourceMaxRecordSize, sourceCsvSeparate, sourceCsvTerminate, sourceCsvQuote, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowOverwrite, replicate, compress, sourceCsvEscape, failIfNoSourceFile, recordStructurePresent, quotedTerminator, encoding, expireDays, dfuServerQueue, noSplit);
  406. /**
  407. * Same as fSprayDelimited, but does not return the DFU Workunit ID.
  408. *
  409. * @see fSprayDelimited
  410. */
  411. 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, boolean quotedTerminator=TRUE, const varstring encoding='ascii', integer4 expireDays=-1, const varstring dfuServerQueue='', boolean noSplit=FALSE) :=
  412. lib_fileservices.FileServices.SprayVariable(sourceIP, sourcePath, sourceMaxRecordSize, sourceCsvSeparate, sourceCsvTerminate, sourceCsvQuote, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowOverwrite, replicate, compress, sourceCsvEscape, failIfNoSourceFile, recordStructurePresent, quotedTerminator, encoding, expireDays, dfuServerQueue, noSplit);
  413. /**
  414. * Sprays an xml file from a single machine and distributes it across the nodes of the destination group.
  415. *
  416. * @param sourceIP The IP address of the file.
  417. * @param sourcePath The path and name of the file.
  418. * @param sourceMaxRecordSize The maximum size (in bytes) of the records in the file.
  419. * @param sourceRowTag The xml tag that is used to delimit records in the source file. (This tag cannot recursivly nest.)
  420. * @param sourceEncoding The unicode encoding of the file. (utf8,utf8n,utf16be,utf16le,utf32be,utf32le)
  421. * @param destinationGroup The name of the group to distribute the file across.
  422. * @param destinationLogicalName The logical name of the file to create.
  423. * @param timeOut The time in ms to wait for the operation to complete. A value of 0 causes the call to return immediately.
  424. * Defaults to no timeout (-1).
  425. * @param espServerIpPort The url of the ESP file copying service. Defaults to the value of ws_fs_server in the environment.
  426. * @param maxConnections The maximum number of target nodes to write to concurrently. Defaults to 1.
  427. * @param allowOverwrite Is it valid to overwrite an existing file of the same name? Defaults to FALSE
  428. * @param replicate Whether to replicate the new file. Defaults to FALSE.
  429. * @param compress Whether to compress the new file. Defaults to FALSE.
  430. * @param failIfNoSourceFile If TRUE it causes a missing source file to trigger a failure. Defaults to FALSE.
  431. * @param expireDays Number of days to auto-remove file. Default is -1, not expire.
  432. * @param dfuServerQueue Name of target DFU Server queue. Default is '' (empty) for the first DFU queue in the environment.
  433. * @param noSplit Don't split a file part to multiple target parts. Default is FALSE.
  434. * @return The DFU workunit id for the job.
  435. */
  436. 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, integer4 expireDays=-1, const varstring dfuServerQueue='', boolean noSplit=FALSE) :=
  437. lib_fileservices.FileServices.fSprayXml(sourceIP, sourcePath, sourceMaxRecordSize, sourceRowTag, sourceEncoding, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowOverwrite, replicate, compress, failIfNoSourceFile, expireDays, dfuServerQueue, noSplit);
  438. /**
  439. * Same as fSprayXml, but does not return the DFU Workunit ID.
  440. *
  441. * @see fSprayXml
  442. */
  443. 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, integer4 expireDays=-1, const varstring dfuServerQueue='', boolean noSplit=FALSE) :=
  444. lib_fileservices.FileServices.SprayXml(sourceIP, sourcePath, sourceMaxRecordSize, sourceRowTag, sourceEncoding, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowOverwrite, replicate, compress, failIfNoSourceFile, expireDays, dfuServerQueue, noSplit);
  445. /**
  446. * Sprays an json file from a single machine and distributes it across the nodes of the destination group.
  447. *
  448. * @param sourceIP The IP address of the file.
  449. * @param sourcePath The path and name of the file.
  450. * @param sourceMaxRecordSize The maximum size (in bytes) of the records in the file.
  451. * @param sourceRowPath The JSON path that is used to delimit records in the source file.
  452. * @param sourceEncoding The unicode encoding of the file. (utf8,utf8n,utf16be,utf16le,utf32be,utf32le)
  453. * @param destinationGroup The name of the group to distribute the file across.
  454. * @param destinationLogicalName The logical name of the file to create.
  455. * @param timeOut The time in ms to wait for the operation to complete. A value of 0 causes the call to return immediately.
  456. * Defaults to no timeout (-1).
  457. * @param espServerIpPort The url of the ESP file copying service. Defaults to the value of ws_fs_server in the environment.
  458. * @param maxConnections The maximum number of target nodes to write to concurrently. Defaults to 1.
  459. * @param allowOverwrite Is it valid to overwrite an existing file of the same name? Defaults to FALSE
  460. * @param replicate Whether to replicate the new file. Defaults to FALSE.
  461. * @param compress Whether to compress the new file. Defaults to FALSE.
  462. * @param failIfNoSourceFile If TRUE it causes a missing source file to trigger a failure. Defaults to FALSE.
  463. * @param expireDays Number of days to auto-remove file. Default is -1, not expire.
  464. * @param dfuServerQueue Name of target DFU Server queue. Default is '' (empty) for the first DFU queue in the environment.
  465. * @param noSplit Don't split a file part to multiple target parts. Default is FALSE.
  466. * @param username String containing a username to use for authenticated access to the ESP process; an empty string value
  467. * indicates that no user authentication is required; OPTIONAL, defaults to an empty string
  468. * @param userPw String containing the password to be used with the user cited in the username argument; if username is
  469. * empty then this will be ignored; OPTIONAL, defaults to an empty string
  470. * @return The DFU workunit id for the job.
  471. */
  472. EXPORT varstring fSprayJson(varstring sourceIP, varstring sourcePath, integer4 sourceMaxRecordSize=8192, varstring sourceRowPath='/', 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, integer4 expireDays=-1, const varstring dfuServerQueue='', boolean noSplit=FALSE, const varstring username = '', const varstring userPw = '') :=
  473. lib_fileservices.FileServices.fSprayJson(sourceIP, sourcePath, sourceMaxRecordSize, sourceRowPath, sourceEncoding, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowOverwrite, replicate, compress, failIfNoSourceFile, expireDays, dfuServerQueue, noSplit, username, userPw);
  474. /**
  475. * Same as fSprayJson, but does not return the DFU Workunit ID.
  476. *
  477. * @see fSprayJson
  478. */
  479. EXPORT SprayJson(varstring sourceIP, varstring sourcePath, integer4 sourceMaxRecordSize=8192, varstring sourceRowPath='/', 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, integer4 expireDays=-1, const varstring dfuServerQueue='', boolean noSplit=FALSE, const varstring username = '', const varstring userPw = '') :=
  480. lib_fileservices.FileServices.SprayJson(sourceIP, sourcePath, sourceMaxRecordSize, sourceRowPath, sourceEncoding, destinationGroup, destinationLogicalName, timeOut, espServerIpPort, maxConnections, allowOverwrite, replicate, compress, failIfNoSourceFile, expireDays, dfuServerQueue, noSplit, username, userPw);
  481. /**
  482. * Copies a distributed file from multiple machines, and desprays it to a single file on a single machine.
  483. *
  484. * @param logicalName The name of the file to despray.
  485. * @param destinationIP The IP of the target machine.
  486. * @param destinationPath The path of the file to create on the destination machine.
  487. * @param timeOut The time in ms to wait for the operation to complete. A value of 0 causes the call to return immediately.
  488. * Defaults to no timeout (-1).
  489. * @param espServerIpPort The url of the ESP file copying service. Defaults to the value of ws_fs_server in the environment.
  490. * @param maxConnections The maximum number of target nodes to write to concurrently. Defaults to 1.
  491. * @param allowOverwrite Is it valid to overwrite an existing file of the same name? Defaults to FALSE
  492. * @return The DFU workunit id for the job.
  493. */
  494. EXPORT varstring fDespray(varstring logicalName, varstring destinationIP, varstring destinationPath, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowOverwrite=FALSE) :=
  495. lib_fileservices.FileServices.fDespray(logicalName, destinationIP, destinationPath, timeOut, espServerIpPort, maxConnections, allowOverwrite);
  496. /**
  497. * Same as fDespray, but does not return the DFU Workunit ID.
  498. *
  499. * @see fDespray
  500. */
  501. EXPORT Despray(varstring logicalName, varstring destinationIP, varstring destinationPath, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server'), integer4 maxConnections=-1, boolean allowOverwrite=FALSE) :=
  502. lib_fileservices.FileServices.Despray(logicalName, destinationIP, destinationPath, timeOut, espServerIpPort, maxConnections, allowOverwrite);
  503. /**
  504. * Copies a distributed file to another distributed file.
  505. *
  506. * @param sourceLogicalName The name of the file to despray.
  507. * @param destinationGroup The name of the group to distribute the file across.
  508. * @param destinationLogicalName The logical name of the file to create.
  509. * @param sourceDali The dali that contains the source file (blank implies same dali). Defaults to same dali.
  510. * @param timeOut The time in ms to wait for the operation to complete. A value of 0 causes the call to return immediately.
  511. * Defaults to no timeout (-1).
  512. * @param espServerIpPort The url of the ESP file copying service. Defaults to the value of ws_fs_server in the environment.
  513. * @param maxConnections The maximum number of target nodes to write to concurrently. Defaults to 1.
  514. * @param allowOverwrite Is it valid to overwrite an existing file of the same name? Defaults to FALSE
  515. * @param replicate Should the copied file also be replicated on the destination? Defaults to FALSE
  516. * @param asSuperfile Should the file be copied as a superfile? If TRUE and source is a superfile, then the
  517. * operation creates a superfile on the target, creating sub-files as needed and only overwriting
  518. * existing sub-files whose content has changed. If FALSE, a single file is created. Defaults to FALSE.
  519. * @param compress Whether to compress the new file. Defaults to FALSE.
  520. * @param forcePush Should the copy process be executed on the source nodes (push) or on the destination nodes (pull)?
  521. * Default is to pull.
  522. * @param transferBufferSize Overrides the size (in bytes) of the internal buffer used to copy the file. Default is 64k.
  523. * @param noSplit Don't split a file part to multiple target parts. Default is FALSE.
  524. * @param expireDays Number of days to auto-remove file. Default is -1, not expire.
  525. * @return The DFU workunit id for the job.
  526. */
  527. 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, boolean preserveCompression=TRUE, boolean noSplit=FALSE, integer4 expireDays=-1) :=
  528. lib_fileservices.FileServices.fCopy(sourceLogicalName, destinationGroup, destinationLogicalName, sourceDali, timeOut, espServerIpPort, maxConnections, allowOverwrite, replicate, asSuperfile, compress, forcePush, transferBufferSize, preserveCompression, noSplit, expireDays);
  529. /**
  530. * Same as fCopy, but does not return the DFU Workunit ID.
  531. *
  532. * @see fCopy
  533. */
  534. 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, boolean preserveCompression=TRUE, boolean noSplit=FALSE, integer4 expireDays=-1) :=
  535. lib_fileservices.FileServices.Copy(sourceLogicalName, destinationGroup, destinationLogicalName, sourceDali, timeOut, espServerIpPort, maxConnections, allowOverwrite, replicate, asSuperfile, compress, forcePush, transferBufferSize, preserveCompression, noSplit, expireDays);
  536. /**
  537. * Ensures the specified file is replicated to its mirror copies.
  538. *
  539. * @param logicalName The name of the file to replicate.
  540. * @param timeOut The time in ms to wait for the operation to complete. A value of 0 causes the call to return immediately.
  541. * Defaults to no timeout (-1).
  542. * @param espServerIpPort The url of the ESP file copying service. Defaults to the value of ws_fs_server in the environment.
  543. * @return The DFU workunit id for the job.
  544. */
  545. EXPORT varstring fReplicate(varstring logicalName, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  546. lib_fileservices.FileServices.fReplicate(logicalName, timeOut, espServerIpPort);
  547. /**
  548. * Same as fReplicated, but does not return the DFU Workunit ID.
  549. *
  550. * @see fReplicate
  551. */
  552. EXPORT Replicate(varstring logicalName, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  553. lib_fileservices.FileServices.Replicate(logicalName, timeOut, espServerIpPort);
  554. /**
  555. * Copies a distributed file to a distributed file on remote system. Similar to fCopy, except the copy executes
  556. * remotely. Since the DFU workunit executes on the remote DFU server, the user name authentication must be the same
  557. * on both systems, and the user must have rights to copy files on both systems.
  558. *
  559. * @param remoteEspFsURL The url of the remote ESP file copying service.
  560. * @param sourceLogicalName The name of the file to despray.
  561. * @param destinationGroup The name of the group to distribute the file across.
  562. * @param destinationLogicalName The logical name of the file to create.
  563. * @param timeOut The time in ms to wait for the operation to complete. A value of 0 causes the call to return immediately.
  564. * Defaults to no timeout (-1).
  565. * @param maxConnections The maximum number of target nodes to write to concurrently. Defaults to 1.
  566. * @param allowOverwrite Is it valid to overwrite an existing file of the same name? Defaults to FALSE
  567. * @param replicate Should the copied file also be replicated on the destination? Defaults to FALSE
  568. * @param asSuperfile Should the file be copied as a superfile? If TRUE and source is a superfile, then the
  569. * operation creates a superfile on the target, creating sub-files as needed and only overwriting
  570. * existing sub-files whose content has changed. If FALSE a single file is created. Defaults to FALSE.
  571. * @param compress Whether to compress the new file. Defaults to FALSE.
  572. * @param forcePush Should the copy process should be executed on the source nodes (push) or on the destination nodes (pull)?
  573. * Default is to pull.
  574. * @param transferBufferSize Overrides the size (in bytes) of the internal buffer used to copy the file. Default is 64k.
  575. * @param wrap Should the fileparts be wrapped when copying to a smaller sized cluster? The default is FALSE.
  576. * @param noSplit Don't split a file part to multiple target parts. Default is FALSE.
  577. * @param expireDays Number of days to auto-remove file. Default is -1, not expire.
  578. * @param username String containing a username to use for authenticated access to the ESP process; an empty string value
  579. * indicates that no user authentication is required. OPTIONAL, defaults to an empty string
  580. * @param userPW String containing the password to be used with the user cited in the username argument; if username is
  581. * empty then this will be ignored; OPTIONAL, defaults to an empty string
  582. *
  583. * @return The DFU workunit id for the job.
  584. */
  585. 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, boolean noSplit=FALSE, integer4 expireDays=-1, const varstring username = '', const varstring userPw = '') :=
  586. lib_fileservices.FileServices.fRemotePull(remoteEspFsURL, sourceLogicalName, destinationGroup, destinationLogicalName, timeOut, maxConnections, allowOverwrite, replicate, asSuperfile, forcePush, transferBufferSize, wrap, compress, noSplit, expireDays, username, userPw);
  587. /**
  588. * Same as fRemotePull, but does not return the DFU Workunit ID.
  589. *
  590. * @see fRemotePull
  591. */
  592. 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, boolean noSplit=FALSE, integer4 expireDays=-1, const varstring username = '', const varstring userPw = '') :=
  593. lib_fileservices.FileServices.RemotePull(remoteEspFsURL, sourceLogicalName, destinationGroup, destinationLogicalName, timeOut, maxConnections, allowOverwrite, replicate, asSuperfile, forcePush, transferBufferSize, wrap, compress, noSplit, expireDays, username, userPw);
  594. /*------------------------------------- File monitoring functions -------------------------------------------------------*/
  595. /**
  596. * Creates a file monitor job in the DFU Server. If an appropriately named file arrives in this interval it will fire
  597. * the event with the name of the triggering object as the event subtype (see the EVENT function).
  598. *
  599. * @param eventToFire The user-defined name of the event to fire when the filename appears. This value is used as
  600. * the first parameter to the EVENT function.
  601. * @param name The name of the logical file to monitor. This may contain wildcard characters ( * and ?)
  602. * @param shotCount The number of times to generate the event before the monitoring job completes. A value
  603. * of -1 indicates the monitoring job continues until manually aborted. The default is 1.
  604. * @param espServerIpPort The url of the ESP file copying service. Defaults to the value of ws_fs_server in the environment.
  605. * @return The DFU workunit id for the job.
  606. */
  607. EXPORT varstring fMonitorLogicalFileName(varstring eventToFire, varstring name, integer4 shotCount=1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  608. lib_fileservices.FileServices.fMonitorLogicalFileName(eventToFire, name, shotCount, espServerIpPort);
  609. /**
  610. * Same as fMonitorLogicalFileName, but does not return the DFU Workunit ID.
  611. *
  612. * @see fMonitorLogicalFileName
  613. */
  614. EXPORT MonitorLogicalFileName(varstring eventToFire, varstring name, integer4 shotCount=1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  615. lib_fileservices.FileServices.MonitorLogicalFileName(eventToFire, name, shotCount, espServerIpPort);
  616. /**
  617. * Creates a file monitor job in the DFU Server. If an appropriately named file arrives in this interval it will fire
  618. * the event with the name of the triggering object as the event subtype (see the EVENT function).
  619. *
  620. * @param eventToFire The user-defined name of the event to fire when the filename appears. This value is used as
  621. * the first parameter to the EVENT function.
  622. * @param ip The the IP address for the file to monitor. This may be omitted if the filename parameter
  623. * contains a complete URL.
  624. * @param filename The full path of the file(s) to monitor. This may contain wildcard characters ( * and ?)
  625. * @param subDirs Whether to include files in sub-directories (when the filename contains wildcards). Defaults to FALSE.
  626. * @param shotCount The number of times to generate the event before the monitoring job completes. A value
  627. * of -1 indicates the monitoring job continues until manually aborted. The default is 1.
  628. * @param espServerIpPort The url of the ESP file copying service. Defaults to the value of ws_fs_server in the environment.
  629. * @return The DFU workunit id for the job.
  630. */
  631. EXPORT varstring fMonitorFile(varstring eventToFire, varstring ip, varstring filename, boolean subDirs=FALSE, integer4 shotCount=1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  632. lib_fileservices.FileServices.fMonitorFile(eventToFire, ip, filename, subDirs, shotCount, espServerIpPort);
  633. /**
  634. * Same as fMonitorFile, but does not return the DFU Workunit ID.
  635. *
  636. * @see fMonitorFile
  637. */
  638. EXPORT MonitorFile(varstring eventToFire, varstring ip, varstring filename, boolean subdirs=FALSE, integer4 shotCount=1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  639. lib_fileservices.FileServices.MonitorFile(eventToFire, ip, filename, subdirs, shotCount, espServerIpPort);
  640. /**
  641. * Waits for the specified DFU workunit to finish.
  642. *
  643. * @param wuid The dfu wfid to wait for.
  644. * @param timeOut The time in ms to wait for the operation to complete. A value of 0 causes the call to return immediately.
  645. * Defaults to no timeout (-1).
  646. * @param espServerIpPort The url of the ESP file copying service. Defaults to the value of ws_fs_server in the environment.
  647. * @return A string containing the final status string of the DFU workunit.
  648. */
  649. EXPORT varstring WaitDfuWorkunit(varstring wuid, integer4 timeOut=-1, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  650. lib_fileservices.FileServices.WaitDfuWorkunit(wuid, timeOut, espServerIpPort);
  651. /**
  652. * Aborts the specified DFU workunit.
  653. *
  654. * @param wuid The dfu wfid to abort.
  655. * @param espServerIpPort The url of the ESP file copying service. Defaults to the value of ws_fs_server in the environment.
  656. */
  657. EXPORT AbortDfuWorkunit(varstring wuid, varstring espServerIpPort=GETENV('ws_fs_server')) :=
  658. lib_fileservices.FileServices.AbortDfuWorkunit(wuid, espServerIpPort);
  659. /*------------------------------------- Superfile functions -------------------------------------------------------*/
  660. /**
  661. * Creates an empty superfile. This function is not included in a superfile transaction.
  662. *
  663. * @param superName The logical name of the superfile.
  664. * @param sequentialParts Whether the sub-files must be sequentially ordered. Default to FALSE.
  665. * @param allowExist Indicating whether to post an error if the superfile already exists. If TRUE, no error is
  666. * posted. Defaults to FALSE.
  667. */
  668. EXPORT CreateSuperFile(varstring superName, boolean sequentialParts=FALSE, boolean allowExist=FALSE) :=
  669. lib_fileservices.FileServices.CreateSuperFile(superName, sequentialParts, allowExist);
  670. /**
  671. * Checks if the specified filename is present in the Distributed File Utility (DFU) and is a SuperFile.
  672. *
  673. * @param superName The logical name of the superfile.
  674. * @return Whether the file exists.
  675. *
  676. * @see FileExists
  677. */
  678. EXPORT boolean SuperFileExists(varstring superName) :=
  679. lib_fileservices.FileServices.SuperFileExists(superName);
  680. /**
  681. * Deletes the superfile.
  682. *
  683. * @param superName The logical name of the superfile.
  684. *
  685. * @see FileExists
  686. */
  687. EXPORT DeleteSuperFile(varstring superName, boolean deletesub=FALSE) :=
  688. lib_fileservices.FileServices.DeleteSuperFile(superName, deletesub);
  689. /**
  690. * Returns the number of sub-files contained within a superfile.
  691. *
  692. * @param superName The logical name of the superfile.
  693. * @return The number of sub-files within the superfile.
  694. */
  695. EXPORT unsigned4 GetSuperFileSubCount(varstring superName) :=
  696. lib_fileservices.FileServices.GetSuperFileSubCount(superName);
  697. /**
  698. * Returns the name of the Nth sub-file within a superfile.
  699. *
  700. * @param superName The logical name of the superfile.
  701. * @param fileNum The 1-based position of the sub-file to return the name of.
  702. * @param absPath Whether to prepend '~' to the name of the resulting logical file name.
  703. * @return The logical name of the selected sub-file.
  704. */
  705. EXPORT varstring GetSuperFileSubName(varstring superName, unsigned4 fileNum, boolean absPath=FALSE) :=
  706. lib_fileservices.FileServices.GetSuperFileSubName(superName, fileNum, absPath);
  707. /**
  708. * Returns the position of a file within a superfile.
  709. *
  710. * @param superName The logical name of the superfile.
  711. * @param subName The logical name of the sub-file.
  712. * @return The 1-based position of the sub-file within the superfile.
  713. */
  714. EXPORT unsigned4 FindSuperFileSubName(varstring superName, varstring subName) :=
  715. lib_fileservices.FileServices.FindSuperFileSubName(superName, subName);
  716. /**
  717. * Starts a superfile transaction. All superfile operations within the transaction will either be
  718. * executed atomically or rolled back when the transaction is finished.
  719. */
  720. EXPORT StartSuperFileTransaction() :=
  721. lib_fileservices.FileServices.StartSuperFileTransaction();
  722. /**
  723. * Adds a file to a superfile.
  724. *
  725. * @param superName The logical name of the superfile.
  726. * @param subName The name of the logical file to add.
  727. * @param atPos The position to add the sub-file, or 0 to append. Defaults to 0.
  728. * @param addContents Controls whether adding a superfile adds the superfile, or its contents. Defaults to FALSE (do not expand).
  729. * @param strict Check addContents only if subName is a superfile, and ensure superfiles exist.
  730. */
  731. EXPORT AddSuperFile(varstring superName, varstring subName, unsigned4 atPos=0, boolean addContents=FALSE, boolean strict=FALSE) :=
  732. lib_fileservices.FileServices.AddSuperFile(superName, subName, atPos, addContents, strict);
  733. /**
  734. * Removes a sub-file from a superfile.
  735. *
  736. * @param superName The logical name of the superfile.
  737. * @param subName The name of the sub-file to remove.
  738. * @param del Indicates whether the sub-file should also be removed from the disk. Defaults to FALSE.
  739. * @param removeContents Controls whether the contents of a sub-file which is a superfile should be recursively removed. Defaults to FALSE.
  740. */
  741. EXPORT RemoveSuperFile(varstring superName, varstring subName, boolean del=FALSE, boolean removeContents=FALSE) :=
  742. lib_fileservices.FileServices.RemoveSuperFile(superName, subName, del, removeContents);
  743. /**
  744. * Removes all sub-files from a superfile.
  745. *
  746. * @param superName The logical name of the superfile.
  747. * @param del Indicates whether the sub-files should also be removed from the disk. Defaults to FALSE.
  748. */
  749. EXPORT ClearSuperFile(varstring superName, boolean del=FALSE) :=
  750. lib_fileservices.FileServices.ClearSuperFile(superName, del);
  751. /**
  752. * Removes all soley-owned sub-files from a superfile. If a sub-file is also contained within another superfile
  753. * then it is retained.
  754. *
  755. * @param superName The logical name of the superfile.
  756. */
  757. EXPORT RemoveOwnedSubFiles(varstring superName, boolean del=FALSE) :=
  758. lib_fileservices.FileServices.RemoveOwnedSubFiles(superName, del);
  759. /**
  760. * Legacy version of RemoveOwnedSubFiles which was incorrectly named in a previous version.
  761. *
  762. * @see RemoveOwnedSubFIles
  763. */
  764. EXPORT DeleteOwnedSubFiles(varstring superName) := // Obsolete, use RemoteOwnedSubFiles
  765. lib_fileservices.FileServices.DeleteOwnedSubFiles(superName);
  766. /**
  767. * Swap the contents of two superfiles.
  768. *
  769. * @param superName1 The logical name of the first superfile.
  770. * @param superName2 The logical name of the second superfile.
  771. */
  772. EXPORT SwapSuperFile(varstring superName1, varstring superName2) :=
  773. lib_fileservices.FileServices.SwapSuperFile(superName1, superName2);
  774. /**
  775. * Removes a sub-file from a superfile and replaces it with another.
  776. *
  777. * @param superName The logical name of the superfile.
  778. * @param oldSubFile The logical name of the sub-file to remove.
  779. * @param newSubFile The logical name of the sub-file to replace within the superfile.
  780. */
  781. EXPORT ReplaceSuperFile(varstring superName, varstring oldSubFile, varstring newSubFile) :=
  782. lib_fileservices.FileServices.ReplaceSuperFile(superName, oldSubFile, newSubFile);
  783. /**
  784. * Finishes a superfile transaction. This executes all the operations since the matching StartSuperFileTransaction().
  785. * If there are any errors, then all of the operations are rolled back.
  786. */
  787. EXPORT FinishSuperFileTransaction(boolean rollback=FALSE) :=
  788. lib_fileservices.FileServices.FinishSuperFileTransaction(rollback);
  789. /**
  790. * Returns the list of sub-files contained within a superfile.
  791. *
  792. * @param superName The logical name of the superfile.
  793. * @param recurse Should the contents of child-superfiles be expanded. Default is FALSE.
  794. * @return A dataset containing the names of the sub-files.
  795. */
  796. EXPORT dataset(FsLogicalFileNameRecord) SuperFileContents(varstring superName, boolean recurse=FALSE) :=
  797. lib_fileservices.FileServices.SuperFileContents(superName, recurse);
  798. /**
  799. * Returns the list of superfiles that a logical file is contained within.
  800. *
  801. * @param name The name of the logical file.
  802. * @return A dataset containing the names of the superfiles.
  803. */
  804. EXPORT dataset(FsLogicalFileNameRecord) LogicalFileSuperOwners(varstring name) :=
  805. lib_fileservices.FileServices.LogicalFileSuperOwners(name);
  806. /**
  807. * Returns the list of all the superfiles in the system and their component sub-files.
  808. *
  809. * @return A dataset containing pairs of superName,subName for each component file.
  810. */
  811. EXPORT dataset(FsLogicalSuperSubRecord) LogicalFileSuperSubList() :=
  812. lib_fileservices.FileServices.LogicalFileSuperSubList();
  813. /**
  814. * Moves the sub-files from the first entry in the list of superfiles to the next in the list, repeating the process
  815. * through the list of superfiles.
  816. *
  817. * @param superNames A set of the names of the superfiles to act on. Any that do not exist will be created.
  818. * The contents of each superfile will be moved to the next in the list.
  819. * @param addHead A string containing a comma-delimited list of logical file names to add to the first superfile
  820. * after the promotion process is complete. Defaults to ''.
  821. * @param delTail Indicates whether to physically delete the contents moved out of the last superfile. The default is FALSE.
  822. * @param createOnlyOne Specifies whether to only create a single superfile (truncate the list at the first
  823. * non-existent superfile). The default is FALSE.
  824. * @param reverse Reverse the order of processing the superfiles list, effectively 'demoting' instead of 'promoting' the sub-files. The default is FALSE.
  825. *
  826. * @return A string containing a comma separated list of the previous sub-file contents of the emptied superfile.
  827. */
  828. EXPORT varstring fPromoteSuperFileList(set of varstring superNames, varstring addHead='', boolean delTail=FALSE, boolean createOnlyOne=FALSE, boolean reverse=FALSE) :=
  829. lib_fileservices.FileServices.fPromoteSuperFileList(superNames, addHead, delTail, createOnlyOne, reverse);
  830. /**
  831. * Same as fPromoteSuperFileList, but does not return the DFU Workunit ID.
  832. *
  833. * @see fPromoteSuperFileList
  834. */
  835. EXPORT PromoteSuperFileList(set of varstring superNames, varstring addHead='', boolean delTail=FALSE, boolean createOnlyOne=FALSE, boolean reverse=FALSE) :=
  836. lib_fileservices.FileServices.PromoteSuperFileList(superNames, addHead, delTail, createOnlyOne, reverse);
  837. /**
  838. * Returns the full URL to an ESP server process
  839. *
  840. * @param username String containing a username to use for authenticated
  841. * access to the ESP process; an empty string value
  842. * indicates that no user authentication is required;
  843. * OPTIONAL, defaults to an empty string
  844. * @param userPW String containing the password to be used with the
  845. * user cited in the username argument; if username is
  846. * empty then this will be ignored; OPTIONAL, defaults
  847. * to an empty string
  848. *
  849. * @return A string containing the full URL (including HTTP scheme
  850. * and port) to an ESP server process; if more than one
  851. * process is defined then the first found process will
  852. * be returned; will return an empty string if an ESP
  853. * server process cannot be found
  854. */
  855. EXPORT varstring GetEspURL(const varstring username = '', const varstring userPW = '') :=
  856. lib_fileservices.FileServices.GetEspURL(username, userPW);
  857. /**
  858. * Returns the path to the default Drop Zone
  859. *
  860. *
  861. * @return A string containing the path to the default Drop Zone.
  862. * If more than one Drop Zone
  863. * process is defined then the first found will
  864. * be returned; will return an empty string if a Drop Zone
  865. * cannot be found
  866. */
  867. EXPORT varstring GetDefaultDropZone() :=
  868. lib_fileservices.FileServices.GetDefaultDropZone();
  869. /**
  870. * Returns a dataset with full paths to all Drop Zones
  871. *
  872. *
  873. * @return A dataset containing all defined Drop Zone paths.
  874. * Will return an empty dataset if a Drop Zone
  875. * cannot be found
  876. */
  877. EXPORT dataset(FsDropZoneRecord) GetDropZones() :=
  878. lib_fileservices.FileServices.GetDropZones();
  879. END;