gitoriaLog in with ident

antcolony

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmain3a4d0324antcolony#37: a too-long report gets up to 3 fix tries, finished work is never thrown away for lengthmremain/plugins/fs/server.hl

2.8 KB

  1. file(String path) {
  2. return __native("fs.file", path)
  3. }
  4. readFile(String path) {
  5. return __native("fs.read_file", path)
  6. }
  7. listDir(String path) {
  8. return __native("fs.list_dir", path)
  9. }
  10. \* Does this path exist? (mission 077) The one call in hl:fs that cannot fail:
  11. it answers true/false, never an Error event — probing a path is a question,
  12. not an operation. Relative paths resolve against the SCRIPT's directory like
  13. every other hl:fs path. *\
  14. exists(String path) {
  15. return __native("fs.exists", path)
  16. }
  17. \* Watch a directory tree for changes (the dev-reload bell): an ordinary
  18. event-loop source — register it and every save arrives as an event.
  19. __native("eventloop.register", watch("."), "changed")
  20. on changed(ev) { … ev.name … }
  21. `exclude` (2026-08-30) names directories the descent must NOT enter — a
  22. path string, or a list of them. Omit it and the whole tree is watched, as
  23. it always was. The paths are compared RESOLVED (relative ones against the
  24. script's directory, like every hl:fs path) and normalised, so `./sessions`,
  25. `sessions` and `var/../sessions` are the same directory, and a sibling
  26. named `sessions-old` is NOT inside `sessions`.
  27. watch(".", "./sessions")
  28. watch(".", ["./sessions", "/var/cache/app"])
  29. A program that writes to a directory it also watches needs this: without
  30. it the only escape was that the walker skips dot-directories (which it
  31. still does — `.git` is the reason), i.e. renaming the directory. *\
  32. watch(String path, exclude) {
  33. return __native("fs.watch", path, exclude)
  34. }
  35. \* Write a whole file, ATOMICALLY (2026-08-28). Everything above this line
  36. reads; hl:fs could report a file's `chmod` and never set one, which is why
  37. nothing in this language could persist anything until now.
  38. The write goes to a sibling temp file, is fsynced, and is then renamed over
  39. the target — so a concurrent reader sees the whole OLD file or the whole NEW
  40. one, never a half of either. That matters more than it sounds: the first
  41. caller is the session store, and a truncated session file does not read as
  42. an error, it reads as a logged-out user.
  43. `mode` defaults to 0600 — a file this program wrote, for this program. Pass
  44. one to loosen it; nothing here consults the umask on your behalf. *\
  45. writeFile(String path, String contents, Number mode) {
  46. return __native("fs.write_file", path, contents, mode)
  47. }
  48. \* Make a directory and every missing parent. Already-there is SUCCESS: the
  49. caller wants the directory to exist, not to be the one who created it.
  50. `mode` defaults to 0700. *\
  51. mkDir(String path, Number mode) {
  52. return __native("fs.mk_dir", path, mode)
  53. }
  54. \* Delete a path. IDEMPOTENT: true when the path is gone on return, and a path
  55. that was already gone counts. A sweep must not fail because something else
  56. deleted the file first. *\
  57. remove(String path) {
  58. return __native("fs.remove", path)
  59. }

Branches

Latest commits

  • 3a4d0324antcolony#37: a too-long report gets up to 3 fix tries, finished work is never thrown away for lengthmre
  • a6af7883tracker: worker box sees calendar.worldapi.org (login to copy)mre
  • c613d26btemplates: bridges to external components (login.js for ident's selector) are allowed (creator 2026-09-27)mre
  • 9062978ctracker: worker box sees /media/STORAGE/projects/old-tracker read-only (tracker#2 source data)mre
  • 7f9660eeState of 2026-09-27, before the move to gitoriamre