OmniSciDB  04ee39c94c
Catalog_Namespace::SessionInfo Class Reference

#include <SessionInfo.h>

+ Collaboration diagram for Catalog_Namespace::SessionInfo:

Public Member Functions

 SessionInfo (std::shared_ptr< MapDHandler > mapdHandler, std::shared_ptr< Catalog > cat, const UserMetadata &user, const ExecutorDeviceType t, const std::string &sid)
 
 SessionInfo (std::shared_ptr< Catalog > cat, const UserMetadata &user, const ExecutorDeviceType t, const std::string &sid)
 
 SessionInfo (const SessionInfo &s)
 
MapDHandlerget_mapdHandler () const
 
CataloggetCatalog () const
 
std::shared_ptr< Catalogget_catalog_ptr () const
 
void set_catalog_ptr (std::shared_ptr< Catalog > c)
 
const UserMetadataget_currentUser () const
 
const ExecutorDeviceType get_executor_device_type () const
 
void set_executor_device_type (ExecutorDeviceType t)
 
std::string get_session_id () const
 
time_t get_last_used_time () const
 
void update_last_used_time ()
 
void reset_superuser ()
 
void make_superuser ()
 
bool checkDBAccessPrivileges (const DBObjectType &permissionType, const AccessPrivileges &privs, const std::string &objectName="") const
 
time_t get_start_time () const
 
std::string const & get_public_session_id () const
 
 operator std::string () const
 

Private Member Functions

std::string public_session_id () const
 

Private Attributes

std::shared_ptr< MapDHandlermapdHandler_
 
std::shared_ptr< Catalogcatalog_
 
UserMetadata currentUser_
 
std::atomic< ExecutorDeviceTypeexecutor_device_type_
 
const std::string session_id_
 
std::atomic< time_t > last_used_time_
 
std::atomic< time_t > start_time_
 
const std::string public_session_id_
 

Detailed Description

Definition at line 62 of file SessionInfo.h.

Constructor & Destructor Documentation

◆ SessionInfo() [1/3]

Catalog_Namespace::SessionInfo::SessionInfo ( std::shared_ptr< MapDHandler mapdHandler,
std::shared_ptr< Catalog cat,
const UserMetadata user,
const ExecutorDeviceType  t,
const std::string &  sid 
)
inline

Definition at line 64 of file SessionInfo.h.

69  : mapdHandler_(mapdHandler)
70  , catalog_(cat)
73  , session_id_(sid)
74  , last_used_time_(time(0))
75  , start_time_(time(0))
std::shared_ptr< Catalog > catalog_
Definition: SessionInfo.h:112
const std::string session_id_
Definition: SessionInfo.h:115
const std::string public_session_id_
Definition: SessionInfo.h:118
std::atomic< time_t > last_used_time_
Definition: SessionInfo.h:116
std::shared_ptr< MapDHandler > mapdHandler_
Definition: SessionInfo.h:111
std::atomic< time_t > start_time_
Definition: SessionInfo.h:117
std::atomic< ExecutorDeviceType > executor_device_type_
Definition: SessionInfo.h:114
std::string public_session_id() const
Definition: SessionInfo.cpp:43

◆ SessionInfo() [2/3]

Catalog_Namespace::SessionInfo::SessionInfo ( std::shared_ptr< Catalog cat,
const UserMetadata user,
const ExecutorDeviceType  t,
const std::string &  sid 
)
inline

Definition at line 77 of file SessionInfo.h.

81  : SessionInfo(std::make_shared<MapDHandler>(), cat, user, t, sid) {}
SessionInfo(std::shared_ptr< MapDHandler > mapdHandler, std::shared_ptr< Catalog > cat, const UserMetadata &user, const ExecutorDeviceType t, const std::string &sid)
Definition: SessionInfo.h:64

◆ SessionInfo() [3/3]

Catalog_Namespace::SessionInfo::SessionInfo ( const SessionInfo s)
inline

Definition at line 82 of file SessionInfo.h.

83  : mapdHandler_(s.mapdHandler_)
84  , catalog_(s.catalog_)
85  , currentUser_(s.currentUser_)
86  , executor_device_type_(static_cast<ExecutorDeviceType>(s.executor_device_type_))
87  , session_id_(s.session_id_)
88  , public_session_id_(s.public_session_id_) {}
std::shared_ptr< Catalog > catalog_
Definition: SessionInfo.h:112
const std::string session_id_
Definition: SessionInfo.h:115
const std::string public_session_id_
Definition: SessionInfo.h:118
std::shared_ptr< MapDHandler > mapdHandler_
Definition: SessionInfo.h:111
std::atomic< ExecutorDeviceType > executor_device_type_
Definition: SessionInfo.h:114

Member Function Documentation

◆ checkDBAccessPrivileges()

bool Catalog_Namespace::SessionInfo::checkDBAccessPrivileges ( const DBObjectType permissionType,
const AccessPrivileges privs,
const std::string &  objectName = "" 
) const

Definition at line 24 of file SessionInfo.cpp.

References Catalog_Namespace::SysCatalog::checkPrivileges(), DatabaseDBObjectType, get_currentUser(), getCatalog(), Catalog_Namespace::SysCatalog::instance(), and anonymous_namespace{DBObjectPrivilegesTest.cpp}::privObjects.

Referenced by Parser::CreateTableStmt::execute(), Parser::CreateTableAsSelectStmt::execute(), Parser::DropTableStmt::execute(), Parser::CreateViewStmt::execute(), Parser::DropViewStmt::execute(), and Parser::InsertIntoTableAsSelectStmt::populateData().

26  {
27  auto& cat = getCatalog();
28  // run flow with DB object level access permission checks
29  DBObject object(objectName, permissionType);
30  if (permissionType == DBObjectType::DatabaseDBObjectType) {
31  object.setName(cat.getCurrentDB().dbName);
32  }
33  object.loadKey(cat);
34  object.setPrivileges(privs);
35  std::vector<DBObject> privObjects;
36  privObjects.push_back(object);
37  return SysCatalog::instance().checkPrivileges(get_currentUser(), privObjects);
38 }
const UserMetadata & get_currentUser() const
Definition: SessionInfo.h:93
static SysCatalog & instance()
Definition: SysCatalog.h:240
Catalog & getCatalog() const
Definition: SessionInfo.h:90
bool checkPrivileges(const UserMetadata &user, const std::vector< DBObject > &privObjects) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_catalog_ptr()

std::shared_ptr<Catalog> Catalog_Namespace::SessionInfo::get_catalog_ptr ( ) const
inline

Definition at line 91 of file SessionInfo.h.

91 { return catalog_; }
std::shared_ptr< Catalog > catalog_
Definition: SessionInfo.h:112

◆ get_currentUser()

◆ get_executor_device_type()

const ExecutorDeviceType Catalog_Namespace::SessionInfo::get_executor_device_type ( ) const
inline

Definition at line 94 of file SessionInfo.h.

Referenced by MapDHandler::execute_rel_alg_df(), and Parser::getResultSet().

94  {
95  return executor_device_type_;
96  }
std::atomic< ExecutorDeviceType > executor_device_type_
Definition: SessionInfo.h:114
+ Here is the caller graph for this function:

◆ get_last_used_time()

time_t Catalog_Namespace::SessionInfo::get_last_used_time ( ) const
inline

Definition at line 99 of file SessionInfo.h.

99 { return last_used_time_; }
std::atomic< time_t > last_used_time_
Definition: SessionInfo.h:116

◆ get_mapdHandler()

MapDHandler* Catalog_Namespace::SessionInfo::get_mapdHandler ( ) const
inline

Definition at line 89 of file SessionInfo.h.

Referenced by Parser::AddColumnStmt::execute().

89 { return mapdHandler_.get(); }
std::shared_ptr< MapDHandler > mapdHandler_
Definition: SessionInfo.h:111
+ Here is the caller graph for this function:

◆ get_public_session_id()

std::string const& Catalog_Namespace::SessionInfo::get_public_session_id ( ) const
inline

Definition at line 107 of file SessionInfo.h.

Referenced by Catalog_Namespace::operator<<().

107 { return public_session_id_; }
const std::string public_session_id_
Definition: SessionInfo.h:118
+ Here is the caller graph for this function:

◆ get_session_id()

std::string Catalog_Namespace::SessionInfo::get_session_id ( ) const
inline

Definition at line 98 of file SessionInfo.h.

Referenced by Parser::AddColumnStmt::execute(), Parser::ExportQueryStmt::execute(), Calcite::getCompletionHints(), and Calcite::processImpl().

98 { return session_id_; }
const std::string session_id_
Definition: SessionInfo.h:115
+ Here is the caller graph for this function:

◆ get_start_time()

time_t Catalog_Namespace::SessionInfo::get_start_time ( ) const
inline

Definition at line 106 of file SessionInfo.h.

Referenced by public_session_id().

106 { return start_time_; }
std::atomic< time_t > start_time_
Definition: SessionInfo.h:117
+ Here is the caller graph for this function:

◆ getCatalog()

Catalog& Catalog_Namespace::SessionInfo::getCatalog ( ) const
inline

Definition at line 90 of file SessionInfo.h.

Referenced by Parser::check_alter_table_privilege(), Parser::AddColumnStmt::check_executable(), MapDHandler::check_table_load_privileges(), checkDBAccessPrivileges(), checkPermissionForTables(), Parser::InsertIntoTableAsSelectStmt::LocalConnector::checkpoint(), anonymous_namespace{ExecuteTest.cpp}::create_and_populate_tables(), Executor::execute(), Parser::CreateTableStmt::execute(), Parser::CreateTableAsSelectStmt::execute(), Parser::DropTableStmt::execute(), Parser::TruncateTableStmt::execute(), Parser::RenameTableStmt::execute(), Parser::RenameColumnStmt::execute(), Parser::AddColumnStmt::execute(), Parser::CopyTableStmt::execute(), Parser::GrantPrivilegesStmt::execute(), Parser::RevokePrivilegesStmt::execute(), Parser::ShowPrivilegesStmt::execute(), Parser::ExportQueryStmt::execute(), Parser::CreateViewStmt::execute(), Parser::DropViewStmt::execute(), MapDHandler::execute_rel_alg(), MapDHandler::execute_rel_alg_df(), Calcite::getCompletionHints(), Parser::getResultSet(), anonymous_namespace{ExecuteTest.cpp}::import_array_test(), Fragmenter_Namespace::InsertDataLoader::insertData(), Parser::InsertIntoTableAsSelectStmt::LocalConnector::insertDataToLeaf(), is_allowed_on_dashboard(), MapDHandler::parse_to_plan(), MapDHandler::parse_to_plan_legacy(), Parser::InsertIntoTableAsSelectStmt::populateData(), MapDHandler::prepare_columnar_loader(), Calcite::processImpl(), Parser::InsertIntoTableAsSelectStmt::LocalConnector::query(), Parser::InsertIntoTableAsSelectStmt::LocalConnector::rollback(), MapDHandler::sql_execute_impl(), TEST(), MapDHandler::user_can_access_table(), and MapDHandler::validate_rel_alg().

90 { return *catalog_; }
std::shared_ptr< Catalog > catalog_
Definition: SessionInfo.h:112
+ Here is the caller graph for this function:

◆ make_superuser()

void Catalog_Namespace::SessionInfo::make_superuser ( )
inline

Definition at line 102 of file SessionInfo.h.

◆ operator std::string()

Catalog_Namespace::SessionInfo::operator std::string ( ) const
inline

Definition at line 108 of file SessionInfo.h.

108 { return public_session_id_; }
const std::string public_session_id_
Definition: SessionInfo.h:118

◆ public_session_id()

std::string Catalog_Namespace::SessionInfo::public_session_id ( ) const
private

Definition at line 43 of file SessionInfo.cpp.

References get_start_time(), session_id_, and run-benchmark-import::start_time.

43  {
44  const time_t start_time = get_start_time();
45  struct tm st;
46  localtime_r(&start_time, &st);
47  std::ostringstream ss;
48  ss << (st.tm_min % 10) << std::setfill('0') << std::setw(2) << st.tm_sec << '-'
49  << session_id_.substr(0, 4);
50  return ss.str();
51 }
const std::string session_id_
Definition: SessionInfo.h:115
+ Here is the call graph for this function:

◆ reset_superuser()

void Catalog_Namespace::SessionInfo::reset_superuser ( )
inline

◆ set_catalog_ptr()

void Catalog_Namespace::SessionInfo::set_catalog_ptr ( std::shared_ptr< Catalog c)
inline

Definition at line 92 of file SessionInfo.h.

References anonymous_namespace{ExecuteTest.cpp}::c().

92 { catalog_ = c; }
std::shared_ptr< Catalog > catalog_
Definition: SessionInfo.h:112
void c(const std::string &query_string, const ExecutorDeviceType device_type)
+ Here is the call graph for this function:

◆ set_executor_device_type()

void Catalog_Namespace::SessionInfo::set_executor_device_type ( ExecutorDeviceType  t)
inline

Definition at line 97 of file SessionInfo.h.

Referenced by MapDHandler::set_execution_mode_nolock().

97 { executor_device_type_ = t; }
std::atomic< ExecutorDeviceType > executor_device_type_
Definition: SessionInfo.h:114
+ Here is the caller graph for this function:

◆ update_last_used_time()

void Catalog_Namespace::SessionInfo::update_last_used_time ( )
inline

Definition at line 100 of file SessionInfo.h.

100 { last_used_time_ = time(0); }
std::atomic< time_t > last_used_time_
Definition: SessionInfo.h:116

Member Data Documentation

◆ catalog_

std::shared_ptr<Catalog> Catalog_Namespace::SessionInfo::catalog_
private

Definition at line 112 of file SessionInfo.h.

◆ currentUser_

UserMetadata Catalog_Namespace::SessionInfo::currentUser_
private

Definition at line 113 of file SessionInfo.h.

◆ executor_device_type_

std::atomic<ExecutorDeviceType> Catalog_Namespace::SessionInfo::executor_device_type_
private

Definition at line 114 of file SessionInfo.h.

◆ last_used_time_

std::atomic<time_t> Catalog_Namespace::SessionInfo::last_used_time_
private

Definition at line 116 of file SessionInfo.h.

◆ mapdHandler_

std::shared_ptr<MapDHandler> Catalog_Namespace::SessionInfo::mapdHandler_
private

Definition at line 111 of file SessionInfo.h.

◆ public_session_id_

const std::string Catalog_Namespace::SessionInfo::public_session_id_
private

Definition at line 118 of file SessionInfo.h.

◆ session_id_

const std::string Catalog_Namespace::SessionInfo::session_id_
private

Definition at line 115 of file SessionInfo.h.

Referenced by public_session_id().

◆ start_time_

std::atomic<time_t> Catalog_Namespace::SessionInfo::start_time_
private

Definition at line 117 of file SessionInfo.h.


The documentation for this class was generated from the following files: