Current section

Files

Jump to
distribute src distribute.erl
Raw

src/distribute.erl

-module(distribute).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/distribute.gleam").
-export([version/0, start/2, connect/1, nodes/0, self_node/0, ping/1, new_subject/2, start_actor/3, send/2, 'receive'/2, register/2, lookup/1, unregister/1]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" Facade for common distributed operations: start a node, register\n"
" actors, send messages, look things up.\n"
).
-file("src/distribute.gleam", 12).
-spec version() -> binary().
version() ->
<<"3.0.0"/utf8>>.
-file("src/distribute.gleam", 18).
-spec start(binary(), binary()) -> {ok, nil} |
{error, distribute@cluster:start_error()}.
start(Name, Cookie) ->
distribute@cluster:start_node(Name, Cookie).
-file("src/distribute.gleam", 22).
-spec connect(binary()) -> {ok, nil} |
{error, distribute@cluster:connect_error()}.
connect(Node) ->
distribute@cluster:connect(Node).
-file("src/distribute.gleam", 26).
-spec nodes() -> list(binary()).
nodes() ->
distribute@cluster:nodes().
-file("src/distribute.gleam", 30).
-spec self_node() -> binary().
self_node() ->
distribute@cluster:self_node().
-file("src/distribute.gleam", 34).
-spec ping(binary()) -> boolean().
ping(Node) ->
distribute@cluster:ping(Node).
-file("src/distribute.gleam", 40).
-spec new_subject(
fun((GWS) -> {ok, bitstring()} | {error, distribute@codec:encode_error()}),
fun((bitstring()) -> {ok, GWS} | {error, distribute@codec:decode_error()})
) -> distribute@global:global_subject(GWS).
new_subject(Encoder, Decoder) ->
distribute@global:new(Encoder, Decoder).
-file("src/distribute.gleam", 47).
-spec start_actor(
distribute@registry:typed_name(GWW),
GWY,
fun((GWW, GWY) -> distribute@receiver:next(GWY))
) -> {ok, distribute@global:global_subject(GWW)} |
{error, gleam@otp@actor:start_error()}.
start_actor(Typed_name, Initial_state, Handler) ->
distribute@actor:start(Typed_name, Initial_state, Handler).
-file("src/distribute.gleam", 55).
-spec send(distribute@global:global_subject(GXD), GXD) -> {ok, nil} |
{error, distribute@codec:encode_error()}.
send(Subject, Message) ->
distribute@global:send(Subject, Message).
-file("src/distribute.gleam", 62).
-spec 'receive'(distribute@global:global_subject(GXH), integer()) -> {ok, GXH} |
{error, distribute@codec:decode_error()}.
'receive'(Subject, Timeout_ms) ->
distribute@global:'receive'(Subject, Timeout_ms).
-file("src/distribute.gleam", 71).
-spec register(
distribute@registry:typed_name(GXL),
distribute@global:global_subject(GXL)
) -> {ok, nil} | {error, distribute@registry:register_error()}.
register(Typed_name, Subject) ->
distribute@registry:register_global(Typed_name, Subject).
-file("src/distribute.gleam", 78).
-spec lookup(distribute@registry:typed_name(GXQ)) -> {ok,
distribute@global:global_subject(GXQ)} |
{error, nil}.
lookup(Typed_name) ->
distribute@registry:lookup(Typed_name).
-file("src/distribute.gleam", 84).
-spec unregister(binary()) -> {ok, nil} |
{error, distribute@registry:register_error()}.
unregister(Name) ->
distribute@registry:unregister(Name).