# `H.StoreLock`
[🔗](https://github.com/parlant/harness/blob/v0.3.0/lib/h/store_lock.ex#L1)

OS-level single-daemon ownership lock for `data_dir`.

Uses a short-lived `.claim` spin directory to serialize lock acquisition,
then binds a Unix domain socket under `/tmp` (kept within macOS `sun_path`
limits) and writes `<data_dir>/lock.json`. Surviving a `SIGKILL` of a prior
daemon triggers `:econnrefused` on the stale socket probe, allowing immediate
takeover without manual cleanup.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `socket_path`

```elixir
@spec socket_path(String.t()) :: String.t()
```

Computes the deterministic Unix domain socket path (`<= 100` bytes) for `data_dir`.

# `start_link`

```elixir
@spec start_link(keyword()) :: GenServer.on_start()
```

Starts the store lock process for `:data_dir`.

Returns `{:error, :store_locked}` if another live OS process holds the lock.
Accepts an optional `:name` to register the `GenServer`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
