QualityControl  1.5.1
O2 Data Quality Control Framework
DatabaseInterface.h
Go to the documentation of this file.
1 // Copyright CERN and copyright holders of ALICE O2. This software is
2 // distributed under the terms of the GNU General Public License v3 (GPL
3 // Version 3), copied verbatim in the file "COPYING".
4 //
5 // See http://alice-o2.web.cern.ch/license for full licensing information.
6 //
7 // In applying this license CERN does not waive the privileges and immunities
8 // granted to it by virtue of its status as an Intergovernmental Organization
9 // or submit itself to any jurisdiction.
10 
15 
16 #ifndef QC_REPOSITORY_DATABASEINTERFACE_H
17 #define QC_REPOSITORY_DATABASEINTERFACE_H
18 
19 #include <string>
20 #include <memory>
21 #include <vector>
22 #include <unordered_map>
23 
24 #include <Framework/ServiceRegistry.h>
25 
26 #include "QualityControl/QualityObject.h"
28 
30 {
31 
36 {
37  public:
38  constexpr static framework::ServiceKind service_kind = framework::ServiceKind::Global;
39 
41  DatabaseInterface() = default;
43  virtual ~DatabaseInterface() = default;
44 
54  virtual void connect(std::string host, std::string database, std::string username, std::string password) = 0;
60  virtual void connect(const std::unordered_map<std::string, std::string>& config) = 0;
61 
68  virtual void storeMO(std::shared_ptr<const o2::quality_control::core::MonitorObject> mo, long from = -1, long to = -1) = 0;
69 
76  virtual void storeQO(std::shared_ptr<const o2::quality_control::core::QualityObject> qo, long from = -1, long to = -1) = 0;
77 
83  virtual std::shared_ptr<o2::quality_control::core::MonitorObject> retrieveMO(std::string taskName, std::string objectName, long timestamp = -1) = 0;
89  virtual std::shared_ptr<o2::quality_control::core::QualityObject> retrieveQO(std::string qoPath, long timestamp = -1) = 0;
98  virtual TObject* retrieveTObject(std::string path, const std::map<std::string, std::string>& metadata, long timestamp = -1, std::map<std::string, std::string>* headers = nullptr) = 0;
99 
106  virtual std::string retrieveMOJson(std::string taskName, std::string objectName, long timestamp = -1) = 0;
113  virtual std::string retrieveQOJson(std::string qoPath, long timestamp = -1) = 0;
122  virtual std::string retrieveJson(std::string path, long timestamp, const std::map<std::string, std::string>& metadata) = 0;
130  virtual std::string retrieveJson(std::string path)
131  {
132  std::map<std::string, std::string> metadata;
133  return retrieveJson(path, -1, metadata);
134  }
135 
136  virtual void disconnect() = 0;
141  virtual void prepareTaskDataContainer(std::string taskName) = 0;
142  virtual std::vector<std::string> getPublishedObjectNames(std::string taskName) = 0;
148  virtual void truncate(std::string taskName, std::string objectName) = 0;
149 };
150 
151 } // namespace o2::quality_control::repository
152 
153 #endif /* QC_REPOSITORY_DATABASEINTERFACE_H */
virtual ~DatabaseInterface()=default
Destructor.
virtual std::string retrieveMOJson(std::string taskName, std::string objectName, long timestamp=-1)=0
Look up a monitor object and return it in JSON format. Look up a monitor object and return it in JSON...
Definition: AggregatorRunner.h:59
virtual void prepareTaskDataContainer(std::string taskName)=0
Prepare the container, such as a table in a relational database, that will contain the MonitorObject&#39;...
virtual void storeMO(std::shared_ptr< const o2::quality_control::core::MonitorObject > mo, long from=-1, long to=-1)=0
virtual void connect(std::string host, std::string database, std::string username, std::string password)=0
virtual void truncate(std::string taskName, std::string objectName)=0
virtual std::shared_ptr< o2::quality_control::core::QualityObject > retrieveQO(std::string qoPath, long timestamp=-1)=0
Look up a quality object and return it. Look up a quality object and return it if found or nullptr if...
The interface to the MonitorObject&#39;s repository.
Definition: DatabaseInterface.h:35
virtual std::shared_ptr< o2::quality_control::core::MonitorObject > retrieveMO(std::string taskName, std::string objectName, long timestamp=-1)=0
Look up a monitor object and return it. Look up a monitor object and return it if found or nullptr if...
virtual std::string retrieveJson(std::string path, long timestamp, const std::map< std::string, std::string > &metadata)=0
Look up an object and return it in JSON format. Look up an object and return it in JSON format if fou...
virtual TObject * retrieveTObject(std::string path, const std::map< std::string, std::string > &metadata, long timestamp=-1, std::map< std::string, std::string > *headers=nullptr)=0
Look up an object and return it. Look up an object and return it if found or nullptr if not...
virtual std::string retrieveQOJson(std::string qoPath, long timestamp=-1)=0
Look up a quality object and return it in JSON format. Look up a quality object and return it in JSON...
virtual std::string retrieveJson(std::string path)
Look up an object and return it in JSON format. Look up an object and return it in JSON format if fou...
Definition: DatabaseInterface.h:130
DatabaseInterface()=default
Default constructor.
virtual void storeQO(std::shared_ptr< const o2::quality_control::core::QualityObject > qo, long from=-1, long to=-1)=0