Belle II Software prerelease-11-00-00a
HSFCentralMetadataProvider.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 {
22 public:
24 explicit HSFCentralMetadataProvider(const std::set<std::string>& usableTagStates);
25
27 HSFCentralMetadataProvider(std::string baseUrl, const std::set<std::string>& usableTagStates);
28
30 virtual ~HSFCentralMetadataProvider() = default;
31
36 std::string getGlobaltagStatus(const std::string& name) override;
37
43 bool updatePayloads(const std::string& globaltag, int exp, int run) override;
44
45 private:
48 nlohmann::json get(const std::string& url);
49
52
54 std::string m_baseUrl;
55
57 std::string m_payloadBaseUrl;
58
60 static constexpr long long m_maxIoV = 9223372036854775807;
61 };
62} // Belle2::Conditions namespace
Simple class to encapsulate libcurl as used by the ConditionsDatabase.
Definition Downloader.h:22
static Downloader & getDefaultInstance()
Return the default instance.
std::string getGlobaltagStatus(const std::string &name) override
Check the status of a given globaltag.
HSFCentralMetadataProvider(const std::set< std::string > &usableTagStates)
Create using the default HSF central base URL and given usable tag states.
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.
static constexpr long long m_maxIoV
Max IoV value, representing infinite end of validity.
nlohmann::json get(const std::string &url)
Download a given relative url (the baseUrl will be prepended) and return the json description.
virtual ~HSFCentralMetadataProvider()=default
default destructor
std::string m_payloadBaseUrl
base url of the payload server
MetadataProvider()=default
Default constructible.