barrel_p2p_path_stats (barrel_p2p v0.1.0)

View Source

Summary

Functions

Resolve a peer node to the underlying QUIC connection pid. Used by summary/1 here and by barrel_p2p:migrate_peer/1,2 for RFC 9000 §9 path migration. Returns {error, not_connected} if there is no current dist channel; {error, no_conn} if the controller is alive but the connection extraction fails.

Smoothed RTT in microseconds, or {error, _} if unavailable.

Return the full path-stats map for Node. Returns {error, not_connected} if there is no current dist connection.

Types

summary/0

-type summary() ::
          #{srtt => non_neg_integer(),
            latest_rtt => non_neg_integer(),
            min_rtt => non_neg_integer(),
            rtt_var => non_neg_integer(),
            cwnd => non_neg_integer(),
            bytes_in_flight => non_neg_integer(),
            in_recovery => boolean(),
            congested => boolean()}.

Functions

connection(Node)

-spec connection(node()) -> {ok, pid()} | {error, term()}.

Resolve a peer node to the underlying QUIC connection pid. Used by summary/1 here and by barrel_p2p:migrate_peer/1,2 for RFC 9000 §9 path migration. Returns {error, not_connected} if there is no current dist channel; {error, no_conn} if the controller is alive but the connection extraction fails.

srtt(Node)

-spec srtt(node()) -> {ok, non_neg_integer()} | {error, term()}.

Smoothed RTT in microseconds, or {error, _} if unavailable.

summary(Node)

-spec summary(node()) -> {ok, summary()} | {error, term()}.

Return the full path-stats map for Node. Returns {error, not_connected} if there is no current dist connection.

NB: quic_dist:get_controller/1 returns the dist controller gen_statem, not the underlying QUIC connection. quic:get_path_stats/1 expects the connection. Until upstream exposes a get-path-stats wrapper on the dist controller itself, we extract the conn pid by inspecting the controller's gen_statem state. The accessor is structurally defensive: it first tries the known field position, then falls back to probing every pid in the state tuple with a test call to quic:get_path_stats/1.