# `Malla.Service.Interface`
[🔗](https://github.com/netkubes/malla/blob/v0.1.0/lib/malla/service/interface.ex#L21)

Behaviour defining the public interface for Malla services.

Any module using `Malla.Service` will implement this behaviour,
providing the standard API functions for starting, stopping,
configuring, and querying the service readily available inserted
in service module.

Since they live in the service module, the service ID is already known
(it is the module itself), so you don't need to provide it.

You cannot override these functions, they are included here only for
documentation purposes. Use the mechanism detailed in `Malla.Service`
and `Malla.Plugin` to use Malla's plugin system.

# `child_spec`

```elixir
@callback child_spec(start_opts :: keyword()) :: Supervisor.child_spec()
```

Provides a standard supervisor spec to start the Service.

Restart will be _transient_ so supervisor will not restart it if we stop it with `c:stop/0`.
Shutdown will be _infinity_ to allow plugins to stop.

# `get_config`

```elixir
@callback get_config() :: keyword() | :unknown
```

Gets the current service configuration, or `:unknown` if not started.

# `get_status`

```elixir
@callback get_status() :: Malla.Service.running_status() | :unknown
```

Gets the current running status of the service, or `:unknown` if not started.

# `reconfigure`

```elixir
@callback reconfigure(config :: keyword()) :: :ok | {:error, term()}
```

Reconfigures the service in real time. See `Malla.Service.reconfigure/2`.

# `set_admin_status`

```elixir
@callback set_admin_status(
  status :: :active | :pause | :inactive,
  reason :: atom()
) :: :ok | {:error, term()}
```

Changes service running status. See `Malla.Service.set_admin_status/3`.

# `start_link`

```elixir
@callback start_link() :: {:ok, pid()} | {:error, term()}
```

Starts the service. See `Malla.Service.start_link/2`.

# `start_link`

```elixir
@callback start_link(start_opts :: keyword()) :: {:ok, pid()} | {:error, term()}
```

Starts the service. See `Malla.Service.start_link/2`.

# `stop`

```elixir
@callback stop() :: :ok | {:error, term()}
```

Stops the service. See `Malla.Service.stop/1`.

---

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