ATLAS Offline Software
|
Hold DataProxy instances associated with a store. More...
#include <DataStore.h>
Public Types | |
typedef IStringPool::sgkey_t | sgkey_t |
typedef std::map< CLID, SG::ProxyMap > | StoreMap |
typedef StoreMap::iterator | StoreIterator |
typedef StoreMap::const_iterator | ConstStoreIterator |
typedef std::pair< SG::ConstProxyIterator, SG::ConstProxyIterator > | constProxyRange |
Public Member Functions | |
DataStore (IProxyDict &pool) | |
Constructor. More... | |
virtual | ~DataStore () |
void | setStoreID (StoreID::type id) |
virtual StoreID::type | storeID () const |
void | clearStore (bool force, bool hard, MsgStream *pmlog) |
If HARD is true, then the bound objects should also clear any data that depends on the identity of the current event store. More... | |
Implementation of IProxyRegistry. | |
using | KeyMap_t = CxxUtils::ConcurrentMap< sgkey_t, DataProxy *, CxxUtils::SimpleUpdater, SGKeyHash, SGKeyEqual, 0, s_nullval > |
IProxyDict & | m_pool |
The string pool associated with this store. More... | |
std::vector< DataProxy * > | m_proxies |
All proxies managed by this store. More... | |
StoreMap | m_storeMap |
Maps locating proxies by clid/key. More... | |
KeyMap_t | m_keyMap |
StoreID::type | m_storeID |
T2pMap | m_t2p |
SmartIF< ISGAudSvc > | m_pSGAudSvc |
bool | m_noAudSvc |
ISvcLocator * | m_pSvcLoc |
static constexpr CxxUtils::detail::ConcurrentHashmapVal_t | s_nullval |
Map of hashed sgkey -> DataProxy. More... | |
virtual StatusCode | addToStore (const CLID &id, DataProxy *proxy) |
add proxy to store. More... | |
virtual DataProxy * | proxy (const TransientAddress *tAddr) const |
return proxy for a given type/key pair if key is empty returns the default proxy (currently last registered) More... | |
virtual DataProxy * | proxy (const CLID &id, const std::string &key=SG::DEFAULTKEY) const |
get proxy with given id. Returns 0 to flag failure More... | |
SG::DataProxy * | proxy_exact (sgkey_t sgkey) const |
get proxy with given key. More... | |
SG::DataProxy * | proxy_exact_unlocked (sgkey_t sgkey, std::recursive_mutex &mutex) const |
Like proxy_exact, but intended to be called without holding the store lock. More... | |
virtual SG::DataProxy * | proxy_exact (const CLID &id, const std::string &key) const |
get proxy with given id. More... | |
StatusCode | removeProxy (DataProxy *proxy, bool forceRemove, bool hard) |
remove proxy from store, unless proxy is reset only. More... | |
StatusCode | addSymLink (const CLID &linkid, DataProxy *proxy) |
add symlink to store: More... | |
StatusCode | addAlias (const std::string &aliasKey, DataProxy *proxy) |
add alias to store More... | |
int | typeCount (const CLID &id) const |
Count number of object of a given type in store. More... | |
StatusCode | tRange (ConstStoreIterator &f, ConstStoreIterator &e) const |
Return an iterator over the StoreMap: More... | |
StatusCode | pRange (const CLID &id, SG::ConstProxyIterator &f, SG::ConstProxyIterator &e) const |
Return an iterator over proxy for a given CLID: More... | |
void | setPac (IPageAccessControlSvc *pac) |
set IPageAccessControlSvc ptr in T2PMap More... | |
std::vector< const DataProxy * > | pacReport () const |
request an access control report, i.e. a list of proxies that have not been accessed since monitored More... | |
StatusCode | t2pRegister (const void *const pTrans, DataProxy *const pPers) |
methods to query the T2PMap: More... | |
void | t2pRemove (const void *const pTrans) |
DataProxy * | locatePersistent (const void *const pTransient) const |
locate the persistent (proxy) for a given T* (void*): More... | |
void | keys (const CLID &id, std::vector< std::string > &vkeys, bool includeAlias, bool onlyValid) |
const std::vector< DataProxy * > & | proxies () const |
All proxies managed by this store. More... | |
void | setSGAudSvc () |
bool | doAudit () |
StatusCode | setSvcLoc () |
DataProxy * | findDummy (CLID id, const std::string &key) |
Look for (and convert) a matching dummy proxy. More... | |
StatusCode | removeFromKeyMap (DataProxy *proxy) |
Remove a proxy from m_keyMap. More... | |
StatusCode | removeProxyImpl (DataProxy *proxy, int index) |
Helper for removing a proxy. More... | |
Hold DataProxy instances associated with a store.
We hold proxies in several ways, for efficiency.
First, all proxies that we manage are entered in the m_proxies vector. A given proxy appears only once in this list.
Second, m_keyMap stores proxies indexed by the hashed CLID/key. A proxy may be entered here multiple times in the case of symlinks or alias; however, the entry corresponding to what proxy->sgkey() returns is called the ‘primary’ entry.
Third, proxies are stored by CLID/key in m_storeMap. This is a map indexed by CLID; the values are maps indexed by key. A proxy may again be stored several times in this map in the case of symlinks/aliases.
A proxy may be given to the store that has the hashed key set, but not the CLID/key. This is referred to as a ‘dummy’ proxy. This can happen when we read a link to an object that's not described in the event's DataHeader. In this case, the proxy is entered in m_proxies and m_keyMap, but not in m_storeMap. If we later look for a proxy by CLID/key and don't find it, we also look in m_keyMap to see if a dummy proxy has been entered there. If so, that point we fill in the CLID/key fields of the proxy and also enter it in m_storeMap.
Definition at line 73 of file Control/SGTools/SGTools/DataStore.h.
typedef std::pair<SG::ConstProxyIterator, SG::ConstProxyIterator> SG::DataStore::constProxyRange |
Definition at line 83 of file Control/SGTools/SGTools/DataStore.h.
typedef StoreMap::const_iterator SG::DataStore::ConstStoreIterator |
Definition at line 81 of file Control/SGTools/SGTools/DataStore.h.
|
private |
Definition at line 189 of file Control/SGTools/SGTools/DataStore.h.
Definition at line 78 of file Control/SGTools/SGTools/DataStore.h.
typedef StoreMap::iterator SG::DataStore::StoreIterator |
Definition at line 80 of file Control/SGTools/SGTools/DataStore.h.
typedef std::map<CLID, SG::ProxyMap> SG::DataStore::StoreMap |
Definition at line 79 of file Control/SGTools/SGTools/DataStore.h.
DataStore::DataStore | ( | IProxyDict & | pool | ) |
Constructor.
pool | The string pool associated with this store. |
Definition at line 31 of file Control/SGTools/src/DataStore.cxx.
|
virtual |
Definition at line 42 of file Control/SGTools/src/DataStore.cxx.
add alias to store
Implements IProxyRegistry.
Definition at line 377 of file Control/SGTools/src/DataStore.cxx.
add proxy to store.
If this proxy has not yet been added to the store, then make an entry for it in m_proxies.
Implements IProxyRegistry.
Definition at line 139 of file Control/SGTools/src/DataStore.cxx.
void DataStore::clearStore | ( | bool | force, |
bool | hard, | ||
MsgStream * | pmlog | ||
) |
If HARD is true, then the bound objects should also clear any data that depends on the identity of the current event store.
(See IResetable.h.)
Be careful with changing this — it's important for performance for some analysis use cases.
Rather than dealing with erasures in m_keyMap, we first do the removals just from m_storeMap, remembering along the way the set of reset-only proxies. Then we run through the entries in m_keyMap and copy all that match one of the reset-only proxies to a new map and then swap. (We can't ask the proxy itself if it's reset-only at this point because if it isn't, it'll have been deleted.)
Go through the list of unique proxies, and run requestRelease() on each. If that returns true, then we're meant to remove this proxy from the store. Be careful that removing a proxy from the store will modify the m_proxies list, so if the proxy is successfully removed, we should not bump the index.
Definition at line 68 of file Control/SGTools/src/DataStore.cxx.
|
inlineprivate |
Definition at line 206 of file Control/SGTools/SGTools/DataStore.h.
Look for (and convert) a matching dummy proxy.
id | The CLID for which to search. |
key | The key for which to search. |
In some cases, we may enter into the store a ‘dummy’ proxy, which is identified only by the hashed CLID/key pair. (This can happen when we have a link to an object that's not listed in the DataHeader; in this case, we know the only hashed key and not the CLID or key.)
This function is called after we fail to find a proxy by CLID/key. It additionally checks to see if there exists a dummy proxy with a hash matching this CLID/key. If so, the CLID/key are filled in in the proxy, and the proxy is entered in m_storeMap.
Returns either the matching proxy or 0.
Definition at line 505 of file Control/SGTools/src/DataStore.cxx.
void DataStore::keys | ( | const CLID & | id, |
std::vector< std::string > & | vkeys, | ||
bool | includeAlias, | ||
bool | onlyValid | ||
) |
Definition at line 118 of file Control/SGTools/src/DataStore.cxx.
locate the persistent (proxy) for a given T* (void*):
Definition at line 606 of file Control/SGTools/src/DataStore.cxx.
request an access control report, i.e. a list of proxies that have not been accessed since monitored
Definition at line 156 of file Control/SGTools/SGTools/DataStore.h.
StatusCode DataStore::pRange | ( | const CLID & | id, |
SG::ConstProxyIterator & | f, | ||
SG::ConstProxyIterator & | e | ||
) | const |
Return an iterator over proxy for a given CLID:
Definition at line 574 of file Control/SGTools/src/DataStore.cxx.
All proxies managed by this store.
Every proxy appears exactly once in this list.
Definition at line 627 of file Control/SGTools/src/DataStore.cxx.
|
virtual |
get proxy with given id. Returns 0 to flag failure
Implements IProxyRegistry.
Definition at line 420 of file Control/SGTools/src/DataStore.cxx.
|
virtual |
return proxy for a given type/key pair if key is empty returns the default proxy (currently last registered)
Implements IProxyRegistry.
Definition at line 414 of file Control/SGTools/src/DataStore.cxx.
get proxy with given id.
get proxy with given key.
Returns 0 to flag failure the key must match exactly (no wild carding for the default key)
Implements IProxyRegistry.
Definition at line 562 of file Control/SGTools/src/DataStore.cxx.
get proxy with given key.
Returns 0 to flag failure the key must match exactly (no wild carding for the default key)
Definition at line 524 of file Control/SGTools/src/DataStore.cxx.
Like proxy_exact, but intended to be called without holding the store lock.
However, the store lock still must be passed as an argument; it will be acquired should be need to call the auditor service.
Definition at line 543 of file Control/SGTools/src/DataStore.cxx.
|
private |
Remove a proxy from m_keyMap.
proxy | The proxy being removed. |
Definition at line 234 of file Control/SGTools/src/DataStore.cxx.
StatusCode DataStore::removeProxy | ( | DataProxy * | proxy, |
bool | forceRemove, | ||
bool | hard | ||
) |
remove proxy from store, unless proxy is reset only.
forceRemove | remove the proxy no matter what If HARD is true, then the bound objects should also clear any data that depends on the identity of the current event store. (See IResetable.h.) |
Definition at line 196 of file Control/SGTools/src/DataStore.cxx.
|
private |
Helper for removing a proxy.
proxy | The proxy being removed. |
index | The index of this proxy in m_proxies. |
This removes the proxy from m_storeMap and releases it, but does NOT remove it from m_keyMap.
Definition at line 262 of file Control/SGTools/src/DataStore.cxx.
|
inline |
set IPageAccessControlSvc ptr in T2PMap
Definition at line 154 of file Control/SGTools/SGTools/DataStore.h.
|
private |
Definition at line 54 of file Control/SGTools/src/DataStore.cxx.
|
inline |
Definition at line 92 of file Control/SGTools/SGTools/DataStore.h.
|
private |
Definition at line 47 of file Control/SGTools/src/DataStore.cxx.
|
inlinevirtual |
methods to query the T2PMap:
Definition at line 613 of file Control/SGTools/src/DataStore.cxx.
Definition at line 256 of file Control/SGTools/SGTools/DataStore.h.
StatusCode DataStore::tRange | ( | ConstStoreIterator & | f, |
ConstStoreIterator & | e | ||
) | const |
Return an iterator over the StoreMap:
Definition at line 596 of file Control/SGTools/src/DataStore.cxx.
Count number of object of a given type in store.
Definition at line 405 of file Control/SGTools/src/DataStore.cxx.
|
private |
Definition at line 194 of file Control/SGTools/SGTools/DataStore.h.
|
private |
Definition at line 205 of file Control/SGTools/SGTools/DataStore.h.
|
private |
The string pool associated with this store.
Definition at line 176 of file Control/SGTools/SGTools/DataStore.h.
|
private |
All proxies managed by this store.
Every proxy appears exactly once in this list.
Definition at line 180 of file Control/SGTools/SGTools/DataStore.h.
|
private |
Definition at line 204 of file Control/SGTools/SGTools/DataStore.h.
|
private |
Definition at line 211 of file Control/SGTools/SGTools/DataStore.h.
|
private |
Definition at line 196 of file Control/SGTools/SGTools/DataStore.h.
|
private |
Maps locating proxies by clid/key.
Definition at line 183 of file Control/SGTools/SGTools/DataStore.h.
|
private |
Definition at line 201 of file Control/SGTools/SGTools/DataStore.h.
|
staticconstexprprivate |
Map of hashed sgkey -> DataProxy.
Definition at line 187 of file Control/SGTools/SGTools/DataStore.h.