forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChannelInfo.h
More file actions
105 lines (92 loc) · 3.15 KB
/
ChannelInfo.h
File metadata and controls
105 lines (92 loc) · 3.15 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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_CHANNELINFO_H_
#define O2_FRAMEWORK_CHANNELINFO_H_
#include "Framework/RoutingIndices.h"
#include "Framework/TimesliceSlot.h"
#include <string>
#include <fairmq/Parts.h>
#include <fairmq/FwdDecls.h>
namespace o2::framework
{
enum struct InputChannelState {
/// The channel is actively receiving data
Running,
/// The channel was paused
Paused,
/// The channel was signaled it will not receive any data
Completed,
/// The channel can be used to retrieve data, but it
/// will not send it on its own.
Pull
};
enum struct ChannelAccountingType {
/// A channel which was not explicitly set
Unknown,
/// The channel is a normal input channel
DPL,
/// A raw FairMQ channel which is not accounted by the framework
RAWFMQ
};
/// This represent the current state of an input channel. Its values can be
/// updated by Control or by the by the incoming flow of messages.
struct InputChannelInfo {
InputChannelState state = InputChannelState::Running;
uint32_t hasPendingEvents = 0;
bool readPolled = false;
fair::mq::Channel* channel = nullptr;
fair::mq::Parts parts;
/// Wether we already notified operations are normal.
/// We start with true given we assume in the beginning
/// things are ok.
bool normalOpsNotified = true;
/// Wether we aready notified about backpressure.
/// We start with false since we assume there is no
/// backpressure to start with.
bool backpressureNotified = false;
ChannelIndex id = {-1};
/// Wether its a normal channel or one which
ChannelAccountingType channelType = ChannelAccountingType::DPL;
/// Oldest possible timeslice for the given channel
TimesliceId oldestForChannel;
int pollerIndex = -1;
};
struct SendingPolicy;
struct ForwardingPolicy;
/// Output channel information
struct OutputChannelInfo {
std::string name = "invalid";
ChannelAccountingType channelType = ChannelAccountingType::DPL;
fair::mq::Channel& channel;
SendingPolicy const* policy;
ChannelIndex index = {-1};
};
struct OutputChannelState {
TimesliceId oldestForChannel = {0};
// How many times sending on this channel failed
int64_t droppedMessages = 0;
};
/// Forward channel information
struct ForwardChannelInfo {
/// The name of the channel
std::string name = "invalid";
/// Wether or not it's a DPL internal channel.
ChannelAccountingType channelType = ChannelAccountingType::DPL;
fair::mq::Channel& channel;
ForwardingPolicy const* policy;
ChannelIndex index = {-1};
};
struct ForwardChannelState {
TimesliceId oldestForChannel = {0};
int64_t droppedMessages = 0;
};
} // namespace o2::framework
#endif // O2_FRAMEWORK_CHANNELINFO_H_