OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lockmgr::helpers Namespace Reference

Functions

ChunkKey chunk_key_for_table (const Catalog_Namespace::Catalog &cat, const std::string &tableName)
 
template<typename LOCK_TYPE , typename LOCK_MGR_TYPE >
LOCK_TYPE getLockForKeyImpl (const ChunkKey &chunk_key)
 
template<typename LOCK_TYPE , typename LOCK_MGR_TYPE >
LOCK_TYPE getLockForTableImpl (const Catalog_Namespace::Catalog &cat, const std::string &table_name)
 

Function Documentation

ChunkKey lockmgr::helpers::chunk_key_for_table ( const Catalog_Namespace::Catalog cat,
const std::string &  tableName 
)

Definition at line 25 of file LockMgr.cpp.

References Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::DBMetadata::dbName, Catalog_Namespace::Catalog::getCurrentDB(), and Catalog_Namespace::Catalog::getTableId().

Referenced by getLockForTableImpl().

26  {
27  const auto table_id = cat.getTableId(tableName);
28  if (table_id.has_value()) {
29  ChunkKey chunk_key{cat.getCurrentDB().dbId, table_id.value()};
30  return chunk_key;
31  } else {
33  }
34 }
std::vector< int > ChunkKey
Definition: types.h:36
std::optional< int32_t > getTableId(const std::string &table_name) const
Definition: Catalog.cpp:1881
const DBMetadata & getCurrentDB() const
Definition: Catalog.h:265

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename LOCK_TYPE , typename LOCK_MGR_TYPE >
LOCK_TYPE lockmgr::helpers::getLockForKeyImpl ( const ChunkKey chunk_key)

Definition at line 116 of file LockMgrImpl.h.

References lockmgr::instance().

116  {
117  auto& table_lock_mgr = LOCK_MGR_TYPE::instance();
118  return LOCK_TYPE(table_lock_mgr.getTableMutex(chunk_key));
119 }
T & instance()
Definition: LockMgr.cpp:101

+ Here is the call graph for this function:

template<typename LOCK_TYPE , typename LOCK_MGR_TYPE >
LOCK_TYPE lockmgr::helpers::getLockForTableImpl ( const Catalog_Namespace::Catalog cat,
const std::string &  table_name 
)

Definition at line 122 of file LockMgrImpl.h.

References chunk_key_for_table(), and lockmgr::instance().

123  {
124  const auto chunk_key = chunk_key_for_table(cat, table_name);
125 
126  auto& table_lock_mgr = LOCK_MGR_TYPE::instance();
127  return LOCK_TYPE(table_lock_mgr.getTableMutex(chunk_key));
128 }
ChunkKey chunk_key_for_table(const Catalog_Namespace::Catalog &cat, const std::string &tableName)
Definition: LockMgr.cpp:25
T & instance()
Definition: LockMgr.cpp:101

+ Here is the call graph for this function: