Skip to main content

Module ldm_maintenance

Module ldm_maintenance 

Source
Expand description

LDM maintenance — background garbage-collection and subscription firing.

LdmMaintenance::spawn starts a 1 Hz thread that:

  1. Removes expired records (past their time_validity_s window).
  2. Removes records outside the local station’s maintenance area (using correct Haversine distance — fixes the Python Euclidean bug).
  3. Calls LdmService::fire_subscriptions to deliver periodic push notifications to all active subscribers.

The maintenance area centre can be updated dynamically via AreaCenter::update, e.g. from GPS fixes, so the LDM always tracks the local station’s current position.

The thread holds only Arc handles; it exits cleanly when all owners of LdmService have been dropped (the Arc reference count reaches zero and fire_subscriptions becomes a no-op on the last cycle before the Arc upgrade returns None).

Structs§

AreaCenter
Thread-safe, dynamically updatable maintenance area centre.
LdmMaintenance
LDM maintenance controller.