Search documentation of macula

# macula_stream_local (macula v4.4.9)

View Source

Local registry + dispatcher for streaming RPC.

LOCAL streaming only — the client-side and server-side `macula_stream` processes both live in the same BEAM and are paired with `macula_stream:pair/2`. This module is the registry that lets `call_stream` find a locally-advertised handler for a given procedure name.

Cross-node streaming travels through `macula_station_link` (V2 pool); the public SDK surface in `macula.erl` is identical between the LOCAL and pool paths — only the entry point arity differs (`call_stream/3` vs `call_stream/5`).

# Summary

## Types

handler/0
mode/0

## Functions

advertise(Procedure, Handler)

Advertise a streaming procedure (default mode: server_stream).

advertise(Procedure, Mode, Handler)
call_stream(Procedure, Args, Opts)

Open a server-stream call. Returns the client-side stream pid. The caller drains chunks with macula_stream:recv/2.

handle_call(Msg, From, State)
handle_cast(Msg, State)
handle_info(Msg, State)
init(_)
list_advertised()
open_stream(Procedure, Args, Opts)

Open a client-stream or bidi call. Returns the client-side stream pid; caller writes with macula_stream:send/2,3 and reads the terminal value with macula_stream:await_reply/1,2.

start_link()
terminate(Reason, State)
unadvertise(Procedure)

# Types

# handler/0

    -type handler() :: fun((Stream :: pid(), Args :: term()) -> any()).

# mode/0

    -type mode() :: macula_stream:mode().

# Functions

# advertise(Procedure, Handler)

    -spec advertise(binary(), handler()) -> ok | {error, term()}.

Advertise a streaming procedure (default mode: server_stream).

# advertise(Procedure, Mode, Handler)

    -spec advertise(binary(), mode(), handler()) -> ok | {error, term()}.

# call_stream(Procedure, Args, Opts)

    -spec call_stream(binary(), term(), map()) -> {ok, pid()} | {error, term()}.

Open a server-stream call. Returns the client-side stream pid. The caller drains chunks with macula_stream:recv/2.

# handle_call(Msg, From, State)

# handle_cast(Msg, State)

# handle_info(Msg, State)

# init(_)

# list_advertised()

    -spec list_advertised() -> [{binary(), mode()}].

# open_stream(Procedure, Args, Opts)

    -spec open_stream(binary(), term(), map()) -> {ok, pid()} | {error, term()}.

Open a client-stream or bidi call. Returns the client-side stream pid; caller writes with macula_stream:send/2,3 and reads the terminal value with macula_stream:await_reply/1,2.

# start_link()

    -spec start_link() -> {ok, pid()} | {error, term()}.

# terminate(Reason, State)

# unadvertise(Procedure)

    -spec unadvertise(binary()) -> ok.