refactor(core): make local constants crate-private
Decision K (spec §5): the local capacities and timings are defaults that will become configuration, so they are `pub(crate)`. The wire constants stay public. - MAX_PEERS, SUMMARY_INTERVAL_MS, REASSEMBLY_TIMEOUT_MS, SEND_QUEUE_CAP, MIN_MTU, EVENT_QUEUE_CAP, DROP_TABLE_CAP, BCAST_SENT_CAP, ACK_BUFFER_CAP and PEER_IDLE_MS are now `pub(crate)`; a compile_fail doctest pins it. - MIN_MTU's doc claimed it was the floor below which a fragment has no room. It is only the frag sweep's lower bound (BLE ATT's 23). The real floors are now stated on `Transport::mtu` and pinned by `consts::tests::mtu_floors`: 85 to carry every valid observation, 66 to fragment at all, 35 for an Ack, 26 for a summary. - tines-bt caps live connections with its own MAX_PEERS (8). - tines-sim's props mirror MAX_PEERS/SEND_QUEUE_CAP, checked against core through the hidden `conformance` module; the fuzz twin reads it there. - node.rs: drain_events' rustdoc no longer links the now-private consts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,12 +23,28 @@
|
||||
//! addressed candidate a turn. Pins §6's overflow-safety guarantee.
|
||||
|
||||
use proptest::prelude::*;
|
||||
use tines_core::{
|
||||
consts::{MAX_PEERS, SEND_QUEUE_CAP},
|
||||
FrameBuf, Store,
|
||||
};
|
||||
use tines_core::{FrameBuf, Store};
|
||||
use tines_sim::{CappedStore, Contact, ContactTrace, Sim, WorldConfig};
|
||||
|
||||
/// Mirrors tines-core's peer-table capacity, a crate-private local constant
|
||||
/// since 1.0 (decision K). `local_caps_match_core` checks the mirror.
|
||||
const MAX_PEERS: usize = 8;
|
||||
|
||||
/// Mirrors tines-core's send-queue / bounce-table capacity, a crate-private
|
||||
/// local constant since 1.0 (decision K). `local_caps_match_core` checks the
|
||||
/// mirror.
|
||||
const SEND_QUEUE_CAP: usize = 256;
|
||||
|
||||
/// The mirrored local caps still equal core's. Runs with the `conformance`
|
||||
/// feature (as `scripts/ci.sh` does), which exposes core's values through its
|
||||
/// hidden `conformance` module.
|
||||
#[cfg(feature = "conformance")]
|
||||
#[test]
|
||||
fn local_caps_match_core() {
|
||||
assert_eq!(MAX_PEERS, tines_core::conformance::MAX_PEERS);
|
||||
assert_eq!(SEND_QUEUE_CAP, tines_core::conformance::SEND_QUEUE_CAP);
|
||||
}
|
||||
|
||||
/// A fixed set of short observation topics the tests reuse so the generated
|
||||
/// observations round-trip cleanly through the core (`MAX_TOPIC` is 64 bytes).
|
||||
const TOPICS: [&[u8]; 8] = [
|
||||
@@ -166,7 +182,7 @@ fn addressed_scenario() -> impl Strategy<Value = (usize, usize, ContactTrace)> {
|
||||
/// graph plus a flood of distinct addressed observations past [`SEND_QUEUE_CAP`].
|
||||
#[derive(Debug)]
|
||||
struct BounceScenario {
|
||||
/// Node count (fixed at [`consts::MAX_PEERS`]).
|
||||
/// Node count (fixed at [`MAX_PEERS`]).
|
||||
nodes: usize,
|
||||
/// Fully-connected trace: every pair in contact during one long window.
|
||||
trace: ContactTrace,
|
||||
|
||||
Reference in New Issue
Block a user