weida

GitHub crates.io

weida's C ABI (`libweida`, against the Rust API of `crates/weida`) — feature parity

Rendered from docs/libraries/weida-c.md at 92c768a

Contents
  1. 1. What a row means
  2. 2. Runtime, listener and bindings
  3. 3. Req/Rep, streamed
  4. 4. Transfers and receipts
  5. 5. Values and metadata
  6. 6. Observability
  7. 7. Patterns
  8. 8. Interop evidence
  9. 9. Deliberate deviations and bounds
  10. 10. The definition of done
  11. 11. Sources

1. What a row means

The reference is not a foreign implementation: libweida binds weida itself, so the reference column is the Rust API of crates/weida, every item crates/weida/src/lib.rs re-exports, and every public method of the types this stage maps (decisions/0045). Each row has one of three verdicts:

  • present: the C function that maps it, by R1's names, and the test that proves it; a row an area's plan made present keeps that area's name after its evidence, as in present; abi::<test> (*drain*);
  • refused: deliberately not mapped, with the rule that refuses it;
  • absent: not mapped yet, with the follow-up area of 0045 §5 it belongs to.

There is no "partial": a type with some methods mapped has one row per method. The rules R1 to R13 are docs/c/README.md; the per-function contracts are the other pages of docs/c/. Measured on linux-amd64 (the CI image trixie), with clippy and the unit tier also on windows-amd64 and darwin-arm64.

The tests named below are crates/weida-c/tests/io/abi.rs (abi::<name>, the integration tier), the C program crates/weida-c/tests/c/smoke.c (smoke.c, run by smoke.sh), and the unit tests in crates/weida-c/src/.

2. Runtime, listener and bindings

crates/weidaC ABIVerdict
Runtime::ownedweida_runtime_ownedpresent; every abi:: test, smoke.c
Runtime::new, Runtime::with_handle—refused: a C caller has no Tokio runtime to hand over; the ABI owns its reactor (R13)
Runtime::listenerweida_runtime_listenerpresent; abi::a_streamed_round_trip_over_inproc
Runtime::requesterweida_runtime_requesterpresent; abi::a_streamed_round_trip_over_inproc
Runtime::shutdownweida_runtime_shutdown (op)present; abi::a_shutdown_finishes_with_an_exchange_abandoned
Runtime::drainweida_runtime_drain (op, consumes; its wait yields a weida_drained)present; abi::a_drain_counts_a_reply_finished_before_it_as_delivered, abi::a_drain_with_nothing_pending_returns_at_once (drain)
Runtime::pusher, subscriberweida_runtime_pusher, weida_runtime_subscriberpresent; abi::push_to_pull_over_inproc_arrives_in_order, abi::a_subscriber_receives_only_its_topic (patterns)
Runtime::pair, surveyorweida_runtime_pair, weida_runtime_surveyorpresent; abi::a_pair_exchanges_in_both_directions, abi::a_survey_collects_two_respondents_answers_within_its_window (patterns)
Runtime::dishweida_runtime_dishpresent; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
Runtime::peerweida_runtime_peerpresent; abi::a_flow_carries_datagrams_over_quic, abi::a_flow_without_datagrams_is_unavailable_and_a_refusal_reaches_its_sender (flows), abi::a_raw_peer_opens_a_stream_that_the_acceptor_reads (raw peers)
Runtime::swarmweida_runtime_swarmpresent; abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others, abi::a_declined_session_leaves_the_fetch_not_connected (swarm)
Runtime::config—refused: the configuration is the builder the caller passed to weida_runtime_owned, which copied it
Runtime::suppressed_duplicates, expired_transfersweida_runtime_suppressed_duplicates, weida_runtime_expired_transferspresent; abi::an_expired_reply_fails_its_finish_and_cancels_the_reader (counts 0 then 1), abi::an_inproc_connection_is_reported_with_its_url_and_no_transport (0 without deduplication) (stats)
Runtime::exec—refused: it is the binding's own seam
Drop for Runtimeweida_runtime_droppresent; R13, the reactor ends with its last user
Listener::bind_quicweida_listener_bind_quic (op)present; abi::a_server_outside_the_pins_is_untrusted, smoke.c
Listener::bind_inprocweida_listener_bind_inprocpresent; abi::a_streamed_round_trip_over_inproc
Listener::replierweida_listener_replierpresent; every abi:: test
Listener::bind_quic_socketweida_listener_bind_quic_socket (op; takes ownership of the descriptor)present; abi::a_hand_over_keeps_a_requesters_connection (binding lifecycle)
Listener::bind_unix, bind_pipeweida_listener_bind_unix, weida_listener_bind_pipe (plain functions, R3; -WEIDA_EUNSUPPORTED on the other platform)present; abi::a_round_trip_over_unix_names_the_clients_uid, abi::a_round_trip_over_a_pipe_names_the_clients_sid (local transports)
Listener::bind_relayweida_listener_bind_relay (op; its wait yields a relayed weida_binding). Dialling a weida+relay:// URL needs nothing more: the ABI passes URL textpresent; abi::a_dial_only_replier_answers_through_a_relay (binding lifecycle)
Listener::relay, Relay::acceptweida_listener_relay, weida_relay_accept (try, R3a)present; abi::a_dial_only_replier_answers_through_a_relay (binding lifecycle)
RelayRequest::peer, targetweida_relay_request_peer_fingerprint, _target (sha256: text)present; abi::a_dial_only_replier_answers_through_a_relay (binding lifecycle)
RelayRequest::admit, admit_with (RelayBudget), refuseweida_relay_request_admit, _admit_with (a bytes_per_sec), _refuse (ops, consume)present; abi::a_dial_only_replier_answers_through_a_relay, abi::a_tunnel_admitted_with_a_budget_moves_no_faster_than_it (binding lifecycle)
Drop for Relay, Drop for RelayRequest (NO_REPLY)weida_relay_drop, weida_relay_request_droppresent; abi::a_dial_only_replier_answers_through_a_relay (binding lifecycle)
Binding::relay_eventsweida_binding_relay_events (a weida_peer_events queue; 0 for a binding not relayed)present; abi::a_dial_only_replier_answers_through_a_relay (binding lifecycle)
Listener::puller, publisherweida_listener_puller, weida_listener_publisherpresent; abi::push_to_pull_over_inproc_arrives_in_order, abi::a_subscriber_receives_only_its_topic (patterns)
Listener::pair, respondent, busweida_listener_pair, weida_listener_respondent, weida_listener_buspresent; abi::a_pair_exchanges_in_both_directions, abi::a_survey_collects_two_respondents_answers_within_its_window, abi::a_bus_message_reaches_every_other_member (patterns)
Listener::radioweida_listener_radiopresent; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
Listener::acceptorweida_listener_acceptorpresent; abi::a_flow_carries_datagrams_over_quic, abi::a_flow_without_datagrams_is_unavailable_and_a_refusal_reaches_its_sender (flows), abi::a_raw_peer_opens_a_stream_that_the_acceptor_reads (raw peers)
Listener::seederweida_listener_seederpresent; abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others, abi::a_declined_session_leaves_the_fetch_not_connected (swarm)
Binding::local_addrweida_binding_local_addrpresent; abi::a_server_outside_the_pins_is_untrusted, smoke.c
Binding::closeweida_binding_close (op)present; abi::a_closed_binding_refuses_the_next_dial (binding lifecycle)
Binding::hand_over, Handoff::held, local_addr, into_partsweida_binding_hand_over (op, consumes; its wait yields a weida_handoff), weida_handoff_held, _local_addr, _take_socket, _bytespresent; abi::a_hand_over_keeps_a_requesters_connection (binding lifecycle)
Binding::take_overweida_binding_take_over (op)present; abi::a_hand_over_keeps_a_requesters_connection (binding lifecycle)
Binding::disconnectweida_binding_disconnectpresent; abi::a_binding_disconnects_a_peer_by_its_key (binding lifecycle)
LocalBinding::busweida_local_binding_buspresent; R7 getter
UnixBinding::path, PipeBinding::nameweida_unix_binding_path, weida_pipe_binding_name (R7 getters)present; abi::a_round_trip_over_unix_names_the_clients_uid, abi::a_round_trip_over_a_pipe_names_the_clients_sid (local transports)
Drop for UnixBinding (removes the socket file), Drop for PipeBinding (releases the name)weida_unix_binding_drop, weida_pipe_binding_droppresent; abi::a_round_trip_over_unix_names_the_clients_uid, abi::a_round_trip_over_a_pipe_names_the_clients_sid (local transports)

3. Req/Rep, streamed

crates/weidaC ABIVerdict
Requester::connectweida_requester_connect (op)present; abi::a_streamed_round_trip_over_inproc, smoke.c
Requester::requestweida_requester_request (op), the reply handed over at its headerpresent; abi::a_streamed_round_trip_over_inproc
Requester::request_withweida_requester_request_with (op)present; abi::metadata_travels_with_a_request_and_its_reply (config)
Requester::openweida_requester_open (op; its wait yields the request body as a weida_outgoing_transfer and the weida_reply_stream)present; abi::an_opened_exchange_reads_its_reply_while_the_request_is_still_open (streams)
ReplyStream::recvweida_reply_stream_recv (op, consumes)present; abi::an_opened_exchange_reads_its_reply_while_the_request_is_still_open (streams)
Drop for ReplyStream (CANCELED)weida_reply_stream_droppresent; abi::dropping_a_reply_stream_cancels_the_exchange (streams)
Requester::connection_statsweida_requester_connection_stats (a snapshot handle, stats.md)present; abi::an_inproc_connection_is_reported_with_its_url_and_no_transport, abi::a_quic_connection_reports_its_transport (stats)
Requester::eventsweida_requester_events (a weida_peer_events queue)present; abi::a_replier_runtime_shut_down_reports_lost_then_retrying (stats)
Replier::acceptweida_replier_accept (try, R3a)present; abi::an_accept_with_nothing_pending_answers_eagain, abi::a_repliers_descriptor_follows_its_queue, abi::a_signal_ends_a_blocked_accept_with_eintr, abi::dropping_a_replier_ends_a_blocked_accept_with_eclosed
Replier::pathweida_replier_pathpresent; R7 getter
IncomingRequest::metaweida_incoming_request_metapresent; abi::a_streamed_round_trip_over_inproc (endpoint)
IncomingRequest::take_bodyweida_incoming_request_take_body; a second call is -WEIDA_ECLOSED where Rust panicspresent; abi::a_streamed_round_trip_over_inproc
IncomingRequest::body—refused: R1, a lent &mut sub-handle has no C lifetime; take_body is its owning twin
IncomingRequest::replyweida_incoming_request_reply (op, consumes)present; abi::a_streamed_round_trip_over_inproc
IncomingRequest::refuse, ErrorCodeweida_incoming_request_refuse (op, consumes), WEIDA_ERROR_CODE_*present; abi::a_refused_request_fails_the_requester_with_its_codes_error (refusals)
IncomingRequest::canceledweida_incoming_request_canceled (op, outlives the request)present; abi::canceled_settles_once_the_requester_drops_its_request (refusals)
IncomingRequest::connectionweida_incoming_request_connectionpresent; abi::a_request_and_its_body_name_the_same_connection (stats)
Drop for IncomingRequest (NO_REPLY)weida_incoming_request_droppresent; R1

4. Transfers and receipts

crates/weidaC ABIVerdict
AsyncRead for IncomingTransferweida_incoming_transfer_read (try)present; abi::a_streamed_round_trip_over_inproc (pieces of 3), abi::a_reply_dropped_unfinished_reads_as_canceled
IncomingTransfer::collectweida_incoming_transfer_collect (op, consumes)present; abi::a_collect_over_its_ceiling_fails_with_limit_exceeded
IncomingTransfer::read_capped—refused: R3c, a loop over read the caller writes
IncomingTransfer::metaweida_incoming_transfer_metapresent; abi::a_streamed_round_trip_over_inproc (content_type)
IncomingTransfer::reporterweida_incoming_transfer_reporter (1 and a weida_reporter, or 0 with NULL)present; abi::a_request_that_orders_accepted_receives_the_reported_offsets_in_order, abi::final_only_reports_one_record_per_level_at_the_end (cursors)
IncomingTransfer::connectionweida_incoming_transfer_connectionpresent; abi::a_request_and_its_body_name_the_same_connection (stats)
Drop for IncomingTransfer (REJECTED)weida_incoming_transfer_droppresent; streams::a_refused_payload_reports_rejected_through_async_write proves the outcome in Rust
AsyncWrite for OutgoingTransferweida_outgoing_transfer_write (try)present; abi::a_streamed_round_trip_over_inproc, smoke.c
OutgoingTransfer::write_all—refused: R3c
OutgoingTransfer::finishweida_outgoing_transfer_finish (consumes)present; abi::a_streamed_round_trip_over_inproc
OutgoingTransfer::cancelweida_outgoing_transfer_drop (an unfinished transfer is reset CANCELED)present; abi::a_reply_dropped_unfinished_reads_as_canceled
OutgoingTransfer::trace, set_priority, expire_atweida_outgoing_transfer_trace, _set_priority, _expire_after_mspresent; abi::metadata_travels_with_a_request_and_its_reply, abi::an_expired_reply_fails_its_finish_and_cancels_the_reader (config)
OutgoingTransfer::cursorsweida_outgoing_transfer_cursors (1 and a weida_cursors queue once, or 0 with NULL)present; abi::a_request_that_orders_accepted_receives_the_reported_offsets_in_order, abi::final_only_reports_one_record_per_level_at_the_end (cursors)
Delivery::deliveredweida_delivery_delivered (op, consumes)present; abi::a_streamed_round_trip_over_inproc
Drop for Deliveryweida_delivery_droppresent
Cursors::changedweida_cursors_recv (try, R3a; a weida_cursor_set per change, NULL at the end), _fdpresent; abi::a_request_that_orders_accepted_receives_the_reported_offsets_in_order, abi::final_only_reports_one_record_per_level_at_the_end (cursors)
Cursors::snapshot, offset—refused: the queue yields the whole newest set on every change, coalesced, so the set weida_cursors_recv returned last is the snapshot until it returns another, and timeout_ms 0 is the non-blocking read; a recv in flight owns the reader, as Rust's &mut self borrow does
Drop for Cursors (releases the report id)weida_cursors_droppresent; R1
CursorSet::offset, iter, lenweida_cursor_set_offset, _level (by index, ascending), _lenpresent; abi::a_request_that_orders_accepted_receives_the_reported_offsets_in_order, abi::final_only_reports_one_record_per_level_at_the_end (cursors)
CursorSet::is_empty—refused: weida_cursor_set_len is 0
Reporter::levels, modeweida_reporter_levels (wire values), _modepresent; abi::a_request_that_orders_accepted_receives_the_reported_offsets_in_order, abi::final_only_reports_one_record_per_level_at_the_end (cursors)
Reporter::with_granularityweida_reporter_set_granularity (bytes, milliseconds)present; abi::a_request_that_orders_accepted_receives_the_reported_offsets_in_order (cursors)
Reporter::reportweida_reporter_report (op)present; abi::a_request_that_orders_accepted_receives_the_reported_offsets_in_order, abi::final_only_reports_one_record_per_level_at_the_end (cursors)
Reporter::finishweida_reporter_finish (op, consumes)present; abi::a_request_that_orders_accepted_receives_the_reported_offsets_in_order, abi::final_only_reports_one_record_per_level_at_the_end (cursors)
Reporter::DEFAULT_BYTES, DEFAULT_INTERVALWEIDA_REPORTER_DEFAULT_BYTES, _DEFAULT_INTERVAL_MS (asserted at compile time)present
Drop for Reporter (flushes nothing)weida_reporter_droppresent; R1
ConnectionIdits number, uint64_t (ConnectionId::get)present; abi::a_request_and_its_body_name_the_same_connection (stats)

5. Values and metadata

crates/weidaC ABIVerdict
RuntimeConfig::worker_threads, shutdown_timeoutweida_runtime_config_set_worker_threads, _set_shutdown_timeout_mspresent; test_errors.py (Python) for worker_threads = 0
every other RuntimeConfig field (limits, max_connections, max_connections_per_peer, endpoint_queue, max_resolved_addresses, guarantees, discovery, connect_attempt_timeout, reconnect, send_timeout, outbox_messages, outbox_bytes, outbox_full, max_handshakes, retry_above_handshakes)weida_runtime_config_set_*present; runtime::tests::every_setter_lands_on_its_field, abi::a_send_timeout_ends_a_request_to_a_peer_that_is_gone for send_timeout (config)
RuntimeConfig::resolverweida_runtime_config_set_resolver (shares the queue; NULL is the system resolver)present; abi::a_name_only_the_resolver_knows_is_dialled_through_it (resolver)
RuntimeConfig::network, Network—refused: a SimNet exists only under test-util
Limits, Congestion, DEFAULT_DATAGRAM_RECEIVE_BYTESweida_limits and its setters, WEIDA_CONGESTION_*, WEIDA_DEFAULT_DATAGRAM_RECEIVE_BYTESpresent; runtime::tests::every_setter_lands_on_its_field, abi::limits_reach_the_quic_transport (config)
Limits::header_slots, worst_case_header_memory—refused: computations over the caller's own values
Discovery, OutboxFullWEIDA_DISCOVERY_*, WEIDA_OUTBOX_FULL_*present; runtime::tests::every_setter_lands_on_its_field (config)
ReconnectPolicy (fields and never)weida_reconnect_policy and its setters, weida_reconnect_policy_neverpresent; runtime::tests::every_setter_lands_on_its_field (config)
ReconnectPolicy::redials, delay—refused: computations over the caller's own values
GuaranteeSet and its dimensions (DeliveryLevel, Acknowledgement, Durability, OrderingMode, Deduplication, Backpressure, ProducerNaming)weida_guarantee_set and its setters, the WEIDA_<DIMENSION>_* constantspresent; runtime::tests::every_setter_lands_on_its_field, abi::a_guarantee_the_dialler_does_not_offer_fails_negotiation (config)
GuaranteeSet::is_core, intersect, reaches—refused: the runtime negotiates, and the ABI hands a caller no set to compare
Trust::by_addressweida_trust_newpresent; smoke.c
Trust::and_pinweida_trust_add_pinpresent; abi::a_malformed_pin_is_an_invalid_fingerprint, abi::a_server_outside_the_pins_is_untrusted
Trust::and_anchor, and_anchor_fileweida_trust_add_anchor, _add_anchor_filepresent; abi::a_trust_anchor_checks_the_name_the_dial_used (identity)
Trust::pin, anchor, anchor_fileweida_trust_new plus the matching _add_*present (identity)
Trust::is_emptyweida_trust_is_emptypresent; tls::tests::alpn_setters_take_the_two_tokens_and_refuse_others (identity)
Identity::generate, from_pem, fingerprintweida_identity_generate, _from_pem, _fingerprintpresent; smoke.c, abi::a_server_outside_the_pins_is_untrusted
Identity::generate_forweida_identity_generate_forpresent; tls::tests::generate_for_refuses_a_null_name, abi::a_trust_anchor_checks_the_name_the_dial_used (identity)
Identity::from_pem_files, from_pem_fileweida_identity_from_pem_files, _from_pem_filepresent; abi::an_identity_written_to_a_file_reads_back_with_its_fingerprint (identity)
Identity::certificate_pem, to_pem, Pemweida_identity_certificate_pem, _to_pem, the owned weida_pem wiped on droppresent; tls::tests::a_pem_written_by_to_pem_reads_back_with_the_same_fingerprint (identity)
ClientTls::newweida_client_tls_newpresent
ClientTls::with_identityweida_client_tls_set_identitypresent; abi::a_binding_that_requires_a_pinned_client_refuses_anonymous_and_strangers, abi::a_binding_that_requires_any_key_exposes_the_fingerprint_and_chain (identity)
ClientTls::with_alpn, Alpnweida_client_tls_set_alpn, WEIDA_ALPN_WEIDA, WEIDA_ALPN_RAFTpresent; abi::a_mismatched_alpn_fails_the_dial_with_etls, tls::tests::alpn_setters_take_the_two_tokens_and_refuse_others (identity)
ServerTls::newweida_server_tls_newpresent
ServerTls::require_client, ClientTrustweida_server_tls_require_client (Trusted), _require_any_key (AnyKey)present; abi::a_binding_that_requires_a_pinned_client_refuses_anonymous_and_strangers, abi::a_binding_that_requires_any_key_exposes_the_fingerprint_and_chain (identity)
ServerTls::with_alpnweida_server_tls_set_alpnpresent; abi::a_mismatched_alpn_fails_the_dial_with_etls, tls::tests::alpn_setters_take_the_two_tokens_and_refuse_others (identity)
Alpn::token—refused: wire vocabulary; each constant names its token
ClientTls::new, with_identity, ServerTls::new, require_client given a sourceweida_client_tls_new_source, _set_identity_source, weida_server_tls_new_source, _require_client_source (shared, not copied)present; abi::a_files_identity_source_rotates_a_bindings_certificate, abi::a_mismatched_alpn_fails_the_dial_with_etls, identity::tests::the_source_forms_share_their_source (identity)
IdentitySource::from_identity, ephemeral, external, filesweida_identity_source_from_identity, _ephemeral, _external, _filespresent; abi::a_files_identity_source_rotates_a_bindings_certificate, abi::a_mismatched_alpn_fails_the_dial_with_etls, identity::tests::an_external_source_reports_its_updates_through_the_queue (identity)
IdentitySource::current, fingerprintweida_identity_source_current (a new weida_identity), _fingerprint (into the caller's buffer)present; abi::a_files_identity_source_rotates_a_bindings_certificate, identity::tests::an_external_source_reports_its_updates_through_the_queue (identity)
IdentitySource::update, report_failure, report_handoff_stolen, reloadweida_identity_source_update, _report_failure, _report_handoff_stolen, _reload (1, 0 or the error)present; identity::tests::an_external_source_reports_its_updates_through_the_queue, abi::a_files_identity_source_rotates_a_bindings_certificate (identity)
IdentitySource::downgrade, WeakIdentitySource::upgrade, Dropweida_identity_source_downgrade, weida_weak_identity_source_upgrade (1, or 0 with NULL), weida_identity_source_drop, weida_weak_identity_source_droppresent; identity::tests::an_external_source_reports_its_updates_through_the_queue (identity)
TrustSource::from_trust, external, current, update, report_failure, is_emptyweida_trust_source_from_trust, _external, _current, _update, _report_failure, _is_emptypresent; identity::tests::a_trust_source_reports_a_refresh_and_reads_back_empty, abi::a_mismatched_alpn_fails_the_dial_with_etls (identity)
TrustSource::downgrade, WeakTrustSource::upgradeweida_trust_source_downgrade, weida_weak_trust_source_upgradepresent; identity::tests::a_trust_source_reports_a_refresh_and_reads_back_empty (identity)
FilesOptions (names, poll)weida_files_options_new, _set_names, _set_poll_ms; NULL is the defaultpresent; identity::tests::files_options_setters_land_on_their_fields, abi::a_files_identity_source_rotates_a_bindings_certificate (identity)
TransferMeta::with_content_typeweida_transfer_meta_set_content_typepresent; abi::a_streamed_round_trip_over_inproc
TransferMeta::with_content_len, with_trace, with_topic, with_achievedweida_transfer_meta_set_content_len, _set_trace, _set_topic, _set_achievedpresent; abi::metadata_travels_with_a_request_and_its_reply (config)
TransferMeta::with_report, with_report_modeweida_transfer_meta_set_report (an array of wire values), _set_report_modepresent; abi::a_request_that_orders_accepted_receives_the_reported_offsets_in_order, abi::final_only_reports_one_record_per_level_at_the_end (cursors)
IncomingMeta::endpoint, content_type, topic, content_len, sequenceweida_incoming_meta_*present; endpoint and content_type by abi::a_streamed_round_trip_over_inproc
IncomingMeta::peerweida_incoming_meta_peer_fingerprint (PeerIdentity::Key), _peer_uid, _peer_gid, _peer_pid (Local), _peer_sid, _peer_pid (Windows)present; abi::a_binding_that_requires_any_key_exposes_the_fingerprint_and_chain, abi::a_round_trip_over_unix_names_the_clients_uid, abi::a_round_trip_over_a_pipe_names_the_clients_sid, transfer::tests::every_peer_identity_reads_back_through_its_getters (local transports)
IncomingMeta::peer_chain, PeerChainweida_incoming_meta_peer_chain_len, _peer_chain_cert (DER, leaf first)present; abi::a_binding_that_requires_any_key_exposes_the_fingerprint_and_chain
IncomingMeta::trace, tracestate, achievedweida_incoming_meta_trace, _tracestate, _achievedpresent; abi::metadata_travels_with_a_request_and_its_reply (config)
IncomingMeta::gap, Gapweida_incoming_meta_gap (both fields)present; transfer::tests::a_gap_reads_back_through_its_getter, abi::a_skipped_sequence_reads_as_a_gap_under_detect (patterns)
Gap::missed—refused: a computation over the two values the getter returns
IncomingMeta::segment, layerweida_incoming_meta_segment, _layerpresent; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
IncomingMeta::report, report_mode, report_idweida_incoming_meta_report (wire values), _report_mode, _report_idpresent; abi::a_request_that_orders_accepted_receives_the_reported_offsets_in_order, abi::final_only_reports_one_record_per_level_at_the_end (cursors)
CursorLevel (Known, Application, APPLICATION_FLOOR, from_wire, to_wire, application)its wire value as uint64_t, WEIDA_CURSOR_LEVEL_APPLICATION_FLOOR (asserted at compile time)present; abi::a_request_that_orders_accepted_receives_the_reported_offsets_in_order, abi::final_only_reports_one_record_per_level_at_the_end, cursor::tests::a_reserved_level_is_refused_and_the_rest_read_back (cursors)
ReportModeWEIDA_REPORT_MODE_PROGRESS, _FINAL_ONLY (R7)present; abi::a_request_that_orders_accepted_receives_the_reported_offsets_in_order, abi::final_only_reports_one_record_per_level_at_the_end (cursors)
Fingerprintsha256: text everywherepresent
Error, LossCausethe R9 constants and the thread-local recordpresent; error::tests::every_variant_has_its_own_code_below_the_abi_codes, abi::a_server_outside_the_pins_is_untrusted (weida_last_error_fingerprint)
StopReason, codes—refused: wire vocabulary, reached through the R9 outcome codes
Address, EndpointAddr, InprocAddr, UnixAddr, PipeAddr, RelayAddr, DEFAULT_PORT, RELAY_PATH, SCHEME_RELAYURLs as stringsrefused: the C caller passes the text, weida parses it
new_trace, TraceContextweida_new_trace; a trace context is its traceparent text (R7)present; tls::tests::new_trace_writes_a_traceparent_that_sets_back (config)
Resolver, SharedResolver, SystemResolver, Resolvedweida_resolver (_new, _fd, _recv a try (R3a), _drop: the lookups as a queue, decision 10), weida_resolved (_name, _port, _max_addresses, _answer and _refuse (consume), _drop); SharedResolver is the handle, shared by every configuration it is set on; SystemResolver is NULL in the setter; the Exec argument is not mapped (the binding's own seam)present; resolver::tests::a_lookup_reads_back_and_its_answer_reaches_the_dial, resolver::tests::an_answer_outside_the_contract_fails_the_dial, resolver::tests::a_refused_or_dropped_lookup_fails_the_dial_with_invalid_address, resolver::tests::the_queue_ends_once_no_configuration_holds_the_resolver, abi::a_name_only_the_resolver_knows_is_dialled_through_it, abi::a_refused_lookup_fails_the_connect_with_einvalid_address (resolver)
SimNet, SimStats—refused: a test double of the Rust test suite (test-util)
Result, Pattern, Endpoint and the pattern markers—refused: Rust type machinery; the ABI has one handle type per role (decision 3)

6. Observability

crates/weidaVerdict
ConnectionStats, PathStats, RemoteStats, TransportStats, UdpCounts, connection_stats()present: weida_connection_stats and its getters (stats.md); abi::an_inproc_connection_is_reported_with_its_url_and_no_transport, abi::a_quic_connection_reports_its_transport (stats); PathStats of a flow is also the weida_path_stats snapshot (flow.md), abi::a_flow_carries_datagrams_over_quic (flows)
PeerEvent, PeerEvents, GiveUppresent: weida_peer_events (a try handle) and weida_peer_event, WEIDA_PEER_EVENT_*, WEIDA_GIVE_UP_*; abi::a_replier_runtime_shut_down_reports_lost_then_retrying, stats::tests::every_peer_event_kind_reads_back_through_its_getters (stats)
IdentityEvent, IdentityEvents, IdentitySource::events, TrustSource::eventspresent: weida_identity_events (a try handle) and weida_identity_event, WEIDA_IDENTITY_EVENT_* (identity.md); abi::a_files_identity_source_rotates_a_bindings_certificate, identity::tests::every_identity_event_kind_reads_back_through_its_getters, identity::tests::an_external_source_reports_its_updates_through_the_queue (identity)
TopicDropspresent: weida_topic_drops and its getters (pubsub.md); abi::a_skipped_sequence_reads_as_a_gap_under_detect (patterns)
TopicDrops::totalrefused: a computation over the eight counts the getters return
DishDropspresent: weida_dish_drops and its getters (radio.md); abi::a_superseded_segment_counts_in_dish_drops, abi::a_radio_datagram_reaches_a_dish_that_carries_datagrams, abi::a_radio_evicts_a_dish_by_its_key (patterns)
Drainedpresent: weida_drained, weida_drained_delivered, weida_drained_outstanding (runtime.md); abi::a_drain_counts_a_reply_finished_before_it_as_delivered (drain)

7. Patterns

crates/weidaC ABIVerdict
Pusher::connectweida_pusher_connect (op)present; abi::push_to_pull_over_inproc_arrives_in_order (patterns)
Pusher::disconnect, peer_countweida_pusher_disconnect (1 or 0), weida_pusher_peer_countpresent; abi::push_to_pull_over_inproc_arrives_in_order (patterns)
Pusher::connection_stats, eventsweida_pusher_connection_stats (a snapshot handle), weida_pusher_events (a weida_peer_events queue)present; abi::push_to_pull_over_inproc_arrives_in_order (patterns)
Pusher::droppedweida_pusher_droppedpresent; abi::push_to_pull_over_inproc_arrives_in_order (patterns)
Pusher::openweida_pusher_open (op; its wait yields a weida_outgoing_transfer)present; abi::push_to_pull_over_inproc_arrives_in_order (patterns)
Pusher::send, send_withweida_pusher_send, _send_with (ops)present; abi::push_to_pull_over_inproc_arrives_in_order (patterns)
Puller::pathweida_puller_pathpresent; abi::push_to_pull_over_inproc_arrives_in_order (patterns)
Puller::recvweida_puller_recv (try, R3a)present; abi::push_to_pull_over_inproc_arrives_in_order (patterns)
Publisher::pathweida_publisher_pathpresent; R7 getter (patterns)
Publisher::publish, publish_with_traceweida_publisher_publish, _publish_with_trace (plain functions, R3)present; abi::a_subscriber_receives_only_its_topic (patterns)
Publisher::open, open_with_traceweida_publisher_open, _open_with_trace (a weida_fan_out)present; abi::a_fan_out_streams_one_payload_to_every_subscriber (patterns)
Publisher::subscriber_count, filter_countweida_publisher_subscriber_count, _filter_countpresent; abi::a_subscriber_receives_only_its_topic (patterns)
Publisher::droppedweida_publisher_droppedpresent; abi::a_skipped_sequence_reads_as_a_gap_under_detect (patterns)
Publisher::dropped_on, dropsweida_publisher_dropped_on, _drops (weida_topic_drops snapshots)present; abi::a_skipped_sequence_reads_as_a_gap_under_detect (patterns)
Subscriber::connectweida_subscriber_connect (op)present; abi::a_subscriber_receives_only_its_topic (patterns)
Subscriber::disconnect, peer_countweida_subscriber_disconnect (1 or 0), weida_subscriber_peer_countpresent; abi::a_subscriber_receives_only_its_topic (patterns)
Subscriber::connection_stats, eventsweida_subscriber_connection_stats, weida_subscriber_eventspresent; abi::a_subscriber_receives_only_its_topic (patterns)
Subscriber::subscribe, unsubscribeweida_subscriber_subscribe, _unsubscribe (ops)present; abi::a_subscriber_receives_only_its_topic (patterns)
Subscriber::filter_countweida_subscriber_filter_countpresent; abi::a_subscriber_receives_only_its_topic (patterns)
Subscriber::recvweida_subscriber_recv (try, R3a)present; abi::a_subscriber_receives_only_its_topic, abi::a_skipped_sequence_reads_as_a_gap_under_detect (patterns)
Subscriber::grantweida_subscriber_grant (op)present; abi::a_subscriber_receives_only_its_topic (patterns)
FanOut::topic, subscribersweida_fan_out_topic, _subscriberspresent; abi::a_fan_out_streams_one_payload_to_every_subscriber (patterns)
FanOut::write_withinweida_fan_out_write_within (op)present; abi::a_fan_out_streams_one_payload_to_every_subscriber (patterns)
FanOut::write_nowweida_fan_out_write_nowpresent; abi::a_fan_out_streams_one_payload_to_every_subscriber (patterns)
FanOut::finishweida_fan_out_finish (consumes)present; abi::a_fan_out_streams_one_payload_to_every_subscriber (patterns)
Drop for FanOut (aborts every copy)weida_fan_out_droppresent; R1 (patterns)
Paired::pathweida_paired_path (empty on a dialling pair)present; abi::a_pair_exchanges_in_both_directions (patterns)
Paired::connectweida_paired_connect (op)present; abi::a_pair_exchanges_in_both_directions (patterns)
Paired::peer_countweida_paired_peer_countpresent; abi::a_pair_exchanges_in_both_directions (patterns)
Paired::connection_statsweida_paired_connection_stats (a snapshot handle)present; abi::a_pair_exchanges_in_both_directions (patterns)
Paired::eventsweida_paired_events (1 and a weida_peer_events queue, or 0 for a bound pair)present; abi::a_pair_exchanges_in_both_directions (patterns)
Paired::droppedweida_paired_droppedpresent; abi::a_pair_exchanges_in_both_directions (patterns)
Paired::openweida_paired_open (op; its wait yields a weida_outgoing_transfer)present; abi::a_pair_exchanges_in_both_directions (patterns)
Paired::send, send_withweida_paired_send, _send_with (ops)present; abi::a_pair_exchanges_in_both_directions (patterns)
Paired::recvweida_paired_recv (try, R3a)present; abi::a_pair_exchanges_in_both_directions (patterns)
Drop for Pairedweida_paired_droppresent; R1 (patterns)
Surveyor::connectweida_surveyor_connect (op)present; abi::a_survey_collects_two_respondents_answers_within_its_window (patterns)
Surveyor::peer_countweida_surveyor_peer_countpresent; abi::a_survey_collects_two_respondents_answers_within_its_window (patterns)
Surveyor::connection_statsweida_surveyor_connection_stats (a snapshot handle)present; abi::a_survey_collects_two_respondents_answers_within_its_window (patterns)
Surveyor::survey, survey_withweida_surveyor_survey, _survey_with (ops; their wait yields a weida_survey_run)present; abi::a_survey_collects_two_respondents_answers_within_its_window (patterns)
SurveyRun::nextweida_survey_run_next (try, R3a; an answer is a weida_survey_answer)present; abi::a_survey_collects_two_respondents_answers_within_its_window (patterns)
SurveyRun::lateweida_survey_run_latepresent; abi::a_survey_collects_two_respondents_answers_within_its_window (patterns)
SurveyRun::respondentsweida_survey_run_respondentspresent; abi::a_survey_collects_two_respondents_answers_within_its_window (patterns)
Drop for SurveyRun (resets the unanswered exchanges)weida_survey_run_droppresent; R1 (patterns)
Respondent::pathweida_respondent_pathpresent; abi::a_survey_collects_two_respondents_answers_within_its_window (patterns)
Respondent::acceptweida_respondent_accept (try, R3a; a weida_incoming_request)present; abi::a_survey_collects_two_respondents_answers_within_its_window (patterns)
BusMember::pathweida_bus_member_pathpresent; abi::a_bus_message_reaches_every_other_member (patterns)
BusMember::connectweida_bus_member_connect (op)present; abi::a_bus_message_reaches_every_other_member (patterns)
BusMember::peer_countweida_bus_member_peer_countpresent; abi::a_bus_message_reaches_every_other_member (patterns)
BusMember::connection_statsweida_bus_member_connection_stats (a snapshot handle)present; abi::a_bus_message_reaches_every_other_member (patterns)
BusMember::send, send_withweida_bus_member_send, _send_with (ops; their wait writes the members reached)present; abi::a_bus_message_reaches_every_other_member (patterns)
BusMember::recvweida_bus_member_recv (try, R3a)present; abi::a_bus_message_reaches_every_other_member (patterns)
BusMember::droppedweida_bus_member_droppedpresent; abi::a_bus_message_reaches_every_other_member (patterns)
Radio::pathweida_radio_pathpresent; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
Radio::segmentweida_radio_segment (a weida_segment)present; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
Radio::datagramweida_radio_datagram (writes the dishes handed)present; abi::a_radio_datagram_reaches_a_dish_that_carries_datagrams (patterns)
Radio::dish_countweida_radio_dish_countpresent; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
Radio::droppedweida_radio_droppedpresent; abi::a_superseded_segment_counts_in_dish_drops (patterns)
Radio::dropped_on, dropsweida_radio_dropped_on, _drops (weida_topic_drops snapshots)present; abi::a_superseded_segment_counts_in_dish_drops, abi::a_radio_datagram_reaches_a_dish_that_carries_datagrams (patterns)
Radio::evictweida_radio_evict (key as sha256: text)present; abi::a_radio_evicts_a_dish_by_its_key (patterns)
Radio::dish_dropsweida_radio_dish_drops (a weida_dish_drops snapshot)present; abi::a_superseded_segment_counts_in_dish_drops, abi::a_radio_datagram_reaches_a_dish_that_carries_datagrams, abi::a_radio_evicts_a_dish_by_its_key (patterns)
Drop for Radio (releases the path with the last handle)weida_radio_droppresent; R1 (patterns)
Radio::with_admission, Join—refused: a policy the connection's task calls synchronously before it records a join. 0045 decision 10 maps inverted control to queues and has no function pointers, and a queue would answer after the join was recorded. weida_radio_evict withdraws a join afterwards
Clone for Radio—refused: one handle serves every thread (R5)
Segment::number, topicweida_segment_number, _topicpresent; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
Segment::write, write_layerweida_segment_write, _write_layer (plain functions, R3)present; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
Segment::finish_layerweida_segment_finish_layerpresent; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
Segment::finishweida_segment_finish (consumes)present; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers, abi::a_superseded_segment_counts_in_dish_drops (patterns)
Drop for Segment (resets unfinished layers)weida_segment_droppresent; R1 (patterns)
SegmentTermsweida_segment_terms_* (a builder)present; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
JoinTermsweida_join_terms_* (a builder)present; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
MAX_SEGMENT_LAYERSWEIDA_MAX_SEGMENT_LAYERS (asserted at compile time)present (patterns)
Dish::connectweida_dish_connect (op)present; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
Dish::peer_count, connection_stats, eventsweida_dish_peer_count, _connection_stats (a snapshot handle), _events (a weida_peer_events queue)present; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
Dish::join, leaveweida_dish_join, _leave (ops)present; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
Dish::recvweida_dish_recv (try, R3a; a weida_received)present; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers, abi::a_radio_datagram_reaches_a_dish_that_carries_datagrams (patterns)
Dish::stale, overflowweida_dish_stale, _overflowpresent; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers (patterns)
Drop for Dishweida_dish_droppresent; R1 (patterns)
Receivedweida_received (_kind, _take_segment, _topic, _segment, _payload; WEIDA_RECEIVED_*)present; abi::a_dish_receives_the_radios_segments_with_their_numbers_and_layers, abi::a_radio_datagram_reaches_a_dish_that_carries_datagrams (patterns)
Peer::connectweida_peer_connect (op)present; abi::a_flow_carries_datagrams_over_quic, abi::a_flow_without_datagrams_is_unavailable_and_a_refusal_reaches_its_sender (flows), abi::a_raw_peer_opens_a_stream_that_the_acceptor_reads (raw peers)
Peer::open_flowweida_peer_open_flow (op; its wait yields a weida_flow)present; abi::a_flow_carries_datagrams_over_quic, abi::a_flow_without_datagrams_is_unavailable_and_a_refusal_reaches_its_sender (flows)
Peer::openweida_peer_open (op; its wait yields a weida_outgoing_transfer)present; abi::a_raw_peer_opens_a_stream_that_the_acceptor_reads (raw peers)
Peer::open_biweida_peer_open_bi (op; its wait yields a weida_outgoing_transfer and a weida_reply_stream)present; abi::a_raw_peer_opens_a_stream_that_the_acceptor_reads (raw peers)
Peer::sendweida_peer_send (op; NULL meta is the default)present; abi::a_raw_peer_opens_a_stream_that_the_acceptor_reads (raw peers)
Peer::segmentweida_peer_segment (op; its wait yields a weida_segment)present; abi::a_raw_peer_segment_supersedes_its_unfinished_predecessor (raw peers)
Peer::segment_dropsweida_peer_segment_drops (a weida_topic_drops of 0 or 1 record)present; abi::a_raw_peer_segment_supersedes_its_unfinished_predecessor (raw peers)
Peer::disconnect, peer_count, dropped, connection_stats, eventsweida_peer_disconnect, _peer_count, _dropped, _connection_stats (a snapshot handle), _peer_events (a weida_peer_events queue)present; abi::a_raw_peer_opens_a_stream_that_the_acceptor_reads (raw peers)
Drop for Peerweida_peer_droppresent; R1 (flows)
Acceptor::pathweida_acceptor_pathpresent; abi::a_flow_carries_datagrams_over_quic (flows), abi::a_raw_peer_opens_a_stream_that_the_acceptor_reads (raw peers)
Acceptor::acceptweida_acceptor_accept (try, R3a; a weida_incoming)present; abi::a_flow_carries_datagrams_over_quic, abi::a_flow_without_datagrams_is_unavailable_and_a_refusal_reaches_its_sender (flows), abi::a_raw_peer_opens_a_stream_that_the_acceptor_reads (raw peers)
Incomingweida_incoming (_kind, WEIDA_INCOMING_*, _take_stream, _take_exchange, _take_subscribed, _take_credit, _take_flow, _unsubscribed_id, _unsubscribed_filter, _drop)present; abi::a_flow_carries_datagrams_over_quic, abi::a_flow_without_datagrams_is_unavailable_and_a_refusal_reaches_its_sender (flows), abi::a_raw_peer_opens_a_stream_that_the_acceptor_reads, abi::credit_granted_in_two_steps_releases_exactly_that_many_deliveries (raw peers)
Consumer::id, filter, pathweida_consumer_id, _filter, _pathpresent; abi::credit_granted_in_two_steps_releases_exactly_that_many_deliveries (raw peers)
Consumer::openweida_consumer_open (op; its wait yields a weida_outgoing_transfer)present; abi::credit_granted_in_two_steps_releases_exactly_that_many_deliveries (raw peers)
Consumer::deliverweida_consumer_deliver (op)present; abi::credit_granted_in_two_steps_releases_exactly_that_many_deliveries (raw peers)
Consumer::closeweida_consumer_close (plain function, R3)present; abi::credit_granted_in_two_steps_releases_exactly_that_many_deliveries (raw peers)
Clone for Consumer—refused: one handle serves every thread (R5)
ConsumerIdits number, uint64_t (ConsumerId::get)present; abi::credit_granted_in_two_steps_releases_exactly_that_many_deliveries (raw peers)
CreditGrant (id, filter, limit)weida_credit_grant (_id, _filter, _limit, _drop)present; abi::credit_granted_in_two_steps_releases_exactly_that_many_deliveries (raw peers)
FlowMeta (default, with_content_type, with_trace, with_topic)weida_flow_meta_new, _set_content_type, _set_trace, _set_topic (a builder; NULL is the default)present; abi::a_flow_carries_datagrams_over_quic (flows)
Flow::sendweida_flow_send (plain function, R3)present; abi::a_flow_carries_datagrams_over_quic, abi::a_flow_without_datagrams_is_unavailable_and_a_refusal_reaches_its_sender (flows)
Flow::max_payloadweida_flow_max_payload (1 and the size, or 0)present; abi::a_flow_carries_datagrams_over_quic, abi::a_flow_without_datagrams_is_unavailable_and_a_refusal_reaches_its_sender (flows)
Flow::stats, IncomingFlow::stats, FlowStatsweida_flow_sent, _too_large, _discarded, _not_live; weida_incoming_flow_received, _overflowpresent; abi::a_flow_carries_datagrams_over_quic (flows)
Flow::path_stats, IncomingFlow::path_statsweida_flow_path_stats, weida_incoming_flow_path_stats (1 and a weida_path_stats, or 0 with NULL)present; abi::a_flow_carries_datagrams_over_quic, abi::a_flow_without_datagrams_is_unavailable_and_a_refusal_reaches_its_sender (flows)
Flow::close, Drop for Flow (FIN)weida_flow_droppresent; abi::a_flow_carries_datagrams_over_quic (flows)
Flow::abortweida_flow_abort (consumes)present; abi::a_flow_without_datagrams_is_unavailable_and_a_refusal_reaches_its_sender (flows)
IncomingFlow::info, FlowInfoweida_incoming_flow_info (a weida_incoming_meta)present; abi::a_flow_carries_datagrams_over_quic, flow::tests::flow_info_reads_back_through_the_metadata_getters (flows)
IncomingFlow::recvweida_incoming_flow_recv (try, R3a; a weida_datagram, NULL at the end), _fdpresent; abi::a_flow_carries_datagrams_over_quic, abi::a_flow_without_datagrams_is_unavailable_and_a_refusal_reaches_its_sender (flows)
IncomingFlow::try_recv—refused: weida_incoming_flow_recv with timeout_ms 0 is the non-blocking read, and it tells "nothing yet" (-WEIDA_EAGAIN) from the end (NULL)
IncomingFlow::refuseweida_incoming_flow_refuse (consumes)present; abi::a_flow_without_datagrams_is_unavailable_and_a_refusal_reaches_its_sender (flows)
Drop for IncomingFlow (CANCELED)weida_incoming_flow_droppresent; R1 (flows)

SWARM, behind weida's swarm feature, which crates/weida-c enables (swarm.md):

crates/weidaC ABIVerdict
Swarm::connectweida_swarm_connect (op)present; abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others, abi::a_declined_session_leaves_the_fetch_not_connected (swarm)
Swarm::disconnect, peer_count, connection_stats, eventsweida_swarm_disconnect (1 or 0), _peer_count, _connection_stats (a snapshot handle), _events (a weida_peer_events queue)present; abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others (swarm)
Swarm::fetchweida_swarm_fetch (NULL options are the default)present; abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others, abi::a_declined_session_leaves_the_fetch_not_connected (swarm)
Drop for Swarmweida_swarm_droppresent; R1 (swarm)
FetchOptions (list, stall, min_rate, per_peer, max_inflight, max_peers, have_refresh)weida_fetch_options_new, _set_list, _set_stall_ms, _set_min_rate, _set_per_peer, _set_max_inflight, _set_max_peers, _set_have_refresh_ms, _drop (a builder)present; swarm::tests::fetch_options_setters_land_on_their_fields, abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others (swarm)
Fetch::nextweida_fetch_next (try, R3a; a weida_piece, NULL at the end), _fdpresent; abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others, abi::a_declined_session_leaves_the_fetch_not_connected (swarm)
Fetch::blob, list, delivered, in_flight, unavailableweida_fetch_blob, _list (1 and a weida_piece_list, or 0 with NULL), _delivered, _in_flight, _unavailable (weida_bits copies)present; abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others, abi::a_declined_session_leaves_the_fetch_not_connected, abi::a_piece_a_seeder_says_is_gone_is_unavailable_until_another_seeder_serves_it (swarm)
Fetch::prioritize, clear_priorityweida_fetch_prioritize (start, end), _clear_prioritypresent; abi::a_piece_a_seeder_says_is_gone_is_unavailable_until_another_seeder_serves_it (swarm)
Drop for Fetch (aborts every order)weida_fetch_droppresent; R1 (swarm)
Piece (index, bytes)weida_piece (_index, _bytes, _drop)present; abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others (swarm)
Seeder::pathweida_seeder_pathpresent; abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others (swarm)
Seeder::acceptweida_seeder_accept (try, R3a; a weida_seed_session), _fdpresent; abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others, abi::a_declined_session_leaves_the_fetch_not_connected (swarm)
Drop for Seederweida_seeder_droppresent; R1 (swarm)
SeedSession::blob, meta, connectionweida_seed_session_blob, _meta, _connectionpresent; abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others (swarm)
SeedSession::next, Askweida_seed_session_next (try, R3a; 1 with WEIDA_ASK_* and the piece index, 0 at the end), _fdpresent; abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others, abi::a_declined_session_leaves_the_fetch_not_connected (swarm)
SeedSession::answer_list, answer_have, answer_pieceweida_seed_session_answer_list, _answer_have, _answer_piece (ops)present; abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others (swarm)
SeedSession::answer_goneweida_seed_session_answer_gone (op)present; abi::a_piece_a_seeder_says_is_gone_is_unavailable_until_another_seeder_serves_it (swarm)
SeedSession::declineweida_seed_session_decline (op, consumes)present; abi::a_declined_session_leaves_the_fetch_not_connected (swarm)
Drop for SeedSessionweida_seed_session_droppresent; R1 (swarm)
BlobId (from_bytes, as_bytes, of)its 32 bytes (WEIDA_BLOB_ID_LEN), weida_blob_id_ofpresent; blob::tests::a_tree_hashers_list_checks_every_piece_and_matches_the_root, abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others (swarm)
BlobId's Display, FromStr, ParseBlobIdError—refused: hex text of the 32 bytes the caller holds
PieceSize (MIN, MAX, DEFAULT, from_log2, log2)its base-2 logarithm, uint8_t; WEIDA_PIECE_SIZE_MIN_LOG2, _MAX_LOG2, _DEFAULT_LOG2 (asserted at compile time)present; blob::tests::a_tree_hashers_list_checks_every_piece_and_matches_the_root (swarm)
PieceSize::new, bytes—refused: computations over the caller's own values
Blob (new, root, size, piece, count, span)weida_blob_new, _root, _size, _piece_log2, _count, _span, _droppresent; blob::tests::a_tree_hashers_list_checks_every_piece_and_matches_the_root, abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others (swarm)
PieceList (of, parse, blob, to_bytes, check)weida_piece_list_of, _parse, _blob, _to_bytes, _check, _droppresent; blob::tests::a_tree_hashers_list_checks_every_piece_and_matches_the_root, abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others (swarm)
TreeHasher (new, update, finish)weida_tree_hasher_new, _update, _finish (consumes), _droppresent; blob::tests::a_tree_hashers_list_checks_every_piece_and_matches_the_root (swarm)
Bits (new, full, from_bytes, as_bytes, len, get, set, ones, all)weida_bits_new, _full, _from_bytes, _as_bytes (into the caller's buffer), _len, _get, _set, _ones, _all, _droppresent; blob::tests::bits_travel_least_significant_bit_first, abi::a_blob_seeded_by_one_runtime_is_fetched_and_verified_by_two_others (swarm)
Bits::is_empty—refused: weida_bits_len is 0
MAX_PIECES, MAX_PENDING_SESSIONS, SEED_STALL, MIN_RATEWEIDA_MAX_PIECES, WEIDA_MAX_PENDING_SESSIONS, WEIDA_SEED_STALL_MS, WEIDA_MIN_RATE (asserted at compile time)present (swarm)
Seed, Gather—refused: Rust type machinery; the ABI has one handle type per role (decision 3)

8. Interop evidence

The ABI has no second implementation to run against; what proves it is that it is called the way a foreign caller calls it:

  • smoke.c, compiled from weida.h under -std=c11 -Wall -Wextra -Werror, linked with -lweida: a QUIC Req/Rep with a generated identity, a pinned trust, streamed bodies, a content type and a delivery receipt, every wait a timeout-0 call plus weida_poll;
  • the fifty-nine abi:: tests, which call the exports as C does (raw pointers, out-parameters, descriptors, threads, a signal);
  • the Python package crates/py/weida-py, a cffi caller in ABI mode (weida-py.md).

9. Deliberate deviations and bounds

  • take_body twice is -WEIDA_ECLOSED; Rust panics.
  • A collect's max_bytes is uint64_t; above usize::MAX it is usize::MAX.
  • A readiness descriptor costs a socket pair per handle, created on first use (R11).
  • On Windows a blocking wait cannot be interrupted (R4); callers bound their waits.
  • expire_at takes milliseconds from the call (weida_outgoing_transfer_expire_after_ms), because C has no Instant.
  • endpoint_queue 0 is -WEIDA_EINVAL at the setter, where Rust panics at the first queue.
  • An optional value in is negative for None (R7).
  • A count in above usize::MAX becomes usize::MAX (R7).
  • A refusal code outside WEIDA_ERROR_CODE_* is -WEIDA_EINVAL; the request is consumed all the same (R6) and answers NO_REPLY.
  • canceled is an op started from the request, and like Rust's future it outlives it; start it before reply or refuse consumes the request.
  • A duration out is microseconds (_us, R7).
  • connection_stats() is one snapshot handle whose records are read by index; Rust returns a Vec.
  • The end of a peer event stream (None) is a 0 return with *out == NULL, as a read's end is *out_n == 0.
  • ConnectionId is its number (ConnectionId::get).
  • Runtime::drain returns Drained by value; the ABI's op yields it as a weida_drained handle read by two getters. Its deadline is milliseconds (R7) and, as in Rust, mandatory.
  • Handoff::into_parts is two calls: weida_handoff_take_socket hands the descriptor over once, and weida_handoff_bytes lends the held packets for as long as the handoff lives. Dropping a handoff whose socket was not taken closes it.
  • A socket in or out is its descriptor as int64_t: a file descriptor on Unix, a SOCKET on Windows.
  • Binding::hand_over panics in Rust on a binding without an OS socket. The ABI returns -WEIDA_EUNSUPPORTED for a relayed binding and -WEIDA_ECLOSED for one a weida_binding_close was started on, and consumes the binding either way (R6).
  • Binding::disconnect and RelayRequest::peer/target take and give keys as sha256: text.
  • weida_binding_drop releases the handle. As a dropped Rust Binding does, a relayed binding ends with it: its registration at the relay ends without waiting for its connections. Any other binding serves on until weida_binding_close, a hand-over or the runtime's shutdown.
  • bind_unix exists in Rust only on Unix and bind_pipe only on Windows. The ABI exports both everywhere and the other platform's returns -WEIDA_EUNSUPPORTED, so one weida.h serves every platform.
  • A socket path is UTF-8 text (R7); a path that is not UTF-8 cannot be bound through the ABI.
  • LocalPrincipal and WindowsPrincipal are read through four getters on the metadata (weida_incoming_meta_peer_uid, _peer_gid, _peer_pid, _peer_sid), not as values.
  • A Rust parameter that takes a value or a source (impl Into<IdentitySource>, impl Into<TrustSource>) maps twice: the value form keeps its name and copies, the form with the _source suffix takes a weida_identity_source or weida_trust_source and shares it.
  • The fingerprint of an identity source is written into the caller's buffer of WEIDA_FINGERPRINT_LEN + 1 bytes, because it changes under the handle and handle-owned text (R7) could not stay valid.
  • IdentitySource::reload's Result<bool> is 1, 0 or a negative code.
  • WeakIdentitySource::upgrade's and WeakTrustSource::upgrade's None is a 0 return with *out == NULL.
  • The end of an identity event stream (None) is a 0 return with *out == NULL, as for peer events.
  • FilesOptions::poll is milliseconds (_set_poll_ms, R7); a file source's directory is UTF-8 text (R7).
  • A call on a weida_fan_out while its write_within op runs is -WEIDA_EINVAL, where Rust's borrow rules forbid it; finish then consumes the handle and the copies abort when the write ends.
  • Publisher::dropped_on's Option is a snapshot of 0 or 1 record.
  • SurveyRun::next is a try (R3a), as PeerEvents::recv is; a read in flight keeps the max_bytes of the try that started it. Its None is a 0 return with *out == NULL, and an answer that failed returns its code while the run goes on.
  • An answer is a weida_survey_answer (_data, _len), the Vec<u8> Rust returns; it carries no metadata, as in Rust.
  • weida_survey_run_late during a weida_survey_run_next in flight is the count as of the last read that ended.
  • Paired::events' None (a bound pair) is a 0 return with out untouched, as for Binding::relay_events.
  • A deadline_ms the clock cannot add is -WEIDA_EINVAL at weida_surveyor_survey, where Rust panics.
  • Received is a tagged handle, weida_received: weida_received_kind names the variant, weida_received_take_segment hands a stream segment's transfer over once (a second call is -WEIDA_ECLOSED, a datagram -WEIDA_EINVAL), and a datagram's fields are getters that read absent on a stream segment.
  • Radio::evict takes the dish's key as sha256: text, and DishDrops::peer reads as weida_dish_drops_peer_fingerprint, NULL for an anonymous peer or one that proved no key.
  • SegmentTerms::priority is int32_t in; outside int16_t it is -WEIDA_EINVAL.
  • JoinTerms::max_layer is an optional value in (R7); 16 to 255 fail the join with -WEIDA_ELIMIT_EXCEEDED, as in Rust.
  • A segment's calls take its lock in turn, where Rust's &mut self forbids concurrent use.
  • A cursor level is its wire value, uint64_t, in and out; 6 to 15 are -WEIDA_EINVAL (R7), where Rust cannot name them.
  • TransferMeta::with_report takes an array of levels (levels, len); more than 16 distinct fail the send with -WEIDA_ELIMIT_EXCEEDED, as in Rust.
  • OutgoingTransfer::cursors' and IncomingTransfer::reporter's None is a 0 return with *out == NULL.
  • Cursors::changed is a try (R3a), as PeerEvents::recv is; its None is a 0 return with *out == NULL, and so is every recv after it.
  • A call on a weida_reporter while its report op runs is -WEIDA_EINVAL, where Rust's borrow rules forbid it; finish then consumes the handle and the reporter is dropped, unflushed, when the report ends.
  • Reporter::with_granularity's interval is milliseconds (_set_granularity, R7).
  • Incoming is a tagged handle, weida_incoming: weida_incoming_kind names the variant; _take_stream, _take_exchange, _take_subscribed, _take_credit and _take_flow hand a payload over once (a second call is -WEIDA_ECLOSED, another kind -WEIDA_EINVAL); Unsubscribed's id and filter are getters on the handle that read absent on every other kind, as a datagram's fields are on weida_received; dropping it drops what it holds, as Rust does.
  • ConsumerId is its number (ConsumerId::get), equal to its connection's ConnectionId.
  • Peer::send takes its metadata in the one function, NULL for the default, since Rust has no send_with.
  • Peer::segment_drops' Option is a snapshot of 0 or 1 record, as Publisher::dropped_on's.
  • Peer::events is weida_peer_peer_events, because R1 gives weida_peer_events to the reader it returns (PeerEvents).
  • FlowInfo is read through a weida_incoming_meta (weida_incoming_flow_info): its six fields are the metadata's of the same names, and every other getter reads absent.
  • FlowStats is read one counter at a time on the side that fills it, because R1 would name both the type and Flow::stats weida_flow_stats; Rust loads each counter on its own as well. The counters the other side fills are always 0 and are not mapped.
  • IncomingFlow::recv is a try (R3a); its None is a 0 return with *out == NULL, and so is every recv after it.
  • Flow::max_payload's and path_stats' None is a 0 return (R2), with *out == NULL for the snapshot.
  • Flow::abort and IncomingFlow::refuse cannot fail, so they are void and consume their handle (R6).
  • A BlobId is its 32 bytes in and out (WEIDA_BLOB_ID_LEN), written into the caller's buffer; its hex text is the caller's.
  • A PieceSize is its base-2 logarithm, uint8_t, 10 to 24; outside that it is -WEIDA_EINVAL, and Blob::piece reads as weida_blob_piece_log2.
  • The Option of Blob::new, PieceList::of, PieceList::parse, TreeHasher::finish and Bits::from_bytes is -WEIDA_EINVAL with the reason in the record.
  • Swarm::fetch panics in Rust on a have without one bit per piece or a list of another blob; the ABI returns -WEIDA_EINVAL.
  • Fetch::next is a try (R3a); its None is a 0 return with *out == NULL, and so is every read after it.
  • Fetch::list, delivered, in_flight and unavailable are copied into new handles. Where Rust's &mut borrow forbids a call on the fetch while next runs, every fetch accessor of the ABI stops a weida_fetch_next read in flight, takes the fetch back and wakes the reader, whose next call starts the read again: Fetch::next is cancel-safe, so nothing is lost. Fetch::list's None is a 0 return with *out == NULL.
  • Bits::as_bytes copies into the caller's buffer, since another thread may set a bit meanwhile.
  • SeedSession::next is a try (R3a): an order is a 1 return with the WEIDA_ASK_* kind and the piece index (0 for LIST and HAVE), the end a 0 return.
  • A call on a weida_seed_session while its next is in flight or an answer op runs is -WEIDA_EINVAL, where Rust's borrow rules forbid it; decline then consumes the handle and the session is dropped when that answer ends.

10. The definition of done

The plan of this stage asked for the rules, the decision, and one vertical slice: runtime, configuration, TLS values, Req/Rep with streamed bodies, delivery receipts, readiness descriptors and weida_poll, through Rust, the header, a C program, Python and the CI. Every row of §2 to §5 marked present without an area name is that slice, and a present row that names an area was mapped by that area's plan; every absent row names its area, and the slice is complete when no present row lacks a test.

11. Sources

crates/weida-c/src/ (error.rs, ready.rs, try_handle.rs, op.rs, handle.rs, config.rs, cursor.rs, runtime.rs, tls.rs, identity.rs, listener.rs, relay.rs, transfer.rs, requester.rs, push.rs, pubsub.rs, pair.rs, survey.rs, swarm.rs, blob.rs, bus.rs, radio.rs, segment.rs, peer.rs, consumer.rs, flow.rs, poll.rs, stats.rs), crates/weida-c/include/weida.h, crates/weida-c/tests/, crates/weida/src/lib.rs for the reference column, decisions/0045, and docs/c/.