Skip to content

timed_graph_update_queue

Queue of graph updates with automatic expiration based on age.

Classes:

GraphUpdateStamped dataclass

GraphUpdateStamped(
    receive_timestamp_s: float, u: GraphUpdate
)

A graph update with its receive timestamp.

Attributes:

  • receive_timestamp_s (float) –

    Monotonic timestamp when the update was received.

  • u (GraphUpdate) –

    The graph update message.

TimedGraphUpdateQueue dataclass

TimedGraphUpdateQueue(
    timeout: timedelta,
    _graph_updates: list[GraphUpdateStamped] = list(),
)

Queue of graph updates with automatic expiration based on age.

Maintains updates sorted by arrival time and limited to a maximum age. Can be used to instantiate a SyncGraph of the system state in the last timeout seconds.

Attributes:

  • timeout (timedelta) –

    Maximum age of graph updates kept in the queue.

Methods:

  • push

    Adds a graph update to the queue, timestamped with the current monotonic time.

updates property

updates: list[GraphUpdate]

Returns a list of graph updates, sorted by arrival time, and limited to timeout age.

When called, also drops expired updates.

push

push(u: GraphUpdate)

Adds a graph update to the queue, timestamped with the current monotonic time.

Parameters: