Skip to content

v0.2.0 — Inherited-Lock PID File + API Redesign

Choose a tag to compare

@kolkov kolkov released this 12 Sep 09:40
· 15 commits to main since this release
5173f33

Breaking Changes

  • Stop() → Stop(ctx) — callers must pass context
  • Proxy(ctx, port, path) → Proxy(ctx, cfg, ProxyOptions) — testable I/O
  • SetHandler() deleted — dead code
  • IsAlive() based on pidlock (lock held = alive)

Architecture: Inherited-Lock PID File

PID file IS the lock. Correct by construction on all platforms.

  • Unix: flock + fd inheritance via ExtraFiles
  • Windows: share-mode + startup LockFileEx
  • Startup lock protocol: two locks, two purposes, correct ordering
  • N12 recovery: holder dies → next waiter becomes starter
  • LockCtx: ctx-aware locking with LOCK_NB poll

New Features

  • Sentinel errors (ErrNotRunning, ErrAlreadyRunning, etc.)
  • Config.Validate() — rejects invalid names, paths
  • POST /daemon/shutdown — cross-platform graceful stop
  • ProxyOptions — testable stdin/stdout, opt-in payload logging
  • CAS Disconnect, EINTR retry

Verified

  • 13 review rounds
  • 5 integration tests (helper-process pattern)
  • CI green on Linux + macOS + Windows
  • Coverage: 71.4% daemon, 86.2% internal, 75% pidlock