Karta.IPPools.WarmupPlan (Karta v1.0.0)

A warm-up plan: how many recipients a new sending address (Karta.IPPools.IPAddress) may be sent to on each day of its warm-up, while receiving servers learn its reputation.

daily_limits are the limits of the first days, in order: the first is that of the day the address's warm-up starts (its warmup_started_on), the second that of the next day, and so on, days being UTC days (at most 365 of them, each limit at least 1). After the last day the address is warmed up and has no limit; before the first it is not used (limit/3). ramp/3 makes a list that grows by a factor each day.

A plan can be changed at any time; the addresses under it follow the new limits from then on.

Summary

Functions

A new or changed plan: name (unique) and daily_limits.

Deleting a plan: refused while addresses warm up under it.

The limit on date of an address whose warm-up under plan started on started_on: 0 before that day, the day's limit during the plan, nil (no limit) after its last day.

Daily limits that start at first and grow by factor a day (rounded, and by at least 1) up to last, which is the last day's: ramp(50, 2, 1_000) is [50, 100, 200, 400, 800, 1000].

Types

t()

@type t() :: %Karta.IPPools.WarmupPlan{
  __meta__: term(),
  addresses: term(),
  daily_limits: term(),
  id: term(),
  inserted_at: term(),
  name: term(),
  updated_at: term()
}

Functions

changeset(plan, attrs)

A new or changed plan: name (unique) and daily_limits.

delete_changeset(plan)

Deleting a plan: refused while addresses warm up under it.

limit(warmup_plan, started_on, date)

@spec limit(t(), Date.t(), Date.t()) :: non_neg_integer() | nil

The limit on date of an address whose warm-up under plan started on started_on: 0 before that day, the day's limit during the plan, nil (no limit) after its last day.

ramp(first, factor, last)

@spec ramp(pos_integer(), number(), pos_integer()) :: [pos_integer()]

Daily limits that start at first and grow by factor a day (rounded, and by at least 1) up to last, which is the last day's: ramp(50, 2, 1_000) is [50, 100, 200, 400, 800, 1000].