NebulaAPI.AST.Builder (NebulaAPI v0.5.0)

Copy Markdown View Source

AST builder for NebulaAPI functions.

For each defapi, generates:

  • __nbapi_local_<name> - Private function with the actual implementation — only on nodes where the method is local (no stub on the others: the router never references it there)
  • __nbapi_remote_<name> - Private function that calls the remote method (every node)
  • <name> - Public router function that delegates to local or remote based on context

Summary

Functions

Builds the local implementation function. Only generated when is_local is true — on remote nodes the router's default branch goes remote (see build_public_function/2), nothing references a local implementation, so none is emitted.

Builds the public router function. This function decides whether to call the local or remote implementation based on the call context (unicast/multicast selector or default behavior).

Builds the remote call function. This is always generated and calls the remote method via APIServer.

Functions

build_local_function(map, fn_do, is_local)

Builds the local implementation function. Only generated when is_local is true — on remote nodes the router's default branch goes remote (see build_public_function/2), nothing references a local implementation, so none is emitted.

build_public_function(map, is_local)

Builds the public router function. This function decides whether to call the local or remote implementation based on the call context (unicast/multicast selector or default behavior).

build_remote_function(map, serving_nodes)

Builds the remote call function. This is always generated and calls the remote method via APIServer.