-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathdcs.proto
More file actions
285 lines (254 loc) · 11.5 KB
/
dcs.proto
File metadata and controls
285 lines (254 loc) · 11.5 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
/*
* === This file is part of ALICE O² ===
*
* Copyright 2020-2021 CERN and copyright holders of ALICE O².
* Authors: Teo Mrnjavac <teo.mrnjavac@cern.ch>
* Ombretta Pinazza <ombretta.pinazza@cern.ch>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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.
*/
syntax = "proto3";
package dcs;
option java_package = "ch.cern.alice.dcs";
option go_package = "github.com/AliceO2Group/Control/core/integration/dcs/protos;dcspb";
//////////////////////////////////////////////////////
service Configurator {
// Optional call, legal at any time, to subscribe to all future events from
// the DCS service. The server stops serving the stream when the client closes
// it. Multiple concurrent stream subscriptions are allowed.
rpc Subscribe (SubscriptionRequest) returns (stream Event) {}
// Single PFR request for a data taking session, with per-detector parameters.
// Returns an event stream which returns subsequent intermediate states within
// the PFR operation. Upon PFR completion (DetectorState.RUN_OK), the server
// closes the stream.
rpc PrepareForRun (PfrRequest) returns (stream RunEvent) {}
// Single SOR request for a data taking session, with run number.
// Returns an event stream which returns subsequent intermediate states within
// the SOR operation. Upon SOR completion (DetectorState.RUN_OK), the server
// closes the stream.
// If the DetectorOperationRequest or run type parameters are the same as the
// last PrepareForRun request (no matter how far back in time) and the DCS
// state hasn't changed, the SOR operations should be fast. Otherwise, the SOR
// also implicitly includes any number of PrepareForRun operations as needed,
// this can take a while but should not change the overall behavior reported
// to ECS.
rpc StartOfRun (SorRequest) returns (stream RunEvent) {}
// Single EOR request for a data taking session, with per-detector parameters.
// Returns an event stream which returns subsequent intermediate states within
// the EOR operation. Upon EOR completion (DetectorState.RUN_OK), the server
// closes the stream.
rpc EndOfRun (EorRequest) returns (stream RunEvent) {}
// Optional call, legal at any time, to query the status of the DCS service
// and either some or all of its constituent detectors. This call returns a
// single value (not a stream), reflecting the service state at that
// specific moment.
rpc GetStatus (StatusRequest) returns (StatusReply) {}
}
//////////////////////////////////////////////////////
// Message definitions
//////////////////////////////////////////////////////
// Note that all fields are optional in Proto3, so some might arrive empty from the
// client. See the gRPC documentation for language-specific default values.
//////////////////////////////////////////////////////
// Common structures
//////////////////////////////////////////////////////
// A DetectorInfo is a full status report for a single detector, multiple such
// payloads are then aggregated in a StatusReply or Subscribe Event.
message DetectorInfo {
Detector detector = 1; // 1 detector per DetectorInfo
DetectorState state = 2;// state of this detector at the time of response generation
string timestamp = 3; // time when the detector state is as declared
repeated RunType allowedRunTypes = 4; // a list of run types that are currently
// possible with the given detector, taking into
// account all low-level information;
// for example, at a given moment TECHNICAL
// runs might be possible but not PHYSICS
DetectorState pfrAvailability = 5; // availability of this detector for PFR at the time of response generation
DetectorState sorAvailability = 6; // availability of this detector for SOR at the time of response generation
}
//////////////////////////////////////////////////////
// Subscribe call
//////////////////////////////////////////////////////
message SubscriptionRequest {
string instanceId = 1;
}
// The Subscribe response stream returns Event payloads:
// 1) as needed, Events of type ERROR_EVENT, TIMEOUT, etc. when something unexpected
// happens, especially outside of a SOR or EOR operation (which are already served
// by operation-specific streams)
// 2) periodically, Events of type HEARTBEAT with a full detectorMatrix to republish
// the full status of all detectors in the system
// 3) as needed, Events of type STATE_CHANGE_EVENT and similar, with a partial
// detectorMatrix that only reflects the changes in some detectors, usually when
// the internal state of a detector has changed on the DCS side in some way that
// makes a new RunType possible, or that inhibits a RunType that was previously
// possible and now isn't any more.
message Event {
EventType eventtype = 1; // type of event being published by the DCS service
repeated DetectorInfo detectorMatrix = 2; // detector-specific status payloads (optional depending
// on event type)
map<string, string> extraParameters = 3; // general key-value map just in case
string timestamp = 4; // this corresponds to the moment where this Event-answer
// was valid from the source
string message = 5; // optional user-facing error message, if the DCS wants to
// report an ECS-related error status (e.g. the reason for
// a failed SOR) to the user
}
//////////////////////////////////////////////////////
// PFR/SOR/EOR calls
//////////////////////////////////////////////////////
// Each PfrRequest/SorRequest/EorRequest contains multiple DetectorOperationRequests, one per detector.
// This is needed in order to pass per-detector parameters within a single PFR/SOR/EOR operation.
message DetectorOperationRequest {
Detector detector = 1;
map<string, string> extraParameters = 2; // detector-specific parameters
// may include ddl_list or cluster_sum (the latter only for MCH)
}
// A PfrRequest encapsulates a list of detector-specific request payloads,
// plus a common runType any future runs.
message PfrRequest {
repeated DetectorOperationRequest detectors = 1;
RunType runType = 2; // default: NULL_RUNTYPE, should probably never be sent
string partitionId = 3; // unique id for a pfr request
}
// A SorRequest encapsulates a list of detector-specific request payloads,
// plus a common runType and a runNumber for the run about to start.
message SorRequest {
repeated DetectorOperationRequest detectors = 1;
RunType runType = 2; // default: NULL_RUNTYPE, should probably never be sent
int32 runNumber = 3;
}
// An EorRequest encapsulates a list of detector-specific request payloads,
// plus a runNumber to identify the run being stopped.
message EorRequest {
repeated DetectorOperationRequest detectors = 1;
int32 runNumber = 2;
}
// A stream of Event objects is returned by PFR, SOR and EOR calls.
// Most fields are optional and filled as needed, depending on the type of request.
message RunEvent {
EventType eventtype = 1; // type of event being published by the DCS service
Detector detector = 2; // detector that produced the event
DetectorState state = 3; // aggregate state for all detectors involved in current
// PFR/SOR/EOR operation
map<string, string> extraParameters = 4;
string timestamp = 5;
string message = 6; // optional user-facing error message, if the DCS wants to
// report an ECS-related error status (e.g. the reason for
// a failed SOR) to the user
}
//////////////////////////////////////////////////////
// GetStatus call
//////////////////////////////////////////////////////
// Payload for the GetStatus call, just a list of detectors to query.
message StatusRequest {
repeated Detector detector = 1;
// If the client sends this request with empty detector list, the server should return
// the status of all detectors.
}
// Aggregate response to a GetStatus call, wraps around a list of DetectorInfo
// payloads.
message StatusReply {
repeated DetectorInfo detectorMatrix = 1; // an exhaustive list of DetectorInfos
// one for each detector
}
//////////////////////////////////////////////////////
// Enum definitions
//////////////////////////////////////////////////////
enum EventType {
NULL_EVENT = 0;
HEARTBEAT = 1;
STATE_CHANGE_EVENT = 2;
ERROR_EVENT = 3;
ACK_EVENT = 4;
SOR_EVENT = 20;
EOR_EVENT = 30;
EVENT_TIMEOUT = 40;
PFR_EVENT = 50;
}
enum Detector {
NULL_DETECTOR = 0;
reserved 1; // CPV was removed during YETS 2024-2025
EMC = 2;
FDD = 3;
FT0 = 4;
FV0 = 5;
ITS = 6;
HMP = 7;
MCH = 8;
MFT = 9;
MID = 10;
reserved 11; // PHS was removed during YETS 2024-2025
TOF = 12;
TPC = 13;
TRD = 14;
ZDC = 15;
LHC = 16;
DCS = 17;
AGD = 18;
}
enum DetectorState {
NULL_STATE = 0;
READY = 1;
RUN_OK = 2;
RUN_FAILURE = 3;
RUN_INHIBIT = 4;
SOR_PROGRESSING = 5;
EOR_PROGRESSING = 6;
SOR_FAILURE = 7;
EOR_FAILURE = 8;
ERROR = 9;
DEAD = 10;
SOR_UNAVAILABLE = 11;
EOR_UNAVAILABLE = 12;
PREPARING = 13;
SOR_AVAILABLE = 14;
EOR_AVAILABLE = 15;
PFR_AVAILABLE = 16;
PFR_UNAVAILABLE = 17;
TIMEOUT = 18;
}
enum RunType {
NULL_RUNTYPE = 0;
PHYSICS = 1;
TECHNICAL = 2;
PEDESTALS = 3;
PULSER = 4;
LASER = 5;
CALIBRATION_ITHR_TUNING = 6;
CALIBRATION_VCASN_TUNING = 7;
CALIBRATION_THR_SCAN = 8;
CALIBRATION_DIGITAL_SCAN = 9;
CALIBRATION_ANALOG_SCAN = 10;
CALIBRATION_FHR = 11;
CALIBRATION_ALPIDE_SCAN = 12;
reserved 13 to 15; // CALIBRATION, COSMICS, SYNTHETIC
NOISE = 16;
CALIBRATION_PULSE_LENGTH = 17;
CALIBRATION_VRESETD = 18;
reserved 19 to 299;
ANY = 300;
}
enum TriggerMode { // FIXME: unused
CONTINUOUS = 0;
TRIGGERED = 1;
}
enum SorMode { // FIXME: unused
FULL = 0;
FAST = 1;
}