api: review link timing additions

This commit is contained in:
DeFiDude committed 2026-08-21 03:03:52 -06:00
1 parent 2ab8fdf22b
commit e49a8b3d88
3 files changed
+78 -24

No files matched your search

+16
View File
@@ -498,7 +498,10 @@ pub fn lxmf_core::link_delivery::LinkDeliveryManager::set_inbound_resource_limit
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_backchannel_delivery(&mut self, lxmf_core::message::LxMessage, [u8; 16]) -> core::result::Result<lxmf_core::link_delivery::BackchannelStartReport, lxmf_core::link_delivery::BackchannelStartFailure>
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_delivery(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8) -> core::result::Result<[u8; 16], lxmf_core::link_delivery::LinkDeliveryStartFailure>
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_delivery_with_report(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8) -> core::result::Result<lxmf_core::link_delivery::DirectLinkStartReport, lxmf_core::link_delivery::LinkDeliveryStartFailure>
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_delivery_with_report_and_timing(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8, lxmf_core::link_delivery::LinkEstablishmentTiming) -> core::result::Result<lxmf_core::link_delivery::DirectLinkStartReport, lxmf_core::link_delivery::LinkDeliveryStartFailure>
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_delivery_with_timing(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8, lxmf_core::link_delivery::LinkEstablishmentTiming) -> core::result::Result<[u8; 16], lxmf_core::link_delivery::LinkDeliveryStartFailure>
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_packed_delivery(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8, alloc::vec::Vec<u8>, bool) -> core::result::Result<[u8; 16], lxmf_core::link_delivery::LinkDeliveryStartFailure>
pub fn lxmf_core::link_delivery::LinkDeliveryManager::start_packed_delivery_with_timing(&mut self, lxmf_core::message::LxMessage, [u8; 16], u8, alloc::vec::Vec<u8>, bool, lxmf_core::link_delivery::LinkEstablishmentTiming) -> core::result::Result<[u8; 16], lxmf_core::link_delivery::LinkDeliveryStartFailure>
pub fn lxmf_core::link_delivery::LinkDeliveryManager::stats(&self) -> lxmf_core::link_delivery::LinkDeliveryStats
pub fn lxmf_core::link_delivery::LinkDeliveryManager::take_backchannel_resource_cancellations(&mut self) -> alloc::vec::Vec<lxmf_core::link_delivery::BackchannelResourceCancelRequest>
pub fn lxmf_core::link_delivery::LinkDeliveryManager::take_delivery_events(&mut self) -> alloc::vec::Vec<lxmf_core::link_delivery::LxmfDeliveryEvent>
@@ -521,6 +524,15 @@ pub lxmf_core::link_delivery::LinkDeliveryStats::pending_backchannel_deliveries:
pub lxmf_core::link_delivery::LinkDeliveryStats::pending_backchannel_starts: usize
pub lxmf_core::link_delivery::LinkDeliveryStats::queued_deliveries: usize
pub lxmf_core::link_delivery::LinkDeliveryStats::sessions: usize
pub struct lxmf_core::link_delivery::LinkEstablishmentTiming
impl lxmf_core::link_delivery::LinkEstablishmentTiming
pub const fn lxmf_core::link_delivery::LinkEstablishmentTiming::first_hop_timeout(self) -> core::time::Duration
pub fn lxmf_core::link_delivery::LinkEstablishmentTiming::from_first_hop_bitrate(u64) -> Self
pub fn lxmf_core::link_delivery::LinkEstablishmentTiming::from_first_hop_bitrate_and_mtu(u64, u32) -> Self
pub const fn lxmf_core::link_delivery::LinkEstablishmentTiming::from_first_hop_timeout(core::time::Duration) -> Self
pub fn lxmf_core::link_delivery::LinkEstablishmentTiming::timeout_for_hops(self, u8) -> core::time::Duration
impl core::default::Default for lxmf_core::link_delivery::LinkEstablishmentTiming
pub fn lxmf_core::link_delivery::LinkEstablishmentTiming::default() -> Self
pub struct lxmf_core::link_delivery::LxmfDeliveryEvent
pub lxmf_core::link_delivery::LxmfDeliveryEvent::attempts: u32
pub lxmf_core::link_delivery::LxmfDeliveryEvent::delivery_state: lxmf_core::link_delivery::DeliveryState
@@ -1414,6 +1426,7 @@ pub fn lxmf_core::router::LxmRouter::set_retain_node_lxms(&mut self, bool)
pub fn lxmf_core::router::LxmRouter::set_stamp_cost(&mut self, [u8; 16], u8)
pub fn lxmf_core::router::LxmRouter::set_stamp_requirements(&mut self, u8, u8)
pub fn lxmf_core::router::LxmRouter::set_transport(&mut self, tokio::sync::mpsc::bounded::Sender<rns_transport::messages::TransportMessage>)
pub fn lxmf_core::router::LxmRouter::state_snapshot(&self) -> lxmf_core::router::RouterStateSnapshot
pub fn lxmf_core::router::LxmRouter::stats(&self) -> lxmf_core::router::RouterStats
pub fn lxmf_core::router::LxmRouter::sync_peer_policies_for_store(&self, u64) -> alloc::vec::Vec<lxmf_core::peer::OutboundOfferPolicy>
pub fn lxmf_core::router::LxmRouter::sync_peers(&mut self) -> alloc::vec::Vec<[u8; 16]>
@@ -1484,6 +1497,9 @@ pub lxmf_core::router::RouterConfigExt::propagation_cost_min: u8
pub lxmf_core::router::RouterConfigExt::retain_synced_on_node: bool
impl core::default::Default for lxmf_core::router::RouterConfigExt
pub fn lxmf_core::router::RouterConfigExt::default() -> Self
pub struct lxmf_core::router::RouterStateSnapshot
impl lxmf_core::router::RouterStateSnapshot
pub fn lxmf_core::router::RouterStateSnapshot::save_state(&self, &std::path::Path) -> core::io::error::Result<()>
pub struct lxmf_core::router::RouterStats
pub lxmf_core::router::RouterStats::peers: usize
pub lxmf_core::router::RouterStats::pending_deferred_stamps: usize
+17 -14
View File
@@ -19,37 +19,40 @@
"sourceCommit": "b8d7afce73f7f098706029361568e63f22888ea3"
},
"snapshotSource": {
"commit": "c934ccc5feaaddb55461404094ed6bb514aae2cc",
"capturedOn": "2026-08-17",
"commit": "2ab8fdf22b55bf18708c7181da5d4e07801e7699",
"capturedOn": "2026-08-21",
"review": {
"areas": [
"message construction and inspection",
"message status and identifiers"
"message status and identifiers",
"owned router persistence snapshots",
"Link establishment timing and timing-aware delivery starts"
],
"canonicalPath": "lxmf_core::message_api",
"retainedPaths": [
"lxmf_core::message",
"lxmf_core::constants",
"lxmf_core::types"
"lxmf_core::types",
"lxmf_core::router",
"lxmf_core::link_delivery"
],
"excludedImplementationAreas": [
"router and delivery ownership",
"propagation and handlers",
"persistence",
"serialized persistence representations",
"raw Reticulum transport channels"
],
"classification": "compatible additive facade",
"classification": "compatible additive facade and provisional integration APIs",
"publicApiDiff": {
"added": 70,
"added": 86,
"removed": 0
},
"semver": "compatible additive facade included in version 1.2.0",
"semver": "compatible additive APIs included in version 1.2.0",
"deprecations": "none",
"wirePersistenceRuntimeImpact": "none; exact re-exports only",
"wirePersistenceRuntimeImpact": "no wire-format or persisted-layout change; exact message re-exports are behavior-neutral, owned router snapshots preserve the existing MessagePack layout, and Link establishment deadlines now follow authoritative first-hop timing while existing start methods remain available with the Reticulum fallback",
"platformEvidence": [
"compiled message example and external canonical and legacy fixtures",
"stable and Rust 1.87 strict Clippy",
"downstream desktop and mobile product gates"
"lxmf-core owned router snapshot and upstream-compatible Link timing unit tests",
"macOS and Ubuntu workspace test jobs for source commit 2ab8fdf22b55bf18708c7181da5d4e07801e7699"
]
}
},
@@ -60,8 +63,8 @@
"tier": "candidate-stable",
"compatibility": "reviewed-snapshot",
"snapshot": "api/snapshots/lxmf-core.txt",
"itemCount": 1622,
"sha256": "c958cfdcb53117b02d1dbe907af6afaf5017d5ba92364267e21d204fe5ef3023"
"itemCount": 1638,
"sha256": "5b59de793250e211cd206c06e8e70147d91e40c45ba1d28fb659a4a354e2fd96"
},
{
"name": "lxmf-tools",
+45 -10
View File
@@ -106,6 +106,37 @@ impl Default for LinkEstablishmentTiming {
}
}
struct LinkDeliveryStartOptions {
timing: LinkEstablishmentTiming,
packed_override: Option<Vec<u8>>,
auto_compress: bool,
reusable: bool,
}
impl LinkDeliveryStartOptions {
fn direct(timing: LinkEstablishmentTiming) -> Self {
Self {
timing,
packed_override: None,
auto_compress: true,
reusable: true,
}
}
fn packed(
timing: LinkEstablishmentTiming,
packed_payload: Vec<u8>,
auto_compress: bool,
) -> Self {
Self {
timing,
packed_override: Some(packed_payload),
auto_compress,
reusable: false,
}
}
}
type InboundResourceAcceptHandler =
Arc<dyn Fn([u8; 16], &ResourceAdvertisement) -> bool + Send + Sync>;
type InboundResourceConcludedHandler = Arc<dyn Fn([u8; 16], [u8; 32]) + Send + Sync>;
@@ -928,10 +959,7 @@ impl LinkDeliveryManager {
message,
dest_hash,
hops,
timing,
Some(packed_payload),
auto_compress,
false,
LinkDeliveryStartOptions::packed(timing, packed_payload, auto_compress),
)
}
@@ -1146,8 +1174,12 @@ impl LinkDeliveryManager {
let msg_hash = message.hash;
let attempts = message.delivery_attempts;
let link_id =
self.start_delivery_inner(message, dest_hash, hops, timing, None, true, true)?;
let link_id = self.start_delivery_inner(
message,
dest_hash,
hops,
LinkDeliveryStartOptions::direct(timing),
)?;
let snapshot = self.direct_link_snapshot(dest_hash);
let report = DirectLinkStartReport {
link_id,
@@ -1183,11 +1215,14 @@ impl LinkDeliveryManager {
message: LxMessage,
dest_hash: [u8; 16],
hops: u8,
timing: LinkEstablishmentTiming,
packed_override: Option<Vec<u8>>,
auto_compress: bool,
reusable: bool,
options: LinkDeliveryStartOptions,
) -> Result<[u8; 16], LinkDeliveryStartFailure> {
let LinkDeliveryStartOptions {
timing,
packed_override,
auto_compress,
reusable,
} = options;
let msg_hash = message.hash;
let (mut link, request_data) = Link::new_initiator(dest_hash, hops);
link.extend_establishment_timeout(timing.first_hop_timeout().as_secs_f64());