OmniSciDB  085a039ca4
 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 32 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().

33  {
34  const auto table_id = cat.getTableId(tableName);
35  if (table_id.has_value()) {
36  ChunkKey chunk_key{cat.getCurrentDB().dbId, table_id.value()};
37  return chunk_key;
38  } else {
39  throw std::runtime_error("Table/View " + tableName + " for catalog " +
40  cat.getCurrentDB().dbName + " does not exist");
41  }
42 }
std::vector< int > ChunkKey
Definition: types.h:37
std::optional< int32_t > getTableId(const std::string &table_name) const
Definition: Catalog.cpp:1647
const DBMetadata & getCurrentDB() const
Definition: Catalog.h:228

+ 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 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 }
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: