-
Notifications
You must be signed in to change notification settings - Fork 496
Expand file tree
/
Copy pathDeviceState.h
More file actions
84 lines (74 loc) · 2.84 KB
/
DeviceState.h
File metadata and controls
84 lines (74 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef O2_FRAMEWORK_DEVICESTATE_H_
#define O2_FRAMEWORK_DEVICESTATE_H_
#include "Framework/ChannelInfo.h"
#include "Framework/ComputingQuotaOffer.h"
#include <vector>
#include <string>
#include <map>
#include <utility>
typedef struct uv_loop_s uv_loop_t;
typedef struct uv_timer_s uv_timer_t;
typedef struct uv_poll_s uv_poll_t;
typedef struct uv_signal_s uv_signal_t;
namespace o2::framework
{
/// enumeration representing the current state of a given
/// device.
enum struct StreamingState {
/// Data is being processed
Streaming,
/// End of streaming requested, but not notified
EndOfStreaming,
/// End of streaming notified
Idle,
};
/// Running state information of a given device
struct DeviceState {
/// Motivation for the loop being triggered.
enum LoopReason : int {
NO_REASON = 0, // No tracked reason to wake up
METRICS_MUST_FLUSH = 1, // Metrics available to flush
SIGNAL_ARRIVED = 2, // Signal has arrived
DATA_SOCKET_POLLED = 4, // Data has arrived
DATA_INCOMING = 8, // Data was read
DATA_OUTGOING = 16, // Data was written
WS_COMMUNICATION = 32, // Communication over WS
TIMER_EXPIRED = 64, // Timer expired
WS_CONNECTED = 128, // Connection to driver established
WS_CLOSING = 256, // Events related to WS shutting down
WS_READING = 512, // Events related to WS shutting down
WS_WRITING = 1024, // Events related to WS shutting down
ASYNC_NOTIFICATION = 2048
};
std::vector<InputChannelInfo> inputChannelInfos;
StreamingState streaming = StreamingState::Streaming;
bool quitRequested = false;
/// ComputingQuotaOffers which have not yet been
/// evaluated by the ComputingQuotaEvaluator
std::vector<ComputingQuotaOffer> pendingOffers;
/// ComputingQuotaOffers which should be removed
/// from the queue.
std::vector<ComputingQuotaConsumer> offerConsumers;
// The libuv event loop which serves this device.
uv_loop_t* loop = nullptr;
// The list of active timers which notify this device.
std::vector<uv_timer_t*> activeTimers;
// The list of pollers for active input channels
std::vector<uv_poll_t*> activeInputPollers;
// The list of pollers for active output channels
std::vector<uv_poll_t*> activeOutputPollers;
/// The list of active signal handlers
std::vector<uv_signal_t*> activeSignals;
int loopReason = 0;
};
} // namespace o2::framework
#endif