tdaq-develop-2025-02-12
|
#include <otsdaq/ConfigurationInterface/ConfigurationManagerRW.h>
Public Member Functions | |
ConfigurationManagerRW (const std::string &username) | |
ConfigurationManagerRW. | |
const std::string & | getUsername (void) const |
Getters. | |
ConfigurationInterface * | getConfigurationInterface (void) const |
const std::map< std::string, TableInfo > & | getAllTableInfo (bool refresh=false, std::string *accumulatedWarnings=0, const std::string &errorFilterName="", bool getGroupKeys=false, bool getGroupInfo=false, bool initializeActiveGroups=false) |
std::map< std::string, std::map< std::string, TableVersion > > | getVersionAliases (void) const |
template<class T > | |
T * | getConfigurationRW (std::string name) |
TableBase * | getVersionedTableByName (const std::string &tableName, TableVersion version, bool looseColumnMatching=false, std::string *accumulatedErrors=0, bool getRawData=false) |
TableBase * | getTableByName (const std::string &tableName) |
TableGroupKey | findTableGroup (const std::string &groupName, const std::map< std::string, TableVersion > &groupMembers, const std::map< std::string, std::string > &groupAliases=std::map< std::string, std::string >()) |
TableBase * | getMetadataTable (void) |
TableVersion | saveNewTable (const std::string &tableName, TableVersion temporaryVersion=TableVersion(), bool makeTemporary=false) |
modifiers of generic TableBase More... | |
TableVersion | saveModifiedVersion (const std::string &tableName, TableVersion originalVersion, bool makeTemporary, TableBase *config, TableVersion temporaryModifiedVersion, bool ignoreDuplicates=false, bool lookForEquivalent=false, bool *foundEquivalent=nullptr) |
TableVersion | copyViewToCurrentColumns (const std::string &tableName, TableVersion sourceVersion) |
copyViewToCurrentColumns | |
void | eraseTemporaryVersion (const std::string &tableName, TableVersion targetVersion=TableVersion()) |
void | clearCachedVersions (const std::string &tableName) |
void | clearAllCachedVersions (void) |
void | activateTableGroup (const std::string &tableGroupName, TableGroupKey tableGroupKey, std::string *accumulatedTreeErrors=0, std::string *groupTypeString=0) |
modifiers of table groups More... | |
TableVersion | createTemporaryBackboneView (TableVersion sourceViewVersion=TableVersion()) |
-1, from MockUp, else from valid backbone view version More... | |
TableVersion | saveNewBackbone (TableVersion temporaryVersion=TableVersion()) |
TableGroupKey | saveNewTableGroup (const std::string &groupName, std::map< std::string, TableVersion > &groupMembers, const std::string &groupComment=TableViewColumnInfo::DATATYPE_COMMENT_DEFAULT, std::map< std::string, std::string > *groupAliases=0) |
modifiers of a table group based on alias, e.g. "Physics" More... | |
const GroupInfo & | getGroupInfo (const std::string &groupName) |
public group cache handling More... | |
const std::map< std::string, GroupInfo > & | getAllGroupInfo (void) |
void | testXDAQContext (void) |
for debugging More... | |
![]() | |
const std::set< std::string > & | getConfigurationMemberNames (void) |
ConfigurationManager (bool initForWriteAccess=false, bool initializeFromFhicl=false) | |
void | init (std::string *accumulatedErrors=0, bool initForWriteAccess=false, std::string *accumulatedWarnings=0) |
void | destroy (void) |
void | destroyTableGroup (const std::string &theGroup="", bool onlyDeactivate=false) |
std::string | runTimeSeconds () |
void | loadTableGroup (const std::string &tableGroupName, const TableGroupKey &tableGroupKey, bool doActivate=false, std::map< std::string, TableVersion > *groupMembers=0, ProgressBar *progressBar=0, std::string *accumulateWarnings=0, std::string *groupComment=0, std::string *groupAuthor=0, std::string *groupCreateTime=0, bool doNotLoadMember=false, std::string *groupTypeString=0, std::map< std::string, std::string > *groupAliases=0, ConfigurationManager::LoadGroupType onlyLoadIfBackboneOrContext=ConfigurationManager::LoadGroupType::ALL_TYPES, bool ignoreVersionTracking=false) |
void | copyTableGroupFromCache (const ConfigurationManager &cacheConfigMgr, const std::map< std::string, TableVersion > &groupMembers, const std::string &configGroupName="", const TableGroupKey &tableGroupKey=TableGroupKey(TableGroupKey::INVALID), bool doActivate=false, bool ignoreVersionTracking=false) |
std::pair< std::string, TableGroupKey > | getGroupOfLoadedTable (const std::string &tableName) const |
void | loadMemberMap (const std::map< std::string, TableVersion > &memberMap, std::string *accumulateWarnings=0) |
TableGroupKey | loadConfigurationBackbone (void) |
template<class T > | |
const T * | getTable (const std::string &tableName) const |
const TableBase * | getTableByName (const std::string &configurationName) const |
void | dumpActiveConfiguration (const std::string &filePath, const std::string &dumpType, const std::string &configurationAlias, const std::string &logEntry, const std::string &activeUsers, std::ostream &altOut=std::cout) |
void | dumpMacroMakerModeFhicl (void) |
std::map< std::string, std::pair< std::string, TableGroupKey > > | getActiveGroupAliases (void) |
std::map< std::string, std::map< std::string, TableVersion > > | getVersionAliases (void) const |
std::pair< std::string, TableGroupKey > | getTableGroupFromAlias (std::string systemAlias, ProgressBar *progressBar=0) |
Getters. More... | |
std::map< std::string, std::pair< std::string, TableGroupKey > > | getActiveTableGroups (void) const |
const std::map< std::string, std::pair< std::string, TableGroupKey > > & | getFailedTableGroups (void) const |
const lastGroupLoad_t & | getLastTableGroups (void) const |
const std::string & | getActiveGroupName (const ConfigurationManager::GroupType &type=ConfigurationManager::GroupType::CONFIGURATION_TYPE) const |
TableGroupKey | getActiveGroupKey (const ConfigurationManager::GroupType &type=ConfigurationManager::GroupType::CONFIGURATION_TYPE) const |
ConfigurationTree | getNode (const std::string &nodeString, bool doNotThrowOnBrokenUIDLinks=false) const |
"root/parent/parent/" | |
std::map< std::string, ConfigurationTree > | getNodes (const std::string &nodeString) const |
ConfigurationTree | getContextNode (const std::string &contextUID, const std::string &applicationUID) const |
ConfigurationTree | getSupervisorNode (const std::string &contextUID, const std::string &applicationUID) const |
ConfigurationTree | getSupervisorTableNode (const std::string &contextUID, const std::string &applicationUID) const |
ConfigurationTree | getGatewaySupervisorNode (void) const |
There can only be one active Gateway Superivsor app, so find it. | |
std::vector< std::pair< std::string, ConfigurationTree > > | getChildren (std::map< std::string, TableVersion > *memberMap=0, std::string *accumulatedTreeErrors=0) const |
std::map< std::string, ConfigurationTree > | getChildrenMap (std::map< std::string, TableVersion > *memberMap=0, std::string *accumulatedTreeErrors=0) const |
std::string | getFirstPathToNode (const ConfigurationTree &node, const std::string &startPath="/") const |
getFirstPathToNode More... | |
std::map< std::string, TableVersion > | getActiveVersions (void) const |
getActiveVersions | |
const std::string & | getOwnerContext (void) |
const std::string & | getOwnerApp (void) |
bool | isOwnerFirstAppInContext (void) |
std::map< std::string, std::pair< std::string, TableGroupKey > > | getOtherSubsystemActiveTableGroups (const std::string &otherSubsystemUID, std::string *userDataPathPtr=nullptr, std::string *hostnamePtr=nullptr, std::string *usernamePtr=nullptr) |
void | getOtherSubsystemInstanceInfo (const std::string &otherSubsystemUID, std::string *userDataPathPtr=nullptr, std::string *hostnamePtr=nullptr, std::string *usernamePtr=nullptr, std::string *fullNamePtr=nullptr) |
std::set< std::string > | getOtherSubsystemConfigAliases (const std::string &otherSubsystemUID) |
Ignore any System Aliases with "Context" or "Iterat" in the name. | |
std::set< std::string > | getOtherSubsystemFilteredConfigAliases (const std::string &otherSubsystemUID, const std::string &otherSubsystemFsmName) |
Ignore any System Aliases with "Context" or "Iterat" in the name. | |
void | getOtherSubsystemConfigAliasInfo (const std::string &otherSubsystemUID, const std::string &configAlias, std::pair< std::string, TableGroupKey > &groupTranslation, std::string &groupComment, std::string &groupAuthor, std::string &groupCreationTime) |
returns configAlias translation group info by reference | |
std::shared_ptr< TableGroupKey > | makeTheTableGroupKey (TableGroupKey key) |
Setters/Modifiers. More... | |
void | restoreActiveTableGroups (bool throwErrors=false, const std::string &pathToActiveGroupsFile="", ConfigurationManager::LoadGroupType onlyLoadIfBackboneOrContext=ConfigurationManager::LoadGroupType::ALL_TYPES, std::string *accumulatedWarnings=0) |
void | setOwnerContext (const std::string &contextUID) |
void | setOwnerApp (const std::string &appUID) |
Static Public Member Functions | |
static void | loadTableInfoThread (ConfigurationManagerRW *cfgMgr, std::string tableName, TableBase *existingTable, std::shared_ptr< ots::TableInfo > tableInfo, std::shared_ptr< std::atomic< bool >> threadDone) |
loadTableInfoThread() | |
static void | loadTableGroupThread (ConfigurationManagerRW *cfgMgr, std::string groupName, ots::TableGroupKey groupKey, std::shared_ptr< ots::GroupInfo > theGroupInfo, std::shared_ptr< std::atomic< bool >> theThreadDone) |
loadTableGroupThread() | |
static void | compareTableGroupThread (ConfigurationManagerRW *cfgMgr, std::string groupName, ots::TableGroupKey groupKeyToCompare, const std::map< std::string, TableVersion > &groupMemberMap, const std::map< std::string, std::string > &memberTableAliases, std::atomic< bool > *theFoundIdentical, ots::TableGroupKey *theIdenticalKey, std::mutex *theThreadMutex, std::shared_ptr< std::atomic< bool >> theThreadDone) |
compareTableGroupThread() | |
![]() | |
static const std::set< std::string > & | getContextMemberNames (void) |
static const std::set< std::string > & | getBackboneMemberNames (void) |
static const std::set< std::string > & | getIterateMemberNames (void) |
static const std::string & | convertGroupTypeToName (const ConfigurationManager::GroupType &groupTypeId) |
static ConfigurationManager::GroupType | getTypeOfGroup (const std::map< std::string, TableVersion > &memberMap) |
static const std::string & | getTypeNameOfGroup (const std::map< std::string, TableVersion > &memberMap) |
static void | saveGroupNameAndKey (const std::pair< std::string, TableGroupKey > &theGroup, const std::string &fileName) |
static std::pair< std::string, TableGroupKey > | loadGroupNameAndKey (const std::string &fileName, std::string &returnedTimeString) |
Additional Inherited Members | |
![]() | |
enum class | GroupType { UNKNOWN_TYPE , CONTEXT_TYPE , BACKBONE_TYPE , ITERATE_TYPE , CONFIGURATION_TYPE } |
enum class | LoadGroupType { ALL_TYPES , ONLY_BACKBONE_OR_CONTEXT_TYPES , ONLY_BACKBONE_TYPE } |
typedef std::map< std::string, std::pair< std::pair< std::string, TableGroupKey >, std::map< std::string, TableVersion > > > | lastGroupLoad_t |
![]() | |
std::set< std::string > | configurationMemberNames_ |
list of 'active' configuration members | |
std::chrono::steady_clock::time_point | startClockTime_ |
std::chrono::steady_clock::time_point | deltaClockTime_ |
![]() | |
static const unsigned int | PROCESSOR_COUNT |
Static members. More... | |
static const std::string | READONLY_USER = "READONLY_USER" |
static const std::string | ACTIVE_GROUPS_FILENAME |
added env check for otsdaq_flatten_active_to_version to function More... | |
static const std::string | ALIAS_VERSION_PREAMBLE = "ALIAS:" |
static const std::string | SCRATCH_VERSION_ALIAS = "Scratch" |
static const std::string | XDAQ_CONTEXT_TABLE_NAME = "XDAQContextTable" |
static const std::string | XDAQ_APPLICATION_TABLE_NAME |
static const std::string | XDAQ_APP_PROPERTY_TABLE_NAME |
static const std::string | GROUP_ALIASES_TABLE_NAME = "GroupAliasesTable" |
static const std::string | VERSION_ALIASES_TABLE_NAME |
static const std::string | ARTDAQ_TOP_TABLE_NAME = "ARTDAQSupervisorTable" |
static const std::string | DESKTOP_ICON_TABLE_NAME = "DesktopIconTable" |
static const std::string | GROUP_TYPE_NAME_CONTEXT = "Context" |
static const std::string | GROUP_TYPE_NAME_BACKBONE = "Backbone" |
static const std::string | GROUP_TYPE_NAME_ITERATE = "Iterate" |
static const std::string | GROUP_TYPE_NAME_CONFIGURATION = "Configuration" |
static const std::string | GROUP_TYPE_NAME_UNKNOWN = "UNKNOWN" |
static const std::string | LAST_TABLE_GROUP_SAVE_PATH |
static const std::string | LAST_ACTIVATED_CONFIG_GROUP_FILE |
static const std::string | LAST_ACTIVATED_CONTEXT_GROUP_FILE |
static const std::string | LAST_ACTIVATED_BACKBONE_GROUP_FILE |
static const std::string | LAST_ACTIVATED_ITERATOR_GROUP_FILE |
static const uint8_t | METADATA_COL_ALIASES = 1 |
static const uint8_t | METADATA_COL_COMMENT = 2 |
static const uint8_t | METADATA_COL_AUTHOR = 3 |
static const uint8_t | METADATA_COL_TIMESTAMP = 4 |
static const std::set< std::string > | contextMemberNames_ |
list of context members More... | |
static const std::set< std::string > | backboneMemberNames_ |
list of backbone members More... | |
static const std::set< std::string > | iterateMemberNames_ |
list of iterate members More... | |
static const std::string | CONTEXT_SUBSYSTEM_OPTIONAL_TABLE |
static const std::string | UNKNOWN_INFO = "UNKNOWN" |
static const std::string | UNKNOWN_TIME = "0" |
![]() | |
std::string | mfSubject_ |
ConfigurationManagerRW This is the ConfigurationManger with write access This class inherits all public function from ConfigurationManager and is a "Friend" class of ConfigurationManager so has access to private members.
Definition at line 53 of file ConfigurationManagerRW.h.
void ConfigurationManagerRW::activateTableGroup | ( | const std::string & | tableGroupName, |
TableGroupKey | tableGroupKey, | ||
std::string * | accumulatedTreeErrors = 0 , |
||
std::string * | groupTypeString = 0 |
||
) |
modifiers of table groups
setActiveGlobalConfiguration load table group and activate deactivates previous table group of same type if necessary
Definition at line 1033 of file ConfigurationManagerRW.cc.
void ConfigurationManagerRW::clearAllCachedVersions | ( | void | ) |
clearAllCachedVersions clear ALL cached persistent versions (does not erase temporary versions)
maintains allTableInfo_ also while erasing (trivial, do nothing)
Definition at line 1411 of file ConfigurationManagerRW.cc.
void ConfigurationManagerRW::clearCachedVersions | ( | const std::string & | tableName | ) |
clearCachedVersions clear ALL cached persistent versions (does not erase temporary versions)
maintains allTableInfo_ also while erasing (trivial, do nothing)
Definition at line 1399 of file ConfigurationManagerRW.cc.
TableVersion ConfigurationManagerRW::createTemporaryBackboneView | ( | TableVersion | sourceViewVersion = TableVersion() | ) |
-1, from MockUp, else from valid backbone view version
createTemporaryBackboneView sourceViewVersion of INVALID is from MockUp, else from valid view version returns temporary version number (which is always negative)
Definition at line 1154 of file ConfigurationManagerRW.cc.
void ConfigurationManagerRW::eraseTemporaryVersion | ( | const std::string & | tableName, |
TableVersion | targetVersion = TableVersion() |
||
) |
eraseTemporaryVersion if version is invalid then erases ALL temporary versions
maintains allTableInfo_ also while erasing
Definition at line 1350 of file ConfigurationManagerRW.cc.
TableGroupKey ConfigurationManagerRW::findTableGroup | ( | const std::string & | groupName, |
const std::map< std::string, TableVersion > & | groupMemberMap, | ||
const std::map< std::string, std::string > & | memberTableAliases = std::map<std::string , std::string >() |
||
) |
findTableGroup return group with same name and same members and same aliases else return invalid key
Note: if aliases, then member alias is matched (not member
Note: this is taking too long when there are a ton of groups. Change to going back only a limited number.. (but the order also comes in alpha order from theInterface_->getAllTableGroupNames which is a problem for choosing the most recent to check. )
Definition at line 1487 of file ConfigurationManagerRW.cc.
const std::map< std::string, TableInfo > & ConfigurationManagerRW::getAllTableInfo | ( | bool | refresh = false , |
std::string * | accumulatedWarnings = 0 , |
||
const std::string & | errorFilterName = "" , |
||
bool | getGroupKeys = false , |
||
bool | getGroupInfo = false , |
||
bool | initializeActiveGroups = false |
||
) |
getAllTableInfo Used by ConfigurationGUISupervisor to get all the info for the existing tables. Can also be used to get and cache group info.
if(accumulatedWarnings) this implies allowing column errors and accumulating such errors in given string
Definition at line 204 of file ConfigurationManagerRW.cc.
const GroupInfo & ConfigurationManagerRW::getGroupInfo | ( | const std::string & | groupName | ) |
public group cache handling
getGroupInfo the interface is slow when there are a lot of groups.. so plan is to maintain local cache of recent group info
Definition at line 1456 of file ConfigurationManagerRW.cc.
std::map< std::string, std::map< std::string, TableVersion > > ConfigurationManagerRW::getVersionAliases | ( | void | ) | const |
getVersionAliases() get version aliases organized by table, for currently active backbone tables add scratch versions to the alias map returned by ConfigurationManager
Definition at line 1011 of file ConfigurationManagerRW.cc.
TableBase * ConfigurationManagerRW::getVersionedTableByName | ( | const std::string & | tableName, |
TableVersion | version, | ||
bool | looseColumnMatching = false , |
||
std::string * | accumulatedErrors = 0 , |
||
bool | getRawData = false |
||
) |
getVersionedTableByName Used by table GUI to load a particular table-version pair as the active version. This table instance must already exist and be owned by ConfigurationManager. return null pointer on failure, on success return table pointer.
Definition at line 1235 of file ConfigurationManagerRW.cc.
TableVersion ConfigurationManagerRW::saveModifiedVersion | ( | const std::string & | tableName, |
TableVersion | originalVersion, | ||
bool | makeTemporary, | ||
TableBase * | table, | ||
TableVersion | temporaryModifiedVersion, | ||
bool | ignoreDuplicates = false , |
||
bool | lookForEquivalent = false , |
||
bool * | foundEquivalent = nullptr |
||
) |
saveModifiedVersionXML
once source version has been modified in temporary version this function finishes it off.
Definition at line 1926 of file ConfigurationManagerRW.cc.
TableVersion ConfigurationManagerRW::saveNewBackbone | ( | TableVersion | temporaryVersion = TableVersion() | ) |
saveNewBackbone makes the new version the active version and returns new version number INVALID will give a new backbone from mockup
Definition at line 1883 of file ConfigurationManagerRW.cc.
TableVersion ConfigurationManagerRW::saveNewTable | ( | const std::string & | tableName, |
TableVersion | temporaryVersion = TableVersion() , |
||
bool | makeTemporary = false |
||
) |
modifiers of generic TableBase
bool saveToScratchVersion)
, bool saveToScratchVersion = false);
saveNewTable saves version, makes the new version the active version, and returns new version
Definition at line 1285 of file ConfigurationManagerRW.cc.
TableGroupKey ConfigurationManagerRW::saveNewTableGroup | ( | const std::string & | groupName, |
std::map< std::string, TableVersion > & | groupMembers, | ||
const std::string & | groupComment = TableViewColumnInfo::DATATYPE_COMMENT_DEFAULT , |
||
std::map< std::string, std::string > * | groupAliases = 0 |
||
) |
modifiers of a table group based on alias, e.g. "Physics"
saveNewTableGroup saves new group and returns the new group key if previousVersion is provided, attempts to just bump that version else, bumps latest version found in db
Note: groupMembers map will get modified with group metadata table version
Definition at line 1722 of file ConfigurationManagerRW.cc.
void ConfigurationManagerRW::testXDAQContext | ( | void | ) |
for debugging
Used for debugging Configuration calls during development.
Definition at line 2473 of file ConfigurationManagerRW.cc.