hecate_om_capabilities (hecate_om v0.11.0)

View Source

Advertises a service's capabilities as signed procedure advertisements in the mesh DHT, and resolves other services' capabilities from the same DHT.

Replaces the former pubsub _mesh.cap.announce summary broadcast: discovery is record-based now (direct-dial discovery, plan Slice 2). For each capability the service exposes, this worker writes a signed procedure_advertisement keyed at SHA-256(procedure_uri), naming the service (advertiser) and one station it is reachable through (serving_station). Records are re-asserted on a timer because DHT records expire (and the timer also retries the initial write until the pool and a station link are up).

lookup/1 resolves a capability by name: derive the same procedure key, read every advertisement stored there, verify each signature, return the {advertiser, serving_station} set. A consumer then dials one of those stations (Slice 4+).

Signing needs the service's stable keypair (hecate_om_identity:keypair/0); an ephemeral service cannot sign and is correctly not advertised.

Summary

Functions

Resolve a capability by name to the providers advertising it. {ok, [#{advertiser := Pubkey, serving_station := Pubkey}]}. Empty when nothing is advertised or the mesh is unreachable.

Functions

build_advertisement(KeyPair, Realm, _, Station)

-spec build_advertisement(macula_identity:key_pair(),
                          binary(),
                          hecate_om_service:capability(),
                          macula_identity:pubkey()) ->
                             map().

decode_resolved(Records)

-spec decode_resolved([map()]) -> [map()].

handle_call(Msg, From, S)

handle_cast(Msg, S)

handle_info(Other, State)

init(_)

list()

lookup(CapName)

-spec lookup(binary()) -> {ok, [map()]}.

Resolve a capability by name to the providers advertising it. {ok, [#{advertiser := Pubkey, serving_station := Pubkey}]}. Empty when nothing is advertised or the mesh is unreachable.

procedure_uri(Realm, Name)

-spec procedure_uri(binary(), binary() | map()) -> binary().

publish()

register(Caps)

start_link()

terminate(_, _)