# `MingaEditor.EffectScheduler.Lane`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/effect_scheduler/lane.ex#L1)

Pure scheduling transitions for one effect resource lane.

# `action`

```elixir
@type action() ::
  {:start, MingaEditor.Effect.Request.t()}
  | {:stop, MingaEditor.Effect.Request.t()}
  | {:candidate, MingaEditor.Effect.Request.t(), {:canceled, cancel_reason()}}
  | {:terminal, MingaEditor.Effect.Request.t(), {:canceled, cancel_reason()}}
  | {:terminal, MingaEditor.Effect.Request.t(), {:stale, cancel_reason()}}
  | {:queue,
     [{MingaEditor.Effect.Request.t(), pos_integer(), non_neg_integer()}]}
```

# `admission`

```elixir
@type admission() ::
  {:ok, MingaEditor.Effect.Request.id(), :running | :queued}
  | {:error, admission_error()}
```

# `admission_error`

```elixir
@type admission_error() :: :policy_mismatch | :queue_full | :scheduler_full
```

# `cancel_reason`

```elixir
@type cancel_reason() :: term()
```

# `t`

```elixir
@type t() :: %MingaEditor.EffectScheduler.Lane{
  policy: MingaEditor.Effect.Policy.t(),
  queue: :queue.queue(MingaEditor.Effect.Request.t()),
  running: MingaEditor.Effect.Request.t() | nil
}
```

# `active?`

```elixir
@spec active?(t(), (MingaEditor.Effect.Request.t() -&gt; boolean())) :: boolean()
```

Returns true when a running or queued request matches.

# `admit`

```elixir
@spec admit(t() | nil, MingaEditor.Effect.Request.t(), boolean()) ::
  {admission(), t() | nil, [action()]}
```

Admits a request into a lane without performing effects.

# `cancel_matching`

```elixir
@spec cancel_matching(t(), (MingaEditor.Effect.Request.t() -&gt; boolean()), term()) ::
  {t(), [action()], boolean()}
```

Cancels all matching requests in this lane.

# `cancel_request`

```elixir
@spec cancel_request(t(), MingaEditor.Effect.Request.id()) ::
  {:ok, t(), [action()]} | :not_found
```

Cancels one request by id. Running work remains current until its candidate is finalized.

# `finalize_current`

```elixir
@spec finalize_current(t(), MingaEditor.Effect.Request.t()) ::
  {:empty, [action()]} | {t(), [action()]}
```

Releases the matching current request without promoting queued work.

# `finish_current`

```elixir
@spec finish_current(t()) :: {:empty, [action()]} | {t(), [action()]}
```

Promotes the next queued request when a lane has no current request.

# `new`

```elixir
@spec new(MingaEditor.Effect.Policy.t()) :: t()
```

Builds an empty resource lane for a stable policy.

# `request_id_for_operation`

```elixir
@spec request_id_for_operation(t(), MingaEditor.State.Operation.id()) ::
  MingaEditor.Effect.Request.id() | nil
```

Finds the request id for a semantic operation id.

---

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