OmniSciDB  2e3a973ef4
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

◆ chunk_key_for_table()

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

Definition at line 32 of file LockMgr.cpp.

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

Referenced by getLockForTableImpl().

33  {
34  if (const auto tdp = cat.getMetadataForTable(tableName, false)) {
35  ChunkKey chunk_key{cat.getCurrentDB().dbId, tdp->tableId};
36  return chunk_key;
37  } else {
38  throw std::runtime_error("Table/View " + tableName + " does not exist.");
39  }
40 }
const TableDescriptor * getMetadataForTable(const std::string &tableName, const bool populateFragmenter=true) const
Returns a pointer to a const TableDescriptor struct matching the provided tableName.
const DBMetadata & getCurrentDB() const
Definition: Catalog.h:208
std::vector< int > ChunkKey
Definition: types.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLockForKeyImpl()

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

Definition at line 113 of file LockMgrImpl.h.

113  {
114  auto& table_lock_mgr = LOCK_MGR_TYPE::instance();
115  return LOCK_TYPE(table_lock_mgr.getTableMutex(chunk_key));
116 }

◆ getLockForTableImpl()

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 119 of file LockMgrImpl.h.

References chunk_key_for_table().

120  {
121  const auto chunk_key = chunk_key_for_table(cat, table_name);
122 
123  auto& table_lock_mgr = LOCK_MGR_TYPE::instance();
124  return LOCK_TYPE(table_lock_mgr.getTableMutex(chunk_key));
125 }
ChunkKey chunk_key_for_table(const Catalog_Namespace::Catalog &cat, const std::string &tableName)
Definition: LockMgr.cpp:32
+ Here is the call graph for this function: