Files
tines/tines-core/src/consts.rs
T
kyle fafda104ea feat(core): ack send path with custody/broadcast buffers
Buffer pending acks (acks for addressed, bcast_acks for broadcast,
ACK_BUFFER_CAP=256, overflow drops oldest), skip a released-duplicate
offer in accept(), and emit Ack frames in next_frame after a due summary
and before addressed/broadcast traffic, draining up to ACK_IDS_CAP ids
per destination and splitting across frames to fit mtu.

Release custody on an Ack only when the Ack confirms delivery to the
intended recipient: an Ack from a peer that merely holds an
epidemic-forwarded copy no longer releases custody, so the local copy
stays available to forward toward the recipient once the only contact to
it closes.
2026-10-18 11:21:49 -07:00

48 lines
1.6 KiB
Rust

//! Compile-time constants for the tines workspace.
//!
//! Every value here is a compile-time `const` so it can drive generic
//! parameters (e.g. `heapless::Vec` capacities) and be optimized away.
/// Maximum topic length in bytes.
pub const MAX_TOPIC: usize = 64;
/// Maximum payload length in bytes.
pub const MAX_PAYLOAD: usize = 1024;
/// Maximum number of peers a node tracks.
pub const MAX_PEERS: usize = 8;
/// Maximum size, in bytes, of a per-key summary.
pub const SUMMARY_BYTES: usize = 512;
/// Number of hash functions used by the per-key Bloom filter.
pub const BLOOM_K: usize = 3;
/// Interval, in milliseconds, between summary emissions.
pub const SUMMARY_INTERVAL_MS: u64 = 2000;
/// Timeout, in milliseconds, for inbound frame reassembly.
pub const REASSEMBLY_TIMEOUT_MS: u64 = 5000;
/// Maximum number of frames buffered for outbound delivery.
pub const SEND_QUEUE_CAP: usize = 256;
/// Maximum UDP frame size in bytes.
pub const MAX_FRAME: usize = 1500;
/// Maximum number of content-IDs an `Ack` receipt may carry.
pub const ACK_IDS_CAP: usize = 90;
/// Cap on the `Exchange` `events` queue of `ConfidenceEvent`s (one per
/// broadcast id a peer has confirmed).
pub const EVENT_QUEUE_CAP: usize = 64;
/// Cap on the `Exchange` per-peer `bcast_sent` table of broadcast ids
/// dispatched to a peer.
pub const BCAST_SENT_CAP: usize = 256;
/// Cap on the number of pending ack ids (`acks` for addressed, `bcast_acks`
/// for broadcast) buffered before the next Ack is emitted. Overflow drops
/// the oldest pending entry.
pub const ACK_BUFFER_CAP: usize = 256;