What a join reply says about the parent's wallet.
The node sends an object rather than a bare list precisely so that :unread
has a value of its own. When it was a list, an unreadable wallet arrived as
[] — the same value that means "read, and it grants nothing" — and that is
the reassuring one of the two: a client acting on it sends its messages bare
and gets back a denial naming a grant.
Summary
Functions
A join reply's delegated_credentials.revision, or 0 when an older node
sent none.
A join reply's delegated_credentials, or nil if it is not a reading.
A pushed delegated_credentials event as {:ok, reading, revision}, or
:error if it is not one to apply.
The capability a node announces when it pushes a replacement reading to a
live borrowed child whose join asked for it with delegation_refresh: true.
Functions
@spec join_revision(term()) :: non_neg_integer()
A join reply's delegated_credentials.revision, or 0 when an older node
sent none.
@spec parse(term()) :: Layr8.Delegated.Reading.t() | nil
A join reply's delegated_credentials, or nil if it is not a reading.
Anything that is not a well-formed reading — absent, a list (an older node,
before status existed), a status this build does not know — is nil, which
means "no reading". It is never coerced into
%Reading{status: :complete, credentials: []}: that would state that a wallet
was read and grants nothing, which is the one thing none of those inputs says.
@spec parse_push(term()) :: {:ok, Layr8.Delegated.Reading.t(), non_neg_integer()} | :error
A pushed delegated_credentials event as {:ok, reading, revision}, or
:error if it is not one to apply.
The payload is the join reply's reading plus revision, so it goes through
parse/1. On top of that:
revisionmust be a non-negative integer. Without it a consumer cannot tell a late push from a new one.status: "unread"is never pushed by the node: a refresh whose read failed sends nothing, and the last reading stands. A push that saysunreadanyway is dropped rather than applied, because applying it would replace a set that came from a real read with an[]that measures nothing, and take working authority away.
@spec refresh_capability() :: String.t()
The capability a node announces when it pushes a replacement reading to a
live borrowed child whose join asked for it with delegation_refresh: true.