Where a host keeps its licence. The gate reads and writes it only through this behaviour, so the library takes no database dependency.
A record is any map or struct with :envelope (the licence file's
bytes), :licence_id, :serial, :term_end and :last_seen_at.
store/3's attributes add :customer_name, :seats, :features and
:term_start.
The actor passes from the host's call to store/3 untouched; the gate
never reads it. A renewal stores as :system. The store decides who may
write, and answers {:error, :forbidden} to anyone else.
Each callback gets the opts of the gate's store: {module, opts}.
Summary
Callbacks
The newest licence by serial, nil when none is stored.
Stores a licence that passed every check.
Moves the latest time seen on record.
Types
@type record() :: map()
Callbacks
The newest licence by serial, nil when none is stored.
@callback store(attrs :: map(), actor :: term(), opts :: keyword()) :: {:ok, record()} | {:error, :forbidden} | {:error, :not_stored}
Stores a licence that passed every check.
@callback touch(record(), last_seen_at :: DateTime.t(), opts :: keyword()) :: {:ok, record()} | {:error, term()}
Moves the latest time seen on record.