filed
Job queue using FUSE
git clone git://mccd.space/filed
| Log | Files | Refs | README | LICENSE |
commit dad5f8415e5ab7912e774f73844e0760d3a07bfa parent c783693c6b340a534aded9167a4ee1a70ec32c53 Author: Marc Coquand <marc@coquand.email> Date: Sat, 13 Dec 2025 19:55:56 +0100 * Diffstat:
| M | README.md | | | 14 | ++++++++++++++ |
| M | main.go | | | 9 | ++++----- |
| A | tbd.1.scd | | | 28 | ++++++++++++++++++++++++++++ |
3 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
@@ -11,3 +11,17 @@ Other features are enabled by using built-in Unix features:
- Periodic jobs using cron
- Access rights using unix users
+
+## Installation
+
+`tbd` is built in Go.
+
+```
+git clone https://sr.ht/~marcc/tbd/
+cd tbd
+go build
+```
+
+## Usage
+
+
diff --git a/main.go b/main.go
@@ -33,7 +33,7 @@ func main() {
mountpoint := flag.Arg(0)
dbPath := flag.Arg(1)
if err := Unmount(mountpoint); err != nil {
- slog.Debug("FUSE: Pre-start unmount failed (this is usually okay)", "error", err)
+ slog.Info("FUSE: Pre-start unmount failed (this is usually okay)", "error", err)
}
store, err := store.NewStore(dbPath)
@@ -161,7 +161,7 @@ func (f File) ReadAll(ctx context.Context) ([]byte, error) {
return []byte(f.content), nil
}
-// Before adding to the database. Lives in memory until the file is closed.
+// Used before adding to the database. Lives in memory until the file is closed.
type JobCreationFile struct {
id string
store *store.Store
@@ -189,12 +189,11 @@ func (f *JobCreationFile) Write(ctx context.Context, req *fuse.WriteRequest, res
func (f *JobCreationFile) Release(ctx context.Context, req *fuse.ReleaseRequest) error {
command := f.buf.String()
- slog.Info("Committing new job", "id", f.id, "command", command)
+ slog.Info("New job", "id", f.id, "command", command)
_, err := f.store.CreateJob(f.id, command)
if err != nil {
- slog.Error("Failed to create job", "error", err)
- slog.Info("Each job has to have a unique id.")
+ slog.Error("Failed to create job. Is the job name unique? I.E. no pending/completed/failed jobs with same name", "error", err)
return syscall.EIO
}
return nil
diff --git a/tbd.1.scd b/tbd.1.scd
@@ -0,0 +1,28 @@
+tbd(1)
+
+# NAME
+
+tbd - Simple job queue
+
+# SYNOPSIS
+
+*tbd* _MOUNTPOINT_ _DBPATH_
+
+# DESCRIPTION
+
+tbd is a simple job queue that operates using files by setting up a virtual
+file system on _MOUNTPOINT_.
+
+tbd exposes 4 directories: *pending*, *active*, *failed*, *completed*. Files
+in the directories correspond to jobs. To create a job, simply add it to *pending*.
+See examples.
+
+# EXAMPLES
+
+Create a new job with $JOBID that calculates 1+1:
+
+ $ JOBID="Big Number $(head -c4 /dev/urandom | base64)"
+ $ echo "echo 1+1 | bc -s" >> "/var/tbd/pending/$JOBID"
+
+Periodic jobs can be set up using _CRON(8)_.
+