# `Cauldron2D.Ledger.Lock`
[🔗](https://github.com/jaman/cauldron/blob/v0.2.2/cauldron_2d/lib/cauldron_2d/ledger/lock.ex#L1)

The lock that keeps a ledger file to one operating system process: `<path>.lock`,
holding the process id of the holder. A lock whose process is gone counts as free; a
file a DETS table of this process already has open is held.

# `holder`

```elixir
@spec holder(Path.t()) :: pos_integer() | nil
```

The operating system process holding the file's lock, or nil.

# `release`

```elixir
@spec release(Path.t()) :: :ok
```

Give the file's lock up, when this process holds it.

# `take`

```elixir
@spec take(Path.t()) :: :ok | {:error, {:held, pos_integer()}}
```

Take the file's lock for this process: `:ok`, or `{:error, {:held, pid}}` when another live process holds it.

---

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