Expand description
Serverless writer-lease boot path (PLAN.md Phase 5 / W6).
Boot-time entrypoint that opts the runtime into lease-fenced writes when:
RED_LEASE_REQUIRED=true(or1) is set, and- a remote backend is configured (S3, FS, HTTP, …).
All transitions (acquire / refresh / lost / release) are
delegated to LeaseLifecycle; this module only owns env-var
parsing, lifecycle construction, and the refresh thread.
The refresh thread uses LeaseTimerWheel instead of a fixed
thread::sleep(ttl_ms / 3) polling loop. The wheel wakes the
thread exactly when the next refresh is due and reschedules after
each successful refresh, so idle leases cost zero CPU.
Env knobs:
RED_LEASE_REQUIRED—true/1to enable. Default off.RED_LEASE_TTL_SECS— lease TTL in seconds. Default 60.RED_LEASE_HOLDER_ID— explicit holder id. Default<hostname>-<pid>.RED_LEASE_PREFIX— backend prefix for the lease object key. Defaultleases/.
Functions§
- start_
lease_ loop_ if_ required - Try to start the writer-lease lifecycle if the operator opted in.
Returns
Ok(())when: