Belle II Software light-2406-ragdoll
CentralMetadataProvider.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <framework/database/MetadataProvider.h>
11#include <framework/database/Downloader.h>
12#include <nlohmann/json.hpp>
13
14namespace Belle2::Conditions {
17 public:
19 CentralMetadataProvider(std::string baseUrl, const std::set<std::string>& usableTagStates);
21 virtual ~CentralMetadataProvider() = default;
26 std::string getGlobaltagStatus(const std::string& name) override;
32 bool updatePayloads(const std::string& globaltag, int exp, int run) override;
33 private:
36 nlohmann::json get(const std::string& url);
40 std::string m_baseUrl;
41 };
42} // Belle2::Conditions namespace
Class to obtain payload metadata from the central database server via REST requests.
std::string getGlobaltagStatus(const std::string &name) override
Check the status of a given globaltag .
bool updatePayloads(const std::string &globaltag, int exp, int run) override
Update the list of known payloads for the given globaltag/exp/run.
Downloader & m_downloader
Reference to the downloader instance for convenience.
std::string m_baseUrl
base url of the server
virtual ~CentralMetadataProvider()=default
default destructor
nlohmann::json get(const std::string &url)
Downlad a given relative url (the baseUrl will be prependend) and return the json description.
Simple class to encapsulate libcurl as used by the ConditionsDatabase.
Definition: Downloader.h:22
static Downloader & getDefaultInstance()
Return the default instance.
Definition: Downloader.cc:134
Base class for a payload metadata provider.