Files

6.5 KiB

Migrating to rsReticulum 1.3

Version 1.3 combines two discovery API changes since the published 1.2 release: owned recursive discovery operations and independently optional interface coordinates. Both changes belong to this release.

This project's version convention permits breaking Rust APIs in a minor release. Version 1.3 is not source-compatible with direct mutation of the 1.2 discovery map. Cargo's default caret requirement "1.2" permits 1.3; use an explicit compatible line (for example "~1.3.0") or an exact reviewed Git revision. Existing external dependency requirements cannot be changed retroactively. Packet, signature, RPC, and AutoInterface port formats remain unchanged.

Normal applications keep runtime request_path, finite destination resolution and PathRecoveryHandle. They do not need this advanced actor API.

Advanced synchronous actor owners

Before Supported replacement
Read actor.discovery_path_requests[&destination] actor.discovery_path_request(&destination) returns an optional detached snapshot
Iterate the public map actor.discovery_path_requests() returns snapshots sorted by destination
Read one requesting_interface Iterate snapshot.requesters() and read each token's interface_id()
Read timeout snapshot.deadline() is the original absolute Unix-seconds expiry
Insert a record to participate in recursive discovery actor.request_recursive_discovery(destination, interface) validates admission and starts/joins the one bounded search
Remove/edit a record to cancel one requester actor.cancel_discovery_requester(token) removes only that registration
Copy/extend a deadline Clone a snapshot for observation; callers cannot renew an existing operation

actor::DiscoveryPathRequest remains an import path, re-exporting the type in path_discovery. Its public fields and Copy contract are removed deliberately. The old single-requester shape could silently discard other registrations when edited. Keeping a mutable compatibility mirror would retain that defect.

One operation admits at most 64 distinct requester channel generations; the actor admits at most 1,024 destinations. Repeated joins of the same registration return the same token without a new fanout or deadline. Requester identity is an interface generation, not a count of individual people sharing one radio.

Snapshots are not live views. A removed first requester disappears from new snapshots while other requesters remain. Offline but still registered/open requesters may remain waiting; no response is sent while they are offline. Expiry and interface replacement are checked without requiring a prior tick.

Tokens are opaque and actor/operation/registration-specific. Cloning or dropping one does not change ownership. Cancellation is explicit and cannot act on a new operation, a cancelled-and-rejoined requester, another actor, or a replacement channel that reused the numeric ID. Cancelling the last waiter removes related unadmitted search bytes; cancellation cannot recall transmitted bytes.

The advanced request API requires transport forwarding, an unknown nonlocal destination, and an available normal interface with eligible discovery policy. Typed errors distinguish policy, availability and capacity failures. It uses normal ingress/egress limits and a new wire tag only for a newly started search. DiscoveryAdmission::started() is local ownership/fanout intent, not a radio or delivery receipt. Driver backpressure and network loss still require normal caller policy. Normal runtime lookups should not use recursive actor control.

Use the compiled external fixture's recursive_discovery module as an example. No shared IPC/JNI or application UI is added by this change. Package stability classifications remain provisional; the compatibility gate records exactly the approved removals and continues rejecting unrelated API loss.

Interface discovery coordinates

The six public latitude, longitude, and height fields in DiscoveryInfo and DiscoveryInterfaceConfig change from f64 to Option<f64>, including the re-export of DiscoveryInterfaceConfig from rns_transport::discovery.

Unknown coordinates are None; known coordinates, including zero, are Some. The components are independent, so a known latitude and longitude do not imply a known height. Default and discovery convenience constructors leave them unknown. Update struct literals and assignments accordingly:

// Before
config.latitude = 0.0;
config.longitude = -105.0;
config.height = 0.0;

// After: latitude is genuinely zero; height is unknown.
config.latitude = Some(0.0);
config.longitude = Some(-105.0);
config.height = None;

Consumers should match the options or use if let Some(value) when displaying or using a component. Do not use unwrap_or(0.0) to turn an unknown location into a real map position. This change does not add new coordinate range rules.

Wire, configuration, and storage

The discovery map retains its existing keys. An unknown component is encoded as MessagePack nil, matching Python Reticulum; a known component remains a number. Missing configuration leaves a component unknown, while an explicit zero remains known. Existing configuration key precedence and units are retained. No new wire protocol version or storage directory is required.

The Rust decoder continues accepting integer coordinates and missing coordinate keys as a leniency: integers become Some, and missing values become None. Those forms are not a claim of strict Python validation parity. Valid Python nil, partial-coordinate, and floating-point records are supported.

Existing numeric discovery records remain numeric on disk reload. Old stored zero cannot reveal whether it was deliberately configured or produced by the previous defaulting behavior, so it is preserved as Some(0.0). A fresh valid announcement can replace it. Records containing nil or absent location keys load as None. Downgrading to older Rust versions loses this distinction: those versions coerce stored unknown components to zero.

rnstatus-rs represents unknown components as JSON null; text output uses presence instead of treating zero as absent. This does not change an embedding application's separate map display or location-sharing policy.

The historical API compatibility floor is retained. The exact removal ledger contains three recursive-ownership paths and nine coordinate paths for six fields because three are also re-exported. No unrelated removals are authorized.