# `Feline.Processor`
[🔗](https://github.com/dimamik/feline/blob/main/lib/feline/processor.ex#L1)

Behaviour for pipeline processors.

Each processor implements callbacks to receive frames, transform them,
and push results downstream or upstream. Use `use Feline.Processor` to
adopt the behaviour and generate a `child_spec/1` that wraps the module
in a `Feline.Processor.Server` GenServer.

## Callbacks

  * `init/1` — initialize processor state from keyword options
  * `handle_frame/4` — process a frame, return `{:ok, state}`,
    `{:push, frame, direction, state}`, or `{:push_many, frames, state}`
  * `handle_info/3` — handle non-frame messages (optional)
  * `handle_setup/2` — called once after pipeline linking (optional)
  * `handle_cleanup/1` — called on processor shutdown (optional)

# `direction`

```elixir
@type direction() :: :downstream | :upstream
```

# `push_fn`

```elixir
@type push_fn() :: (struct(), direction() -&gt; :ok)
```

# `state`

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

# `handle_cleanup`
*optional* 

```elixir
@callback handle_cleanup(state()) :: :ok
```

# `handle_frame`

```elixir
@callback handle_frame(frame :: struct(), direction(), push_fn(), state()) ::
  {:ok, state()}
  | {:push, struct(), direction(), state()}
  | {:push_many, [{struct(), direction()}], state()}
```

# `handle_info`
*optional* 

```elixir
@callback handle_info(msg :: term(), push_fn(), state()) :: {:ok, state()}
```

# `handle_setup`
*optional* 

```elixir
@callback handle_setup(setup :: map(), state()) :: {:ok, state()}
```

# `init`

```elixir
@callback init(opts :: keyword()) :: {:ok, state()}
```

# `link`

# `queue_frame`

# `setup`

---

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