Karta.Kantoor.Retention (Karta v1.0.0)

The retention policy of the Kantoor interface (contract 3a, 3c.4): what Kantoor asks Karta to do with a message's lifetime. Kantoor decides, Karta only enforces it (Karta.Messages.Retention).

  • :keep - never expires by age, and is exempt from the size cap (retention_size_mb); counted as kept storage (Karta.Kantoor.KeptStorage);
  • {:days, n} - expires n days after the message was received or sent, instead of the server's retention_days;
  • nil - no policy: the server's settings apply, exactly as without Kantoor.

In JSON a policy is "keep" or a whole number of days (1 to 36500); null or absent is no policy.

Stored as two nullable columns, retention_keep (true or NULL) and retention_days, on deliveries, routes and (outgoing) messages.

Summary

Functions

The columns that hold a policy.

The policy a row (a delivery, route or message) carries.

A policy from its JSON value: {:ok, policy} (nil for null), or :error.

A policy as JSON.

Types

t()

@type t() :: :keep | {:days, pos_integer()} | nil

Functions

columns(arg1)

@spec columns(t()) :: [
  retention_keep: boolean() | nil,
  retention_days: pos_integer() | nil
]

The columns that hold a policy.

from_row(arg1)

@spec from_row(map()) :: t()

The policy a row (a delivery, route or message) carries.

parse(days)

@spec parse(term()) :: {:ok, t()} | :error

A policy from its JSON value: {:ok, policy} (nil for null), or :error.

to_json(arg1)

@spec to_json(t()) :: String.t() | pos_integer() | nil

A policy as JSON.