tdaq-develop-2025-02-12
Database_configInterface.h
1 #ifndef _ots_DatabaseConfigurationInterface_h_
2 #define _ots_DatabaseConfigurationInterface_h_
3 
4 #include "otsdaq/ConfigurationInterface/ConfigurationInterface.h"
5 
6 // #include "ConfigurationInterface.h"
7 
8 #include <list>
9 #include <map>
10 #include <set>
11 #include <stdexcept>
12 
13 namespace ots
14 {
15 class TableBase;
16 
18 {
19  public:
20  using table_version_map_t = std::map<std::string /*name*/, TableVersion /*version*/>;
21 
24 
25  bool IS_FILESYSTEM_DB = true;
26 
28  void fill(TableBase* table, TableVersion version) const override;
29 
31  void saveActiveVersion(const TableBase* table, bool overwrite = false) const override;
32 
34  TableVersion findLatestVersion(const TableBase* table) const noexcept override;
35 
37  std::set<std::string /*name*/> getAllTableNames(void) const override;
39  std::set<TableVersion> getVersions(const TableBase* table) const noexcept override;
40 
42  std::set<std::string /*name+version*/> getAllTableGroupNames(
43  std::string const& filterString = "") const override;
44  std::set<TableGroupKey> getKeys(const std::string& groupName) const override;
46  const std::string& groupName) const noexcept override;
47 
49  table_version_map_t getTableGroupMembers(
50  std::string const& tableGroup, bool includeMetaDataTable = false) const override;
51 
53  void saveTableGroup(table_version_map_t const& memberMap,
54  std::string const& tableGroup) const override;
55 
56  std::pair<std::string, TableVersion> saveCustomJSON(
57  const std::string& JSON, const std::string& documentNameToSave) const override;
58  std::string loadCustomJSON(const std::string& documentNameToLoad,
59  TableVersion documentVersionToLoad) const override;
60 
61  private:
62  table_version_map_t getCachedTableGroupMembers(std::string const& tableGroup) const;
63  void saveTableGroupMemberCache(table_version_map_t const& memberMap,
64  std::string const& tableGroup) const;
65 };
66 } // namespace ots
67 
68 #endif
void saveTableGroup(table_version_map_t const &memberMap, std::string const &tableGroup) const override
create a new table group from the contents map
TableVersion findLatestVersion(const TableBase *table) const noexcept override
find the latest table version by table type
table_version_map_t getTableGroupMembers(std::string const &tableGroup, bool includeMetaDataTable=false) const override
return the contents of a table group
std::set< std::string > getAllTableGroupNames(std::string const &filterString="") const override
find all table groups in database
std::set< TableGroupKey > getKeys(const std::string &groupName) const override
find all configuration groups in database
std::set< TableVersion > getVersions(const TableBase *table) const noexcept override
find all table versions by table type
std::set< std::string > getAllTableNames(void) const override
returns a list of all table names
void fill(TableBase *table, TableVersion version) const override
read table from database
TableGroupKey findLatestGroupKey(const std::string &groupName) const noexcept override
void saveActiveVersion(const TableBase *table, bool overwrite=false) const override
write table to database