Project
Loading...
Searching...
No Matches
ServiceSpec.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11#ifndef O2_FRAMEWORK_SERVICESPEC_H_
12#define O2_FRAMEWORK_SERVICESPEC_H_
13
16#include <fairmq/FwdDecls.h>
17#include <string>
18#include <functional>
19#include <vector>
20
21namespace fair::mq
22{
23struct ProgOptions;
24}
25
26namespace o2::framework
27{
28
29struct InitContext;
30struct DeviceSpec;
31struct ServiceRegistry;
32struct ServiceRegistryRef;
33struct DeviceState;
34struct ProcessingContext;
35class EndOfStreamContext;
36struct ConfigContext;
37struct WorkflowSpecNode;
38
39struct ServiceMetricsInfo;
40struct DeviceConfig;
41struct DriverServerContext;
42
43class DanglingContext;
44
46using ServiceId = std::function<unsigned int()>;
48using ServiceInit = ServiceHandle (*)(ServiceRegistryRef, DeviceState&, fair::mq::ProgOptions&);
55
59using ServiceConfigureCallback = void* (*)(InitContext&, void*);
60
63
66
69
73using ServicePreFork = std::function<void(ServiceRegistryRef, DeviceConfig const&)>;
74
78
82
85
88
91 ServiceMetricsInfo const&,
92 size_t timestamp);
93
97
100
103
106
109
114
117
120
122using ServiceDomainInfoUpdated = void (*)(ServiceRegistryRef, size_t tileslice, ChannelIndex channel);
123
125using ServicePreSendingMessages = void (*)(ServiceRegistryRef, fair::mq::Parts&, ChannelIndex channel);
126
131
140 std::string name = "please specify name";
144 ServiceInit init = nullptr;
171
175
178
182
184
195
198
201
204
207
210
213
216
218 bool active = true;
219
222};
223
225 std::string name;
226 bool active;
227};
228
229using OverrideServiceSpecs = std::vector<OverrideServiceSpec>;
230using ServiceSpecs = std::vector<ServiceSpec>;
231
233 static OverrideServiceSpecs parseOverrides(char const* overrideString);
234 static ServiceSpecs filterDisabled(ServiceSpecs originals, OverrideServiceSpecs const& overrides);
235};
236
242
248
254
260
266
272
278
284
290
296
302
308
314
320
322 virtual ServiceSpec* create() = 0;
323};
324
325} // namespace o2::framework
326
327#endif // O2_FRAMEWORK_SERVICESPEC_H_
GLuint const GLchar * name
Definition glcorearb.h:781
GLsizei GLenum const void GLuint GLsizei GLfloat * metrics
Definition glcorearb.h:5500
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLuint start
Definition glcorearb.h:469
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< ServiceSpec > ServiceSpecs
std::function< void(ServiceRegistryRef)> ServicePostForkParent
Definition ServiceSpec.h:81
ServiceHandle(*)(ServiceRegistryRef, DeviceState &, fair::mq::ProgOptions &) ServiceInit
A callback to create a given Service.
Definition ServiceSpec.h:48
ServiceKind
The kind of service we are asking for.
void(*)(ServiceMetricsInfo const &metrics) ServiceSummaryHandling
Definition ServiceSpec.h:96
void(*)(WorkflowSpecNode &, ConfigContext const &) ServiceTopologyAdjust
Callback invoked when we amend the topology.
void(*)(ServiceRegistryRef, void *) ServiceStopCallback
A callback invoked whenever we stop running, after the user processing callback.
Definition ServiceSpec.h:52
void(*)(ServiceRegistryRef, DeviceConfig const &) ServicePostSchedule
Callback executed after each redeployment of the whole configuration.
Definition ServiceSpec.h:87
void(*)(ProcessingContext &, void *) ServicePostForwarding
Callback executed in the child after late forwarding happened.
void(*)(ServiceRegistryRef, void *) ServiceExitCallback
A callback invoked whenever we stop running completely, before we exit.
Definition ServiceSpec.h:54
void(*)(ServiceRegistryRef, DeviceConfig const &) ServicePreSchedule
Callback executed before each redeployment of the whole configuration.
Definition ServiceSpec.h:84
void(*)(ServiceRegistryRef, fair::mq::Parts &, ChannelIndex channel) ServicePreSendingMessages
Callback invoked whenever we are about sending a message.
void(*)(ServiceRegistryRef, DeviceConfig const &) ServiceDriverStartup
Callback invoked when the driver enters the init phase.
void(*)(WorkflowSpecNode &, ConfigContext &) ServiceTopologyInject
Callback invoked when we inject internal devices in the topology.
void(*)(EndOfStreamContext &, void *) ServiceEOSCallback
A callback which is executed before the end of stream loop.
Definition ServiceSpec.h:68
std::vector< OverrideServiceSpec > OverrideServiceSpecs
std::function< void(ServiceRegistryRef, DeviceConfig const &)> ServicePreFork
Definition ServiceSpec.h:73
void(*)(ServiceRegistryRef) ServicePostRenderGUI
void *(*)(InitContext &, void *) ServiceConfigureCallback
Definition ServiceSpec.h:59
void(*)(ServiceRegistryRef, size_t tileslice, ChannelIndex channel) ServiceDomainInfoUpdated
Callback invoked whenever we get updated about the oldest possible timeslice we can process.
std::function< unsigned int()> ServiceId
A callback which returns the uniqueId of the service when invoked.
Definition ServiceSpec.h:46
void(*)(ServiceRegistryRef, DeviceConfig const &) ServiceDriverInit
Callback invoked when the driver enters the init phase.
void(*)(ProcessingContext &, void *) ServiceProcessingCallback
A callback which is executed before each processing loop.
Definition ServiceSpec.h:62
void(*)(ProcessingContext &, void *) ServicePostDispatching
Callback executed in the child after dispatching happened.
Definition ServiceSpec.h:99
void(*)(DanglingContext &, void *) ServiceDanglingCallback
A callback which is executed before each dangling input loop.
Definition ServiceSpec.h:65
std::function< void(ServiceRegistryRef)> ServicePostForkChild
Definition ServiceSpec.h:77
void(*)(ServiceRegistryRef, ServiceMetricsInfo const &, size_t timestamp) ServiceMetricHandling
Callback executed in the driver in order to process a metric.
Definition ServiceSpec.h:92
void(*)(ServiceRegistryRef, void *) ServicePreLoop
void(*)(ServiceRegistryRef, void *) ServiceStartCallback
A callback invoked whenever we start running, before the user processing callback.
Definition ServiceSpec.h:50
Running state information of a given device.
Definition DeviceState.h:34
ServiceConfigureCallback callback
ServiceDanglingCallback callback
ServiceDomainInfoUpdated callback
virtual ServiceSpec * create()=0
ServiceProcessingCallback callback
static OverrideServiceSpecs parseOverrides(char const *overrideString)
static ServiceSpecs filterDisabled(ServiceSpecs originals, OverrideServiceSpecs const &overrides)
ServiceDanglingCallback postDangling
Callback executed after the dangling inputs loop.
ServiceExitCallback exit
Callback invoked on exit.
bool active
Active flag. If set to false, the service will not be used by default.
ServiceProcessingCallback preProcessing
Callback executed before actual processing happens.
ServicePostSchedule postSchedule
ServiceInit init
Callback to initialise the service.
ServicePreLoop preLoop
Callback invoked before the loop starts.
ServiceDomainInfoUpdated domainInfoUpdated
Callback invoked when we get updated about the oldest possible timeslice we can process.
ServiceDriverStartup driverStartup
Callback invoked when starting the driver.
ServicePreSchedule preSchedule
Callback executed before and after we schedule a topology.
ServiceDanglingCallback preDangling
Callback executed before the dangling inputs loop.
ServicePostForwarding postForwarding
ServiceConfigureCallback configure
Callback to configure the service.
ServiceStopCallback stop
Callback invoked on Start.
ServiceMetricHandling metricHandling
Callback executed after each metric is received by the driver.
ServiceTopologyInject injectTopology
Callback invoked when doing topology creation.
ServiceSummaryHandling summaryHandling
Callback invoked on the driver quitting.
ServiceEOSCallback preEOS
Callback executed before the end of stream callback of the user happended.
ServicePreSendingMessages preSendingMessages
Callback invoked when we are about sending a message.
ServiceProcessingCallback postProcessing
Callback executed once actual processing happened.
ServicePostRenderGUI postRenderGUI
Callback invoked after the main GUI has been drawn.
ServiceId uniqueId
Callback to get the unique id for the Service.
ServiceProcessingCallback finaliseOutputs
ServicePostDispatching postDispatching
ServiceKind kind
Kind of service being specified.
ServiceTopologyAdjust adjustTopology
Callback invoked when finalising topology creation.
ServicePostForkChild postForkChild
ServiceDriverInit driverInit
Callback invoked on driver entering the INIT state.
ServiceEOSCallback postEOS
Callback executed after the end of stream callback of the user happended.
ServicePostForkParent postForkParent
Callback executed after forking a given device in the driver.
ServiceStartCallback callback