distribute/messaging
Types
pub type SendError {
NameNotFound(String)
ProcessNotAlive
NetworkError(String)
InvalidMessage(String)
EncodeFailed(codec.EncodeError)
SendFailed(String)
}
Constructors
-
NameNotFound(String)The globally registered name was not found.
-
ProcessNotAliveThe target process is not alive.
-
NetworkError(String)Network connectivity issue.
-
InvalidMessage(String)Message is too large or invalid.
-
EncodeFailed(codec.EncodeError)Message encoding failed.
-
SendFailed(String)Sending the message failed for another reason.
Values
pub fn classify_send_error(
reason: String,
name: String,
) -> SendError
Classify error reason into structured SendError
pub fn classify_send_error_to_string(error: SendError) -> String
Convert SendError to string for logging
pub fn encode_error_to_send_error(
error: codec.EncodeError,
) -> SendError
Convert encode error to send error
pub fn is_network_error(reason: String) -> Bool
Check if error is network-related
pub fn send(pid: process.Pid, msg: a) -> Nil
Deprecated: Use send_typed with a Subject(BitArray) and codec for type-safe messaging.
Send a message to a process (local or remote).
This function bypasses all type checking and encoding validation.
pub fn send_batch(
messages: List(#(String, String)),
) -> BatchSendResult
Deprecated: Use send_batch_typed instead.
Send multiple messages in batch with error aggregation Returns detailed results including all errors encountered
pub fn send_batch_strict(
messages: List(#(String, String)),
) -> Result(Nil, SendError)
Send batch and return Ok only if all succeeded, Error with first failure otherwise
pub fn send_batch_typed(
messages: List(#(String, a)),
encoder: fn(a) -> Result(BitArray, codec.EncodeError),
) -> BatchSendResult
Send multiple typed messages in batch with error aggregation
pub fn send_global(
name: String,
msg: a,
) -> Result(Nil, SendError)
Deprecated: Use send_global_typed with a codec for type-safe messaging.
Send a message to a globally registered name. Returns Ok(Nil) if successful, Error if name not found or send failed.
This function bypasses all type checking and encoding validation.
pub fn send_global_typed(
name: String,
msg: a,
encoder: fn(a) -> Result(BitArray, codec.EncodeError),
) -> Result(Nil, SendError)
Send a typed message to a globally registered name. The message is encoded using the provided encoder before sending.
pub fn send_typed(
subject: process.Subject(BitArray),
msg: a,
encoder: fn(a) -> Result(BitArray, codec.EncodeError),
) -> Result(Nil, SendError)
Send a typed message to a subject. The message is encoded using the provided encoder and sent as binary data to ensure type safety.