mcl_core_transport behaviour (mcl_core v1.0.0)
View SourceThe transport boundary (docs/DESIGN.md §1.2).
The contract side of mcl_core names WHAT a service does on the wire -- call a capability, publish a fact -- and a transport says HOW. This module is the seam between the two: a transport implements the two callbacks below, and the contract reaches the wire only through call_capability/5 and publish/3 here.
TWO TRANSPORTS, IN ORDER (transports/0): the LAN (mcl_core_lan, src/lan/, design §2) first, then the macula mesh bridge (mcl_core_bridge, src/bridge/). A call or a publish goes to the bridge only when the LAN has nobody to take it -- {error, no_lan_provider} or {error, no_lan_subscriber} -- which is every call and publish on a node whose lan app env is off, the default: such a node behaves as mcl_om 1.9.0 did. A LAN member that was reached answers for itself, failure included.
Summary
Functions
Call CapName in Org: on the LAN, else through the bridge. See mcl_core:call_capability/5 for the options and the answers.
Publish Payload on Topic: to the LAN's subscribers, else through the bridge. See mcl_core_pubsub:publish/3 for the options.
The transports the contract uses, in the order it tries them.
Callbacks
Functions
-spec call_capability(binary(), binary(), term(), pos_integer(), map()) -> {ok, term()} | {error, term()}.
Call CapName in Org: on the LAN, else through the bridge. See mcl_core:call_capability/5 for the options and the answers.
Publish Payload on Topic: to the LAN's subscribers, else through the bridge. See mcl_core_pubsub:publish/3 for the options.
-spec transports() -> [module()].
The transports the contract uses, in the order it tries them.