Skip to main content

Module ipc

Module ipc 

Source
Expand description

Aggregation of Flight Recorder events from several contexts of one client over [bitwarden_ipc].

Clients with more than one context (browser popup + background, desktop renderer + main) run one context as the collector and the others as forwarders. Once forwarding is enabled, a forwarder sends captured events to the collector and keeps only events from the IPC stack itself locally, since sending those would loop. The collector stores received events in its own buffer, attributed to the sending process, and answers read requests from its forwarders.

Collectors only accept messages from their own clientโ€™s forwarder endpoint. The browser background also receives IPC traffic from web pages, which must not be able to read or inject events.

Structsยง

FlightRecorderBatch
Events sent from a forwarder to its collector.
ForwarderState ๐Ÿ”’
IpcForwardSink
Sink that forwards events to a collector over IPC.
ReadFlightRecorderHandler ๐Ÿ”’
RPC handler for ReadFlightRecorderRequest, answering only roleโ€™s forwarder.
ReadFlightRecorderRequest
RPC request from a forwarder for the collectorโ€™s events.
ReadFlightRecorderResponse
RPC response for ReadFlightRecorderRequest.
ReadingGuard ๐Ÿ”’
Marks an aggregated read in flight until dropped, including when the read is cancelled.

Enumsยง

FlightRecorderCollectorRole
The context that collects events for its client.
ReadFlightRecorderError
Why the collector refused a ReadFlightRecorderRequest.

Constantsยง

COLLECTOR_WAIT ๐Ÿ”’
How long a forwarder waits for its collector to answer discover before it keeps events local.
DEFAULT_READ_TIMEOUT ๐Ÿ”’
How long an aggregated read waits for the collector when the caller gives no cancellation token.
DISCOVER_RETRY_DELAY ๐Ÿ”’
How long a forwarder waits before asking again when the collectorโ€™s discover answer is an error.
FLUSH_INTERVAL ๐Ÿ”’
How long a flush waits before draining, so events logged close together share one IPC message.
UNFORWARDED_TARGETS ๐Ÿ”’
Target prefixes kept in the forwarderโ€™s local buffer instead of forwarded, as a backstop for events the IPC stack emits outside without_flight_recorder (e.g. from tasks it spawns).

Staticsยง

COLLECTING ๐Ÿ”’
FORWARDER ๐Ÿ”’

Functionsยง

attribute ๐Ÿ”’
collect_batches ๐Ÿ”’
enable_flight_recorder_collection
Make this context the collector for its client, storing events from roleโ€™s forwarders and answering their read requests. Only the first successful call has effect. No-op if the Flight Recorder is disabled.
enable_flight_recorder_forwarding
Make this context a forwarder: send captured events to the collector at destination, except events from the IPC stack itself, which stay in the local buffer.
flush ๐Ÿ”’
is_closed ๐Ÿ”’
process_label ๐Ÿ”’
Process label for events received from source.
read_flight_recorder_aggregated
Read the Flight Recorder events for this client.
release_flush ๐Ÿ”’
End a flush that drained an empty buffer. Returns false if the flush must keep running.
start_collector ๐Ÿ”’
wait_for_collector ๐Ÿ”’
Wait until the collector at destination answers discover. Returns false if the local client cannot subscribe.