|
| 1 | +// |
| 2 | +// Created by bvonhall on 17/10/17. |
| 3 | +// |
| 4 | + |
| 5 | +#ifndef PROJECT_CCDBDATABASE_H |
| 6 | +#define PROJECT_CCDBDATABASE_H |
| 7 | + |
| 8 | +#include <curl/curl.h> |
| 9 | +#include "QualityControl/DatabaseInterface.h" |
| 10 | + |
| 11 | +namespace o2 { |
| 12 | +namespace quality_control { |
| 13 | +namespace repository { |
| 14 | + |
| 15 | +/* |
| 16 | + * Notes |
| 17 | + * - having 1 file per object per version server-side might lead to a tremendous number of files. |
| 18 | + * - how to add a new filter ? such as expert/shifter flag |
| 19 | + * - we really need a C++ interface hiding the curl complexity. |
| 20 | + * - what are those time intervals ? what does it mean for us ? |
| 21 | + * - how to know the real time at which the object was stored ? |
| 22 | + * - we rather have a task_name/X/Y/Z/object_name/.../time where X/Y/Z are actually part of object_name but happen to have slashes, to build a hierarchy of objects |
| 23 | + * - we need to have a way to query for all objects in a certain path, e.g. in "task_name/X/Y" or in "task_name" |
| 24 | + * - when retrieving an object, despite what the usage menu says, the time can't be omitted. |
| 25 | + * - initial tests show that it seems pretty slow. |
| 26 | + * - We need getListOfTasksWithPublications() and getPublishedObjectNames() |
| 27 | + */ |
| 28 | + |
| 29 | +class CcdbDatabase : public DatabaseInterface |
| 30 | +{ |
| 31 | + public: |
| 32 | + CcdbDatabase(); |
| 33 | + void connect(std::string host, std::string database, std::string username, std::string password) override; |
| 34 | + void store(o2::quality_control::core::MonitorObject *mo) override; |
| 35 | + core::MonitorObject *retrieve(std::string taskName, std::string objectName) override; |
| 36 | + void disconnect() override; |
| 37 | + void prepareTaskDataContainer(std::string taskName) override; |
| 38 | + std::vector<std::string> getListOfTasksWithPublications() override; |
| 39 | + std::vector<std::string> getPublishedObjectNames(std::string taskName) override; |
| 40 | + |
| 41 | + private: |
| 42 | + core::MonitorObject *downloadObject( std::string location); |
| 43 | + std::string getObjectPath(std::string taskName, std::string objectName); |
| 44 | + |
| 45 | + std::string url; |
| 46 | +}; |
| 47 | + |
| 48 | +} |
| 49 | +} |
| 50 | +} |
| 51 | + |
| 52 | +#endif //PROJECT_CCDBDATABASE_H |
0 commit comments