OmniSciDB  a667adc9c8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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::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 + " for catalog " +
39  cat.getCurrentDB().dbName +
40  " does not exist, could not generate chunk key");
41  }
42 }
std::vector< int > ChunkKey
Definition: types.h:37
const DBMetadata & getCurrentDB() const
Definition: Catalog.h:221
const TableDescriptor * getMetadataForTable(const std::string &tableName, const bool populateFragmenter=true) const
Returns a pointer to a const TableDescriptor struct matching the provided tableName.

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