No description
Find a file
2026-04-13 15:16:18 +02:00
queuelang add vm logic 2026-04-11 01:24:16 +02:00
go.mod update go mod version 2026-04-11 00:58:59 +02:00
LICENSE add license 2026-04-11 01:34:12 +02:00
README.md fix README title and urls 2026-04-13 15:16:18 +02:00

Qlango (queuelang-go)

Pure-Go library implementing a QueueLang "virtual machine".

No external dependencies. Designed to be embedded in higher-level systems that need a declarative, restartable, queue-oriented pipeline language, such as a Kubernetes operator.

Install

go get forge.heeboo.org/thunerbl/qlango

Usage

import "github.com/QueueLang/queuelang-go/queuelang"

vm, err := queuelang.NewVM(`
  ENQUEUE namespace:ensure  my-org
  ENQUEUE postgres:deploy   my-org-db
  ENQUEUE app:deploy        my-org my-org-db
  ENQUEUE health:check      https://my-org.example.com
`, 3 /* defaultMaxRetry */)

for !vm.Empty() {
    step, _ := vm.Dequeue()
    // step.Kind, step.Action, step.Args, step.Attempt, step.MaxRetry
    err := execute(step)
    if err != nil {
        if !vm.Roll(step) {
            // step exhausted its retries
            return err
        }
    }
}

Persisting queue state between process restarts

// Export before process exit / between reconcile calls:
snapshot := vm.Snapshot()  // []queuelang.SnapshotItem  — JSON-friendly

// Restore in the next process / reconcile call:
vm2, _ := queuelang.NewVM(src, defaultMaxRetry)
vm2.Restore(snapshot)      // resumes with correct attempt counters

QueueLang syntax

Instruction Effect
ENQUEUE kind:action [args…] Append a step to the back of the queue
ROLL kind:action [args…] Same as ENQUEUE but marks the step for at-least-one retry
DUP kind:action Duplicate the last enqueued step
MAXRETRY N Override retry limit for all subsequent steps
-- text Line comment

Test

go test ./...