Line data Source code
1 : /*
2 : * If not stated otherwise in this file or this component's LICENSE file the
3 : * following copyright and licenses apply:
4 : *
5 : * Copyright 2026 Sky UK
6 : *
7 : * Licensed under the Apache License, Version 2.0 (the "License");
8 : * you may not use this file except in compliance with the License.
9 : * You may obtain a copy of the License at
10 : *
11 : * http://www.apache.org/licenses/LICENSE-2.0
12 : *
13 : * Unless required by applicable law or agreed to in writing, software
14 : * distributed under the License is distributed on an "AS IS" BASIS,
15 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 : * See the License for the specific language governing permissions and
17 : * limitations under the License.
18 : */
19 :
20 : #ifndef FIREBOLT_RIALTO_SERVER_SERVICE_I_PRIVATE_METRICS_SERVICE_H_
21 : #define FIREBOLT_RIALTO_SERVER_SERVICE_I_PRIVATE_METRICS_SERVICE_H_
22 :
23 : #include "ControlCommon.h"
24 : #include "IMetricsCollector.h"
25 : #include "IMetricsCollectorClient.h"
26 : #include "MediaCommon.h"
27 : #include <memory>
28 :
29 : namespace firebolt::rialto::server::service
30 : {
31 : class IPrivateMetricsService
32 : {
33 : public:
34 200 : IPrivateMetricsService() = default;
35 200 : virtual ~IPrivateMetricsService() = default;
36 :
37 : IPrivateMetricsService(const IPrivateMetricsService &) = delete;
38 : IPrivateMetricsService(IPrivateMetricsService &&) = delete;
39 : IPrivateMetricsService &operator=(const IPrivateMetricsService &) = delete;
40 : IPrivateMetricsService &operator=(IPrivateMetricsService &&) = delete;
41 :
42 : /**
43 : * @brief A client has signalled readiness for metrics collection.
44 : *
45 : * Creates a MetricsCollector instance for this client.
46 : *
47 : * @param clientId Unique client identifier.
48 : * @param client Callback interface for requesting samples from the client.
49 : */
50 : virtual void clientReady(int clientId,
51 : const std::shared_ptr<firebolt::rialto::server::IMetricsCollectorClient> &client) = 0;
52 :
53 : /**
54 : * @brief A client has disconnected.
55 : *
56 : * Destroys the MetricsCollector instance associated with this client.
57 : *
58 : * @param clientId The client that disconnected.
59 : */
60 : virtual void clientDisconnected(int clientId) = 0;
61 :
62 : /**
63 : * @brief Process metrics data received from a client.
64 : *
65 : * Routes the data to the appropriate MetricsCollector.
66 : *
67 : * @param clientId The reporting client.
68 : * @param metrics The client-reported metrics data.
69 : */
70 : virtual void reportMetrics(int clientId, const firebolt::rialto::server::ClientMetricsData &metrics) = 0;
71 :
72 : /**
73 : * @brief Notify that a media pipeline's playback state has changed.
74 : *
75 : * Routes to all active MetricsCollector instances.
76 : */
77 : virtual void notifyPlaybackStateChanged(int sessionId, PlaybackState oldState, PlaybackState newState) = 0;
78 :
79 : /**
80 : * @brief Notify that a WebAudio player's state has changed.
81 : *
82 : * Routes to all active MetricsCollector instances.
83 : */
84 : virtual void notifyWebAudioPlayerStateChanged(int handle, WebAudioPlayerState oldState,
85 : WebAudioPlayerState newState) = 0;
86 :
87 : /**
88 : * @brief Notify that the application has entered a new state.
89 : *
90 : * Derives the previous state from service-owned history and routes the
91 : * transition to all active MetricsCollector instances.
92 : */
93 : virtual void notifyApplicationStateChanged(ApplicationState newState) = 0;
94 : };
95 : } // namespace firebolt::rialto::server::service
96 :
97 : #endif // FIREBOLT_RIALTO_SERVER_SERVICE_I_PRIVATE_METRICS_SERVICE_H_
|