barrel_p2p_streams (barrel_p2p v0.1.0)

View Source

Summary

Functions

List currently registered tags and their handlers.

Open a tagged stream to Node. The calling process becomes the stream owner; quic_dist:send/2,3, quic_dist:close_stream/1, and the native {quic_dist_stream, _, _} events all apply.

Register Pid as the handler for incoming streams tagged Tag. After registration the handler receives: {mstream, StreamRef, opened, FromNode} followed by the native quic_dist events: {quic_dist_stream, StreamRef, {data, Data, Fin}} {quic_dist_stream, StreamRef, closed} {quic_dist_stream, StreamRef, {stream_reset, Code}} The handler can use quic_dist:send/2,3 and quic_dist:close_stream/1 on StreamRef.

Remove the handler registered for Tag.

Functions

handle_call(Msg, From, S)

handle_cast(Msg, S)

handle_info(Msg, S)

init(_)

list_acceptors()

-spec list_acceptors() -> [{binary(), pid()}].

List currently registered tags and their handlers.

open(Tag, Node)

-spec open(binary(), node()) -> {ok, quic_dist:stream_ref()} | {error, term()}.

Open a tagged stream to Node. The calling process becomes the stream owner; quic_dist:send/2,3, quic_dist:close_stream/1, and the native {quic_dist_stream, _, _} events all apply.

The tag preamble is written before this call returns so the peer's barrel_p2p_streams demuxer can dispatch the stream as soon as the first chunk arrives.

register_acceptor(Tag, Pid)

-spec register_acceptor(binary(), pid()) -> ok | {error, conflict}.

Register Pid as the handler for incoming streams tagged Tag. After registration the handler receives: {mstream, StreamRef, opened, FromNode} followed by the native quic_dist events: {quic_dist_stream, StreamRef, {data, Data, Fin}} {quic_dist_stream, StreamRef, closed} {quic_dist_stream, StreamRef, {stream_reset, Code}} The handler can use quic_dist:send/2,3 and quic_dist:close_stream/1 on StreamRef.

start_link()

terminate(Reason, S)

unregister_acceptor(Tag)

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

Remove the handler registered for Tag.