OmniSciDB  b28c0d5765
 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:36
std::optional< int32_t > getTableId(const std::string &table_name) const
Definition: Catalog.cpp:1950
const DBMetadata & getCurrentDB() const
Definition: Catalog.h:242

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

168  {
169  auto& table_lock_mgr = LOCK_MGR_TYPE::instance();
170  return LOCK_TYPE(table_lock_mgr.getTableMutex(chunk_key));
171 }
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 174 of file LockMgrImpl.h.

References chunk_key_for_table().

175  {
176  const auto chunk_key = chunk_key_for_table(cat, table_name);
177 
178  auto& table_lock_mgr = LOCK_MGR_TYPE::instance();
179  return LOCK_TYPE(table_lock_mgr.getTableMutex(chunk_key));
180 }
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: