ifw-daq  3.0.0-pre2
IFW Data Acquisition modules
daqController.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @ingroup daq_common_libdaq
4  * @copyright 2022 ESO - European Southern Observatory
5  *
6  * @brief Contains declaration for for DaqController
7  */
8 #ifndef OCF_DAQ_DAQ_CONTROLLER_HPP_
9 #define OCF_DAQ_DAQ_CONTROLLER_HPP_
10 #include "config.hpp"
11 
12 #include <chrono>
13 #include <iostream>
14 #include <string>
15 #include <utility>
16 #include <variant>
17 #include <vector>
18 
19 #include <Metadaqif.hpp>
20 #include <boost/asio/io_context.hpp>
21 #include <boost/asio/steady_timer.hpp>
22 #include <boost/thread/future.hpp>
23 #include <gsl/pointers>
24 #include <log4cplus/logger.h>
25 #include <nlohmann/json.hpp>
26 #include <rad/ioExecutor.hpp>
27 
28 #include "daqContext.hpp"
29 #include "dpPart.hpp"
30 #include "error.hpp"
31 #include "eventLog.hpp"
32 #include "op/asyncOpParams.hpp"
33 #include "op/initiate.hpp"
34 #include "pendingReplies.hpp"
35 #include "source.hpp"
36 #include "state.hpp"
37 #include "status.hpp"
38 #include "makeDpSpec.hpp"
39 
40 namespace daq {
41 
42 class DpmClient;
43 class DaqController;
44 
45 /**
46  * OCM Async operations
47  *
48  * @ingroup daq_common_libdaq
49  */
51  // Await returns a pair of future return value and an abort function.
52  using AwaitReturnType = std::pair<boost::future<Result<DpParts>>, std::function<bool()>>;
53 
54  /**
55  * Default constructs object with standard async operations.
56  */
62 
63  bool IsValid() const noexcept;
64 
65  std::function<boost::future<void>(op::AsyncOpParams)> start;
66  std::function<boost::future<Result<void>>(ErrorPolicy, op::AsyncOpParams)> abort;
67  std::function<boost::future<Result<DpParts>>(ErrorPolicy, op::AsyncOpParams)> stop;
68  std::function<AwaitReturnType(op::AwaitOpParams)> await_prim;
69 };
70 
71 /**
72  * Abstract factory for DaqControllers.
73  *
74  * Main purpose is to allow daq::Manager to use a factory that creates mocks rather than real
75  * implementations for testing.
76  */
78 public:
79  /**
80  * Create instance for the OCM phase of the DAQ process.
81  */
82  virtual auto MakeOcmPhase(DaqContext daq_ctx,
83  std::shared_ptr<ObservableStatus> status,
84  std::shared_ptr<ObservableEventLog> event_log)
85  -> std::shared_ptr<DaqController> = 0;
86  /**
87  * Create instance for the DPM phase of the DAQ process.
88  */
89  virtual auto MakeDpmPhase(DaqContext daq_ctx,
90  std::shared_ptr<ObservableStatus> status,
91  std::shared_ptr<ObservableEventLog> event_log)
92  -> std::shared_ptr<DaqController> = 0;
93 };
94 
95 /**
96  * Default factory producing "real" implementations.
97  */
99 public:
100  DaqControllerFactoryDefault(boost::asio::io_context& io_ctx,
101  elt::mal::Mal& m_mal,
102  std::shared_ptr<DpmClient> dpm_client);
103  auto MakeOcmPhase(DaqContext daq_ctx,
104  std::shared_ptr<ObservableStatus> status,
105  std::shared_ptr<ObservableEventLog> event_log)
106  -> std::shared_ptr<DaqController> override;
107  auto MakeDpmPhase(DaqContext daq_ctx,
108  std::shared_ptr<ObservableStatus> status,
109  std::shared_ptr<ObservableEventLog> event_log)
110  -> std::shared_ptr<DaqController> override;
111 
112 private:
113  boost::asio::io_context& m_io_ctx;
114  elt::mal::Mal& m_mal;
115  OcmAsyncOperations m_async_ops;
116  std::shared_ptr<DpmClient> m_dpm_client;
117 };
118 
119 
120 /**
121  * Controls the execution of single data acquisition that ultimately result in a set of FITS
122  * keywords and/or FITS files.
123  *
124  * Important
125  * ---------
126  *
127  * Due to the dynamic nature of data acquisitions (mostly w.r.t. fatal errors from data soures and
128  * commands from user) the following assumptions are made:
129  *
130  * - Each data source completes only *once*.
131  * - This means that any command that deals with potential completion (mainly the stop and await
132  * operations) *must* record the outcome (DpParts + Keywords) and mark the source state as
133  * completed.
134  * - This ensures that no outcome is lost and that subsequent commands does not include completed
135  * sources.
136  * - Conflicting commands are resolved in the order they are received and w.r.t. to state.
137  * - If data sources are awaited on, some of which has aleady completed, and DaqController is
138  * asked to abort, this means that the DAQ state is `Aborting` and even if the await operation
139  * completes successfully, the result will be discarded because user asked to abort.
140  * - If user asks to stop and primary soures are awaited on, there's a race between which request
141  * to data source completes first.
142  * - Commands are only sent to sources that are in-progress (not completed/aborted/stopped).
143  * - Whichever reply is received first (from await or stop) will determine the result from
144  * that data souce.
145  * - Async operations must be able to deal with partial failures.
146  * - This is required to allow user to retry operation.
147  * - Asynchronous errors are published and user response is requied.
148  * - If e.g. the await operation fails partially it means user must intervene to decide if it
149  * should try to stop or abort the DAQ (in the future a DAQ-wide policy could be set to decide
150  * what to do automatically).
151  *
152  * Usage
153  * -----
154  *
155  * 1. Starting
156  *
157  * Start with `StartAsync`
158  *
159  * 2. Stopping
160  *
161  * Manual option
162  * -------------
163  *
164  * Stop/abort with `StopAsync` or `AbortAsync`.
165  *
166  * Automatic option
167  * ----------------
168  *
169  * Automatically initiate stop if all primary sources are automatically stopped as
170  * indicated by `ObservableStatus` status update topic.
171  *
172  * If asynchronous operations have been started, it is still possible to abort.
173  * This command will then supersede ongoing commands, and ongoing commands will
174  * be aborted at the next synchronization point (typically when reply is received).
175  *
176  * It is not possible to retry or go backwards by executing `StartAsync` after
177  * `StopAsync` or `AbortAsync`. The reasoning behind this is to avoid the risk
178  * of duplicate data acquisition id being "in flight" at the same time..
179  *
180  * It is possible to abort on the other hand, even though the data acquisition might not have
181  * been started yet.
182  *
183  * For StartAsync, StopAsync, AbortAsync:
184  *
185  * The error handling strategy is to not Set result until we have a result
186  * from each source either by reply or internal error when Sending/receiving
187  * (MAL issues e.g.).
188  *
189  * This implies:
190  *
191  * - That way we can communicate the full result using the promise.
192  * On errors it contains the exception(s) on success the new state.
193  * - We can have a mixed result of partial success and partial failure,
194  * although the future will contain exception(s).
195  * - We let caller decide what to do (e.g. abort).
196  * - We use an error flag to indicate that error occurred, which is
197  * possible in any state.
198  * - We stay in the state that had the error to e.g. allow retries.
199  * So if an error occurred in `Starting` then DaqController remains
200  * in `Starting` with the error flag Set.
201  *
202  * Pending decision decisions:
203  * - Whether to fail fast or be robust,
204  * or even whether to be configurable.
205  * - This was addressed with the ErrorPolicy option when stopping/aborting.
206  * - Support aborting while there are still replies pending for startDaq?
207  * This would mean that one can be in state Starting and Stopping at the same time.
208  * - This was addressed to ignore errors when forcibly aborting.
209  * - Who connects the clients + configure QoS? Since connect is done implicitly there's
210  * no need actually. Simply specify timeout should be sufficient. And that should
211  * be done by the caller.
212  *
213  * @ingroup daq_common_libdaq
214  */
215 class DaqController : public std::enable_shared_from_this<DaqController> {
216 public:
217  DaqController() = default;
218  virtual ~DaqController() = default;
219  /**
220  * Starts the data acquisition.
221  *
222  * @returns A future that will be Set once data acquisition has started
223  * or or fails.
224  *
225  * @throws std::exception-derived exception if internal error occurs.
226  *
227  * @return Future that is ready once all sources are started or failed.
228  *
229  * @pre `GetState() == State::Notstarted`
230  * @post `GetState() == State::Starting` on success
231  * `GetState() == State::Error` on error
232  */
233  virtual boost::future<State> StartAsync() = 0;
234 
235  /**
236  * Stops the data acquisition.
237  *
238  * @pre `GetState() not in (State::Stopped or State::Aborted)`
239  * @post `GetState() == State::Stopping`
240  */
241  virtual boost::future<Status> StopAsync(ErrorPolicy policy) = 0;
242 
243  /**
244  * Aborts the data acquisition.
245  *
246  * @param policy Error policy determining if errors are tolerated or not.
247  *
248  * It is possible to issue this request more than once, to e.g. retry a failed abort attempt.
249  *
250  * @pre `GetState() not in (State::Aborted, State::Stopped)`
251  * @post `GetState() == State::Aborting` if a data acquisition was ongoing otherwise `GetState()
252  * == State::Aborted`.
253  */
254  virtual boost::future<Status> AbortAsync(ErrorPolicy policy) = 0;
255 
256  /**
257  * Schedules DAQ for merging by sending request to DPM.
258  *
259  * @returns future containing exception:
260  * - std::logic_error if DAQ has already been scheduled
261  * - mal::TimeoutException if DPM is offline (timeout).
262  * - unspecified DPM fails
263  */
264  virtual boost::future<State> ScheduleMergeAsync() = 0;
265 
266  /**
267  * Updates (replace or add) list of keywords.
268  *
269  * @param keywords Keywords to add.
270  */
271  virtual void UpdateKeywords(fits::KeywordVector const& keywords) = 0;
272 
273  /** Awaits that data acquisition stops or aborts.
274  *
275  * It is possible to await only only a subset of data sources by specifying their ids in
276  * `sources`.
277  *
278  * @param sources An optional vector of source-ids to await, if empty all primary sources are
279  * awaited on.
280  *
281  * @returns future set with std::invalid_argument if source-id is not recognized.
282  * @returns future set with boost::broken_promise if DaqController is destroyed before
283  * operation completes.
284  */
285  virtual boost::future<State>
286  AwaitAsync(std::vector<std::string> sources, std::chrono::milliseconds timeout) = 0;
287 
288  /**
289  * @returns state of data acquisition.
290  */
291  virtual State GetState() const DAQ_NOEXCEPT = 0;
292 
293  /**
294  * @returns status object associated with this daq.
295  */
296  virtual std::shared_ptr<ObservableStatus> GetStatus() DAQ_NOEXCEPT = 0;
297  virtual std::shared_ptr<ObservableStatus const> GetStatus() const DAQ_NOEXCEPT = 0;
298 
299  /**
300  * @returns event log associated with this daq.
301  */
302  virtual std::shared_ptr<ObservableEventLog> GetEventLog() DAQ_NOEXCEPT = 0;
303 
304  /**
305  * @returns data acquisition identifier.
306  */
307  virtual std::string const& GetId() const DAQ_NOEXCEPT = 0;
308 
309  /**
310  * @return Error flag.
311  */
312  virtual bool GetErrorFlag() const DAQ_NOEXCEPT = 0;
313 
314  virtual DaqContext const& GetContext() const DAQ_NOEXCEPT = 0;
315 
316  using ContextSignal = boost::signals2::signal<void(DaqContext const&)>;
317  /**
318  * Connect observer that is invoked when context is modified.
319  *
320  * @param o Observer callable invoked on context changes.
321  *
322  * @return signal connection object that can be used to disconnect observer:
323  */
324  virtual boost::signals2::connection ConnectContext(ContextSignal::slot_type const& slot) = 0;
325 };
326 
327 std::ostream& operator<<(std::ostream& os, DaqController const& daq);
328 
329 /**
330  * Implements common behaviour of OcmDaqController and DpmDaqController.
331  *
332  */
334 public:
335  CommonDaqController(boost::asio::io_context& io_context,
336  DaqContext context,
337  std::shared_ptr<ObservableStatus> status,
338  std::shared_ptr<ObservableEventLog> event_log);
339 
340  std::shared_ptr<ObservableStatus> GetStatus() DAQ_NOEXCEPT override;
341  std::shared_ptr<ObservableStatus const> GetStatus() const DAQ_NOEXCEPT override;
342  std::shared_ptr<ObservableEventLog> GetEventLog() DAQ_NOEXCEPT override;
343  std::string const& GetId() const DAQ_NOEXCEPT override;
344  bool GetErrorFlag() const DAQ_NOEXCEPT override;
345  DaqContext const& GetContext() const DAQ_NOEXCEPT override;
346  boost::signals2::connection ConnectContext(ContextSignal::slot_type const& slot) override;
347 
348 protected:
349  template <class T, class... Args>
350  void AddEvent(Args&&... args) {
351  m_event_log->EmplaceEvent<T>(std::forward<Args>(args)...);
352  }
353  boost::asio::io_context& GetIoCtx() noexcept {
354  return m_io_ctx;
355  }
357  return m_executor;
358  }
359  DaqContext& GetContextMut() noexcept {
360  return m_context;
361  }
363  return *m_event_log.get();
364  }
366  return *m_status.get();
367  }
368  ObservableStatus const& GetStatusRef() const noexcept {
369  return *m_status.get();
370  }
372  m_sig_context(m_context);
373  }
374 
375 private:
376  boost::asio::io_context& m_io_ctx;
377  rad::IoExecutor m_executor;
378  DaqContext m_context;
379  ContextSignal m_sig_context;
380  std::shared_ptr<ObservableStatus> m_status;
381  std::shared_ptr<ObservableEventLog> m_event_log;
382 };
383 
384 /**
385  * Implements `daq::DaqController` for states responsible to be executed by OCM.
386  *
387  * The states executed by DPM are implemented by DpmDaqController.
388  *
389  * @ingroup daq_common_libdaq
390  */
392 public:
393  /**
394  * Construct object.
395  *
396  * @param io_context Executor used for continuations and timer.
397  * @param context General context used to control DAQ execution.
398  * @param status Data acquisition status object, also contains identifier (may not be empty).
399  * Caller is responsible for making the id unique.
400  * @param prim Primary data sources
401  * @param meta Metadata sources
402  *
403  * @pre `status == true`.
404  * @pre `event_log == true`.
405  * @throws std::invalid_argument if arguments are invalid.
406  */
407  static std::shared_ptr<OcmDaqController> Create(boost::asio::io_context& io_context,
408  DaqContext context,
409  DaqSources const& sources,
410  std::shared_ptr<ObservableStatus> status,
411  std::shared_ptr<ObservableEventLog> event_log,
412  OcmAsyncOperations operations);
413 
414  boost::future<State> StartAsync() override;
415  boost::future<Status> StopAsync(ErrorPolicy policy) override;
416  boost::future<Status> AbortAsync(ErrorPolicy policy) override;
417  boost::future<State> ScheduleMergeAsync() override;
418  void UpdateKeywords(fits::KeywordVector const& keywords) override;
419  boost::future<State>
420  AwaitAsync(std::vector<std::string> sources, std::chrono::milliseconds timeout) override;
421 
422  State GetState() const DAQ_NOEXCEPT override;
423 
424  /**
425  * @returns Logger associated with this DaqController.
426  */
427  constexpr log4cplus::Logger const& GetLogger() const noexcept;
428 
429 protected:
430  struct NotStarted {};
431  struct Starting {};
432  struct Acquiring {};
433  struct Stopping {};
434  struct Stopped {};
435  struct Aborting {};
436  struct Aborted {};
437 
438  using StateVariant =
439  std::variant<NotStarted, Starting, Acquiring, Stopping, Stopped, Aborting, Aborted>;
440  StateVariant MakeState(State s) const noexcept;
441 #ifdef UNIT_TEST
442 public:
443 #endif
444  // Protected constructor so user is forced to use shared pointer semantics
445  // which is required because of future continuation style programming.
446  OcmDaqController(boost::asio::io_context& io_context,
447  DaqContext context,
448  DaqSources const& sources,
449  std::shared_ptr<ObservableStatus> status,
450  std::shared_ptr<ObservableEventLog> event_log,
451  OcmAsyncOperations ops);
452 #ifdef UNIT_TEST
453 private:
454 #endif
455  /**
456  * Constructs the parameters used for asynchronous operations.
457  *
458  * @note OcmAsyncOpParams will bind references to member variables so caller must
459  * guarantee that DaqController outlives the async operation.
460  * This is normally done by holding a shared copy in the last .then continuation
461  * for the async operation, thus guaranteeing that all intermediate continuations
462  * will access a valid object.
463  */
464  op::AsyncOpParams MakeParams(op::AlertState&);
465  op::AwaitOpParams MakeAwaitParams(op::AlertState&);
466 
467  /**
468  * Await completion of primary sources.
469  *
470  * If there are no sources this method does nothing.
471  */
472  void InitiateAwaitPrimarySources();
473 
474  void AddInitialKeywords();
475 
476  void SetErrorFlag(bool error) noexcept;
477  void SetState(StateVariant&& s) noexcept;
478 
479  std::optional<
480  std::variant<gsl::not_null<Source<PrimSource>*>, gsl::not_null<Source<MetaSource>*>>>
481  FindSource(std::string_view source_id);
482 
483  /// Helper to build source vector
484  template <class SourceType>
485  std::vector<Source<SourceType>> MakeSources(std::vector<SourceType> sources);
486 
488 
489  std::vector<Source<PrimSource>> m_prim_sources; ///< Note: Consider vector immutable!
490  std::vector<Source<MetaSource>> m_meta_sources; ///< Note: Consider vector immutable!
491 
493  std::shared_ptr<PendingReplies> m_pending_replies;
494  std::vector<std::unique_ptr<boost::asio::steady_timer>> m_timers;
495 
496  /**
497  * If DaqController is awaiting the completion of primary data sources
498  * this function will hold the abort function.
499  *
500  * @important Users must check if it is valid before invoking it.
501  */
502  std::function<bool()> m_abort_await_primary_sources;
503  log4cplus::Logger m_logger;
504 };
505 
506 /**
507  * Implements behaviour from the state NotScheduled to Completed.
508  *
509  * Once successfully scheduled to be merged by DPM (NotScheduled -> Scheduled) the "location" for the
510  * *true* DAQ state is also transferred. This means:
511  *
512  * - If DPM is offline:
513  * - OCM cannot know the true state of DAQ.
514  * - Aborting with strict error policy cannot be done.
515  * - Aborting with tolerant policy will forcefully abort DAQ locally but the DAQ may anyway be
516  * completed by DPM.
517  *
518  */
520 public:
521  /**
522  * Constructor
523  *
524  * @important DpmDaqController must only be used with shared_ptr.
525  *
526  * @param io_context Used for async operations.
527  * @param context DAQ context.
528  * @param status DAQ status.
529  * @param dpm_client Interface to DPM. During construction DpmDaqController will register
530  * signal slot to receive DAQ status updates and mirror that in status accordingly.
531  *
532  * @throws std::invalid_argument if state of status is not NotScheduled or subsequent.
533  */
534  DpmDaqController(boost::asio::io_context& io_context,
535  DaqContext context,
536  std::shared_ptr<ObservableStatus> status,
537  std::shared_ptr<ObservableEventLog> event_log,
538  std::shared_ptr<DpmClient> dpm_client);
539 
540  boost::future<State> ScheduleMergeAsync() override;
541 
542  /**
543  * @returns future containing std::runtime_error because operation is always invalid.
544  */
545  boost::future<State> StartAsync() override;
546  /**
547  * @returns future containing std::runtime_error because operation is always invalid.
548  */
549  boost::future<Status> StopAsync(ErrorPolicy policy) override;
550 
551  /**
552  * @throws std::runtime_error because operation is always invalid (keywords cannot be modified
553  * once delivered to DPM).
554  */
555  void UpdateKeywords(fits::KeywordVector const& keywords) override;
556 
557  /**
558  * @returns future containing std::runtime_error because operation is always invalid.
559  */
560  boost::future<State>
561  AwaitAsync(std::vector<std::string> sources, std::chrono::milliseconds timeout) override;
562 
563  /**
564  * Attempts to abort Data Acquisition.
565  *
566  * - If Data Acquisition is not-yet-scheduled it will be aborted immediately.
567  * - If Data Acquisition *may* have been scheduled (request has been sent to DPM) the request is
568  * forwarded to DPM.
569  *
570  * - If DPM is not running or otherwise fails the DAQ is still marked as aborted if policy is
571  * ErrorPolicy::Tolerant.
572  */
573  boost::future<Status> AbortAsync(ErrorPolicy policy) override;
574 
575  State GetState() const DAQ_NOEXCEPT override;
576 
577 private:
578  struct NotScheduled {
579  /**
580  * We impose limit so that at most a single request to schedule merge can be outstanding.
581  * If a reply is pending this is indicated by the optional containing a future.
582  *
583  * This is valid in state NotScheduled.
584  */
585  bool schedule_reply_pending;
586  };
587 
588  /**
589  * Changes m_state_ctx as necessary based on current state.
590  */
591  void UpdateStateContext();
592  void SetState(State state, std::optional<bool> error = std::nullopt);
593 
594  using StateVariant = std::variant<std::monostate, NotScheduled>;
595 
596  /**
597  * An extra liveness object.
598  */
599  std::shared_ptr<bool> m_liveness;
600  std::shared_ptr<DpmClient> m_dpm_client;
601  /**
602  * Connection to disconnect slot from DpmClient::StatusSignal
603  */
604  boost::signals2::scoped_connection m_status_connection;
605 
606  // "Cached" representation of the data product specification created from local DaqContect
607  // It is created on the fly in ScheduleMergeAsync as necessary.
608  std::optional<std::string> m_dp_spec;
609  StateVariant m_state_ctx;
610  log4cplus::Logger m_logger;
611 };
612 
613 
614 } // namespace daq
615 
616 #endif // OCF_DAQ_DAQ_CONTROLLER_HPP_
Implements common behaviour of OcmDaqController and DpmDaqController.
ObservableEventLog & GetEventLogRef() noexcept
void AddEvent(Args &&... args)
ObservableStatus & GetStatusRef() noexcept
boost::asio::io_context & GetIoCtx() noexcept
ObservableStatus const & GetStatusRef() const noexcept
DaqContext & GetContextMut() noexcept
rad::IoExecutor & GetIoExecutor() noexcept
Default factory producing "real" implementations.
Abstract factory for DaqControllers.
virtual auto MakeDpmPhase(DaqContext daq_ctx, std::shared_ptr< ObservableStatus > status, std::shared_ptr< ObservableEventLog > event_log) -> std::shared_ptr< DaqController >=0
Create instance for the DPM phase of the DAQ process.
virtual auto MakeOcmPhase(DaqContext daq_ctx, std::shared_ptr< ObservableStatus > status, std::shared_ptr< ObservableEventLog > event_log) -> std::shared_ptr< DaqController >=0
Create instance for the OCM phase of the DAQ process.
Controls the execution of single data acquisition that ultimately result in a set of FITS keywords an...
virtual boost::future< Status > StopAsync(ErrorPolicy policy)=0
Stops the data acquisition.
virtual boost::future< Status > AbortAsync(ErrorPolicy policy)=0
Aborts the data acquisition.
virtual boost::future< State > AwaitAsync(std::vector< std::string > sources, std::chrono::milliseconds timeout)=0
Awaits that data acquisition stops or aborts.
virtual boost::future< State > ScheduleMergeAsync()=0
Schedules DAQ for merging by sending request to DPM.
virtual void UpdateKeywords(fits::KeywordVector const &keywords)=0
Updates (replace or add) list of keywords.
virtual ~DaqController()=default
virtual boost::future< State > StartAsync()=0
Starts the data acquisition.
boost::signals2::signal< void(DaqContext const &)> ContextSignal
DaqController()=default
virtual State GetState() const DAQ_NOEXCEPT=0
Data acquisition sources.
Definition: source.hpp:184
Implements behaviour from the state NotScheduled to Completed.
Stores data acquisition status and allows subscription to status changes.
Definition: eventLog.hpp:107
Stores data acquisition status and allows subscription to status changes.
Definition: status.hpp:165
Implements daq::DaqController for states responsible to be executed by OCM.
std::vector< Source< PrimSource > > m_prim_sources
Note: Consider vector immutable!
log4cplus::Logger m_logger
std::vector< std::unique_ptr< boost::asio::steady_timer > > m_timers
std::shared_ptr< PendingReplies > m_pending_replies
std::variant< NotStarted, Starting, Acquiring, Stopping, Stopped, Aborting, Aborted > StateVariant
OcmAsyncOperations m_async_ops
std::vector< Source< MetaSource > > m_meta_sources
Note: Consider vector immutable!
std::function< bool()> m_abort_await_primary_sources
If DaqController is awaiting the completion of primary data sources this function will hold the abort...
Adapts boost::asio::io_context into a compatible boost::thread Executor type.
Definition: ioExecutor.hpp:12
#define DAQ_NOEXCEPT
Definition: config.hpp:16
Contains declaration of daq::Context.
Contains declaration for DpPart.
Contains error related declarations for DAQ.
Contains declaration for EventLog, ObservableEventLog and related events.
Contains declarations for the helper functions to initiate operations.
Declares daq::State and related functions.
std::vector< KeywordVariant > KeywordVector
Vector of keywords.
Definition: keyword.hpp:414
daqif::FullState MakeState(State state) noexcept
Converts daq::State to DaqSubstate.
Definition: conversion.cpp:63
void UpdateKeywords(DaqContext &ctx, fits::KeywordVector const &keywords)
Updates (adds or replaces) primary HDU keywords.
Definition: daqContext.cpp:29
std::vector< DpPart > DpParts
Definition: dpPart.hpp:66
ErrorPolicy
Error policy supported by certain operations.
Definition: error.hpp:25
State
Observable states of the data acquisition process.
Definition: state.hpp:39
@ NotScheduled
Before daq is acknowledged by dpm it remains in NotScheduled.
Utility class that represents a result and an error.
Definition: utility.hpp:17
Definition: main.cpp:23
log4cplus::Logger & GetLogger()
Definition: logger.cpp:14
Config class header file.
Contains declaration for classes related to pending replies.
Declarations for daq::Source and related classes.
Contains declaration for Status and ObservableStatus.
Structure carrying context needed to start a Data Acquisition and construct a Data Product Specificat...
Definition: daqContext.hpp:44
OCM Async operations.
std::function< boost::future< Result< void > >ErrorPolicy, op::AsyncOpParams)> abort
OcmAsyncOperations & operator=(OcmAsyncOperations const &)=default
bool IsValid() const noexcept
OcmAsyncOperations & operator=(OcmAsyncOperations &&)=default
std::function< boost::future< void >op::AsyncOpParams)> start
std::function< AwaitReturnType(op::AwaitOpParams)> await_prim
OcmAsyncOperations()
Default constructs object with standard async operations.
std::function< boost::future< Result< DpParts > >ErrorPolicy, op::AsyncOpParams)> stop
OcmAsyncOperations(OcmAsyncOperations &&)=default
std::pair< boost::future< Result< DpParts > >, std::function< bool()> > AwaitReturnType
OcmAsyncOperations(OcmAsyncOperations const &)=default
Parameters required for each async operation.
Await specific parameters that is not provided with AsyncOpParams.