Karta.Servers (Karta v1.0.0)

Mail servers.

Suspension (suspend/2, resume/1) is an instance administrator's action. While a server is suspended its credentials are refused (the APIs answer server_suspended, SMTP refuses MAIL FROM), and the mail it had already accepted waits: its delivery jobs make no attempt and look again every minute (Karta.Outbound.Deliverer). Nothing is dropped or bounced; once the server is resumed, delivery carries on where it stopped. The retry period of each recipient keeps running meanwhile.

Creating, changing, suspending or resuming a server is announced on its organisation's topic (:servers) and on its own (:server), see Karta.Changes.

Summary

Functions

A server of the organisation, or nil.

Every server, by organisation and name, with its organisation: for the instance's own pages (Karta.IPPools), never for a page of one organisation.

The organisation's servers, by name.

The id of the organisation a server belongs to.

Lifts a suspension: credentials work again and queued mail is delivered.

Suspends a server, for reason (required, at most 255 characters; the organisation sees it). Suspending a suspended server changes only the reason.

Functions

create_server(organisation, attrs)

get_server(organisation, id)

@spec get_server(Karta.Accounts.Organisation.t(), term()) ::
  Karta.Servers.Server.t() | nil

A server of the organisation, or nil.

list_all()

@spec list_all() :: [Karta.Servers.Server.t()]

Every server, by organisation and name, with its organisation: for the instance's own pages (Karta.IPPools), never for a page of one organisation.

list_servers(organisation)

The organisation's servers, by name.

organisation_id(server_id)

@spec organisation_id(Karta.Servers.Server.t() | Ecto.UUID.t()) :: Ecto.UUID.t()

The id of the organisation a server belongs to.

resume(server)

@spec resume(Karta.Servers.Server.t()) :: {:ok, Karta.Servers.Server.t()}

Lifts a suspension: credentials work again and queued mail is delivered.

suspend(server, reason)

@spec suspend(Karta.Servers.Server.t(), String.t() | nil) ::
  {:ok, Karta.Servers.Server.t()} | {:error, Ecto.Changeset.t()}

Suspends a server, for reason (required, at most 255 characters; the organisation sees it). Suspending a suspended server changes only the reason.

update_server(server, attrs)