Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
value_channel_telemetry_broker.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <chrono>
7#include <cstddef>
8#include <cstdint>
9#include <functional>
10#include <memory>
11#include <string_view>
12
13namespace pulp::inspect {
14
19 public:
20 using Clock = std::function<std::chrono::steady_clock::time_point()>;
23
24 struct Config {
25 double default_rate_hz = 15.0;
26 double max_rate_hz = 60.0;
27 std::size_t max_channels = 32;
28 std::size_t max_vector_values = 512;
29 std::size_t max_events_per_channel = 128;
30 std::size_t max_wire_bytes = 64u * 1024u;
31 std::chrono::milliseconds stale_after = std::chrono::milliseconds(500);
32 };
33
35 explicit ValueChannelTelemetryBroker(Config config, Clock clock = {});
41
44
54
58 const InspectorMessage& request);
59
61 void poll();
62 void disconnect(std::string_view client_id);
63 std::size_t subscription_count() const noexcept;
64 std::uint64_t source_generation() const noexcept;
65
66 private:
67 struct Impl;
68 std::unique_ptr<Impl> impl_;
69};
70
71} // namespace pulp::inspect
Exclusive reader attachment for every telemetry sidecar in one channel set.
Definition value_channel_telemetry.hpp:88
void poll()
Drain the attachment once and emit every due subscription.
ValueChannelTelemetryBroker(Config config, Clock clock={})
InspectorEventRetirementSink EventRetirementSink
Definition value_channel_telemetry_broker.hpp:22
void disconnect(std::string_view client_id)
std::size_t subscription_count() const noexcept
void set_event_retirement_sink(EventRetirementSink sink)
InspectorTargetedEventSink EventSink
Definition value_channel_telemetry_broker.hpp:21
std::function< std::chrono::steady_clock::time_point()> Clock
Definition value_channel_telemetry_broker.hpp:20
ValueChannelTelemetryBroker(ValueChannelTelemetryBroker &&) noexcept
InspectorMessage handle(const InspectorRequestContext &context, const InspectorMessage &request)
Handle Telemetry.getSnapshot, Telemetry.subscribe, or Telemetry.unsubscribe.
void replace_with_empty_source()
Record a source generation whose catalog is intentionally empty without retaining a reader attachment...
bool replace_attachment(view::ValueChannelTelemetryAttachment attachment)
Replace the sole-reader attachment.
std::uint64_t source_generation() const noexcept
Definition agent_context.hpp:7
std::function< InspectorTargetedEventResult( std::string_view client_id, const InspectorMessage &event, std::string_view loss_owner)> InspectorTargetedEventSink
Definition inspector_delivery.hpp:31
std::function< void( std::string_view client_id, std::string_view loss_owner)> InspectorEventRetirementSink
Definition inspector_delivery.hpp:33
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
STL namespace.
A single inspector protocol message (request, response, or event).
Definition protocol.hpp:18
Authenticated transport identity attached to a domain request.
Definition inspector_delivery.hpp:11
Definition value_channel_telemetry_broker.hpp:24
std::chrono::milliseconds stale_after
Definition value_channel_telemetry_broker.hpp:31
double max_rate_hz
Definition value_channel_telemetry_broker.hpp:26
std::size_t max_events_per_channel
Definition value_channel_telemetry_broker.hpp:29
double default_rate_hz
Definition value_channel_telemetry_broker.hpp:25
std::size_t max_channels
Definition value_channel_telemetry_broker.hpp:27
std::size_t max_vector_values
Definition value_channel_telemetry_broker.hpp:28
std::size_t max_wire_bytes
Definition value_channel_telemetry_broker.hpp:30
Source-compatible spelling of <pulp/dataplane/value_channel_telemetry.hpp>.