C · Errors

Errors

#include <ucall/types.h> 1.0.0-rc.1 · 60202332

API

Types

ucall_status_tLibrary-level outcomes, preserving USearch numbers for shared statuses.
types.h:252 ↗
enum ucall_status_t

These codes represent library/transport-level outcomes. For HTTP-specific status codes (200, 404, 500), use ucall_http_status_t.

Statuses fall into five categories. Resources: out of memory, I/O, and connections that failed or closed. Input: invalid arguments, malformed bytes, failed handshakes and rejected peers. State: uninitialized handles, unsupported features, names not found or already existing, overflow and contention. Interruptions: deferral, would-block and timeouts. Defects: internal failures. Any verb that allocates, binds a device or touches a file or a socket may also return a Resources status. A verb's own block lists only what its contract adds.

Values

ucall_status_success_k0The call succeeded; the outcome message is NULL.
ucall_status_deferred_k1A submitted call has not finished; the only status that is never final.
ucall_status_out_of_memory_k2An allocation or reservation could not be satisfied.
ucall_status_io_k7A socket or file could not be opened, read, written, or closed.
ucall_status_malformed_k9The peer supplied bytes that cannot be decoded as the expected protocol.
ucall_status_internal_k10The engine violated its contract, which points at a defect.
ucall_status_overflow_k11The requested size exceeds the representable range.
ucall_status_uninitialized_k12The call needs a handle that was never initialized.
ucall_status_contended_k14The call was refused rather than waited for, such as submission to a full deferred table.
ucall_status_unsupported_k16The build, backend, or machine does not implement the requested feature.
ucall_status_invalid_argument_k17An argument is null, out of range, or contradicts another argument.
ucall_status_not_found_k18The requested endpoint, header, or parameter does not exist.
ucall_status_already_exists_k19An endpoint with the same template and method is already registered.
ucall_status_connection_failed_k20DNS lookup or connection establishment failed.
ucall_status_connection_closed_k21The connection closed before the exchange completed.
ucall_status_timeout_k22The operation exceeded its time budget.
ucall_status_handshake_failed_k23The Noise handshake failed to authenticate or agree on keys.
ucall_status_peer_rejected_k24The peer authorizer declined the authenticated static key.
ucall_status_would_block_k25A nonblocking poll had no progress to report.

Spellings

char const * ucall_status_name(ucall_status_t status);
ucall_status_t ucall_status_from_name(ucall_bytes_view_t name);
ucall_outcome_tOutcome of one call: a status to branch on, and a static message with the detail it cannot carry.
types.h:333 ↗
struct ucall_outcome_t

The message has static storage, is never freed, and is NULL exactly when the status is ucall_status_success_k. Every verb struct points at one.

Fields

statusucall_status_tThe final status, or ucall_status_deferred_k while a submitted call is unfinished.
messagechar const *Static detail, never freed; NULL exactly on success.

Functions

ucall_outcome_waitBlocks until outcome is final, waiting on its status word through the CPU class's waiter, and with acquire ordering.
types.h:356 ↗
ucall_status_t ucall_outcome_wait(ucall_outcome_t *outcome);

Producers publish the final status with a release store on that word, which the waiter watches. Never wait from a callback that the call itself must finish before it can complete.

Parameters

outcomeinAn outcome passed to a call, read until its status leaves ucall_status_deferred_k.

Returns

The final status.

Notes

Thread-safe. Any number of threads may wait on one outcome.

ucall_outcome_statusReads the outcome without waiting, with acquire ordering, so a final status publishes every output.
types.h:370 ↗
ucall_status_t ucall_outcome_status(ucall_outcome_t *outcome);

Poll through this function; directly reading the field during a deferred call is not an atomic load.

Parameters

outcomeinAn outcome passed to a call.

Returns

The final status once the call is final.

Statuses