OmniSciDB  62f1aeabe6
LockMgr.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "LockMgr/LockMgrImpl.h"
18 
19 #include <string>
20 
21 #include "Catalog/Catalog.h"
22 #include "LockMgr/LegacyLockMgr.h"
25 #include "Shared/types.h"
26 #include "gen-cpp/CalciteServer.h"
27 
28 namespace lockmgr {
29 
30 namespace helpers {
31 
33  const std::string& tableName) {
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 }
41 
42 } // namespace helpers
43 
44 } // namespace lockmgr
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:86
const TableDescriptor * getMetadataForTable(const std::string &tableName, const bool populateFragmenter=true) const
Returns a pointer to a const TableDescriptor struct matching the provided tableName.
This file contains the class specification and related data structures for Catalog.
std::string cat(Ts &&... args)
const DBMetadata & getCurrentDB() const
Definition: Catalog.h:194
ChunkKey chunk_key_for_table(const Catalog_Namespace::Catalog &cat, const std::string &tableName)
Definition: LockMgr.cpp:32
std::vector< int > ChunkKey
Definition: types.h:35