# `Jidoka.Session.Lease`
[🔗](https://github.com/agentjido/jidoka/blob/v0.9.0/lib/jidoka/session/lease.ex#L1)

Durable ownership token for one active session continuation.

A store grants one lease at a time. Every durable checkpoint and final commit
must present the same lease id. An expired lease can be replaced by recovery.

# `t`

```elixir
@type t() :: %Jidoka.Session.Lease{
  acquired_at_ms: integer(),
  expires_at_ms: integer(),
  lease_id: binary(),
  owner_id: binary(),
  request_id: binary()
}
```

# `acquire`

```elixir
@spec acquire(String.t(), non_neg_integer(), pos_integer(), keyword()) ::
  {:ok, t()} | {:error, term()}
```

Builds a new lease for one request.

# `expired?`

```elixir
@spec expired?(t(), non_neg_integer()) :: boolean()
```

Returns true when the lease has reached its expiry time.

# `new`

```elixir
@spec new(keyword() | map()) :: {:ok, t()} | {:error, term()}
```

Builds a session lease from keyword or map attributes.

# `renew`

```elixir
@spec renew(t(), non_neg_integer(), pos_integer()) :: t()
```

Extends a lease from the given wall-clock time.

# `schema`

```elixir
@spec schema() :: Zoi.schema()
```

Returns the Zoi schema for a session lease.

---

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