OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::InternalCatalogDataWrapper Class Reference

#include <InternalCatalogDataWrapper.h>

+ Inheritance diagram for foreign_storage::InternalCatalogDataWrapper:
+ Collaboration diagram for foreign_storage::InternalCatalogDataWrapper:

Public Member Functions

 InternalCatalogDataWrapper ()
 
 InternalCatalogDataWrapper (const int db_id, const ForeignTable *foreign_table)
 
- Public Member Functions inherited from foreign_storage::InternalSystemDataWrapper
 InternalSystemDataWrapper ()
 
 InternalSystemDataWrapper (const int db_id, const ForeignTable *foreign_table)
 
void populateChunkMetadata (ChunkMetadataVector &chunk_metadata_vector) override
 
void populateChunkBuffers (const ChunkToBufferMap &required_buffers, const ChunkToBufferMap &optional_buffers) override
 
void validateServerOptions (const ForeignServer *foreign_server) const override
 
void validateTableOptions (const ForeignTable *foreign_table) const override
 
const std::set
< std::string_view > & 
getSupportedTableOptions () const override
 
void validateUserMappingOptions (const UserMapping *user_mapping, const ForeignServer *foreign_server) const override
 
const std::set
< std::string_view > & 
getSupportedUserMappingOptions () const override
 
std::string getSerializedDataWrapper () const override
 
void restoreDataWrapperInternals (const std::string &file_path, const ChunkMetadataVector &chunk_metadata) override
 
bool isRestored () const override
 
- Public Member Functions inherited from foreign_storage::ForeignDataWrapper
 ForeignDataWrapper ()=default
 
virtual ~ForeignDataWrapper ()=default
 
virtual void validateSchema (const std::list< ColumnDescriptor > &columns) const
 
virtual ParallelismLevel getCachedParallelismLevel () const
 
virtual ParallelismLevel getNonCachedParallelismLevel () const
 

Private Member Functions

void initializeObjectsForTable (const std::string &table_name) override
 
void populateChunkBuffersForTable (const std::string &table_name, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers) override
 

Private Attributes

std::list
< Catalog_Namespace::UserMetadata
users_
 
std::map< int32_t, std::vector
< TableDescriptor > > 
tables_by_database_
 
std::map< int32_t, std::vector
< DashboardDescriptor > > 
dashboards_by_database_
 
std::vector< ObjectRoleDescriptorobject_permissions_
 
std::list
< Catalog_Namespace::DBMetadata
databases_
 
std::set< std::string > roles_
 
std::map< std::string,
std::vector< std::string > > 
user_names_by_role_
 

Additional Inherited Members

- Public Types inherited from foreign_storage::ForeignDataWrapper
enum  ParallelismLevel { NONE, INTRA_FRAGMENT, INTER_FRAGMENT }
 
- Protected Attributes inherited from foreign_storage::InternalSystemDataWrapper
const int db_id_
 
const ForeignTableforeign_table_
 
size_t row_count_ {0}
 

Detailed Description

Definition at line 28 of file InternalCatalogDataWrapper.h.

Constructor & Destructor Documentation

foreign_storage::InternalCatalogDataWrapper::InternalCatalogDataWrapper ( )
foreign_storage::InternalCatalogDataWrapper::InternalCatalogDataWrapper ( const int  db_id,
const ForeignTable foreign_table 
)

Member Function Documentation

void foreign_storage::InternalCatalogDataWrapper::initializeObjectsForTable ( const std::string &  table_name)
overrideprivatevirtual

Implements foreign_storage::InternalSystemDataWrapper.

Definition at line 374 of file InternalCatalogDataWrapper.cpp.

References dashboards_by_database_, Catalog_Namespace::DASHBOARDS_SYS_TABLE_NAME, databases_, Catalog_Namespace::DATABASES_SYS_TABLE_NAME, foreign_storage::InternalSystemDataWrapper::foreign_table_, foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_all_dashboards(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_all_role_assignments(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_all_tables(), Catalog_Namespace::SysCatalog::instance(), object_permissions_, Catalog_Namespace::PERMISSIONS_SYS_TABLE_NAME, Catalog_Namespace::ROLE_ASSIGNMENTS_SYS_TABLE_NAME, roles_, Catalog_Namespace::ROLES_SYS_TABLE_NAME, foreign_storage::InternalSystemDataWrapper::row_count_, TableDescriptor::tableName, run_benchmark_import::tables, tables_by_database_, Catalog_Namespace::TABLES_SYS_TABLE_NAME, UNREACHABLE, user_names_by_role_, users_, and Catalog_Namespace::USERS_SYS_TABLE_NAME.

375  {
376  row_count_ = 0;
377  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
379  users_.clear();
380  users_ = sys_catalog.getAllUserMetadata();
381  row_count_ = users_.size();
383  tables_by_database_.clear();
385  for (const auto& [db_id, tables] : tables_by_database_) {
386  row_count_ += tables.size();
387  }
389  dashboards_by_database_.clear();
391  for (const auto& [db_id, dashboards] : dashboards_by_database_) {
392  row_count_ += dashboards.size();
393  }
395  object_permissions_.clear();
396  object_permissions_ = sys_catalog.getMetadataForAllObjects();
399  databases_.clear();
400  databases_ = sys_catalog.getAllDBMetadata();
401  row_count_ = databases_.size();
403  roles_.clear();
404  roles_ = sys_catalog.getCreatedRoles();
405  row_count_ = roles_.size();
406  } else if (foreign_table_->tableName ==
408  user_names_by_role_.clear();
410  for (const auto& [role, user_names] : user_names_by_role_) {
411  row_count_ += user_names.size();
412  }
413  } else {
414  UNREACHABLE() << "Unexpected table name: " << foreign_table_->tableName;
415  }
416 }
std::string tableName
static constexpr const char * DASHBOARDS_SYS_TABLE_NAME
Definition: Catalog.h:99
std::map< int32_t, std::vector< DashboardDescriptor > > get_all_dashboards()
#define UNREACHABLE()
Definition: Logger.h:253
std::vector< ObjectRoleDescriptor > object_permissions_
static constexpr const char * ROLES_SYS_TABLE_NAME
Definition: Catalog.h:102
static SysCatalog & instance()
Definition: SysCatalog.h:325
std::list< Catalog_Namespace::UserMetadata > users_
std::map< int32_t, std::vector< TableDescriptor > > get_all_tables()
static constexpr const char * ROLE_ASSIGNMENTS_SYS_TABLE_NAME
Definition: Catalog.h:103
static constexpr const char * USERS_SYS_TABLE_NAME
Definition: Catalog.h:97
static constexpr const char * DATABASES_SYS_TABLE_NAME
Definition: Catalog.h:100
std::list< Catalog_Namespace::DBMetadata > databases_
static constexpr const char * TABLES_SYS_TABLE_NAME
Definition: Catalog.h:98
static constexpr const char * PERMISSIONS_SYS_TABLE_NAME
Definition: Catalog.h:101
std::map< std::string, std::vector< std::string > > get_all_role_assignments()
std::map< std::string, std::vector< std::string > > user_names_by_role_
std::map< int32_t, std::vector< TableDescriptor > > tables_by_database_
std::map< int32_t, std::vector< DashboardDescriptor > > dashboards_by_database_

+ Here is the call graph for this function:

void foreign_storage::InternalCatalogDataWrapper::populateChunkBuffersForTable ( const std::string &  table_name,
std::map< std::string, import_export::TypedImportBuffer * > &  import_buffers 
)
overrideprivatevirtual

Implements foreign_storage::InternalSystemDataWrapper.

Definition at line 418 of file InternalCatalogDataWrapper.cpp.

References dashboards_by_database_, Catalog_Namespace::DASHBOARDS_SYS_TABLE_NAME, databases_, Catalog_Namespace::DATABASES_SYS_TABLE_NAME, foreign_storage::InternalSystemDataWrapper::foreign_table_, object_permissions_, Catalog_Namespace::PERMISSIONS_SYS_TABLE_NAME, foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::populate_import_buffers_for_catalog_dashboards(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::populate_import_buffers_for_catalog_databases(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::populate_import_buffers_for_catalog_permissions(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::populate_import_buffers_for_catalog_role_assignments(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::populate_import_buffers_for_catalog_roles(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::populate_import_buffers_for_catalog_tables(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::populate_import_buffers_for_catalog_users(), Catalog_Namespace::ROLE_ASSIGNMENTS_SYS_TABLE_NAME, roles_, Catalog_Namespace::ROLES_SYS_TABLE_NAME, TableDescriptor::tableName, tables_by_database_, Catalog_Namespace::TABLES_SYS_TABLE_NAME, UNREACHABLE, user_names_by_role_, users_, and Catalog_Namespace::USERS_SYS_TABLE_NAME.

420  {
427  import_buffers);
434  } else if (foreign_table_->tableName ==
437  import_buffers);
438  } else {
439  UNREACHABLE() << "Unexpected table name: " << foreign_table_->tableName;
440  }
441 }
std::string tableName
static constexpr const char * DASHBOARDS_SYS_TABLE_NAME
Definition: Catalog.h:99
void populate_import_buffers_for_catalog_dashboards(const std::map< int32_t, std::vector< DashboardDescriptor >> &dashboards_by_database, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
#define UNREACHABLE()
Definition: Logger.h:253
std::vector< ObjectRoleDescriptor > object_permissions_
static constexpr const char * ROLES_SYS_TABLE_NAME
Definition: Catalog.h:102
void populate_import_buffers_for_catalog_permissions(const std::vector< ObjectRoleDescriptor > &object_permissions, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
void populate_import_buffers_for_catalog_tables(const std::map< int32_t, std::vector< TableDescriptor >> &tables_by_database, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
void populate_import_buffers_for_catalog_role_assignments(const std::map< std::string, std::vector< std::string >> &user_names_by_role_, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
std::list< Catalog_Namespace::UserMetadata > users_
static constexpr const char * ROLE_ASSIGNMENTS_SYS_TABLE_NAME
Definition: Catalog.h:103
static constexpr const char * USERS_SYS_TABLE_NAME
Definition: Catalog.h:97
static constexpr const char * DATABASES_SYS_TABLE_NAME
Definition: Catalog.h:100
std::list< Catalog_Namespace::DBMetadata > databases_
static constexpr const char * TABLES_SYS_TABLE_NAME
Definition: Catalog.h:98
void populate_import_buffers_for_catalog_databases(const std::list< Catalog_Namespace::DBMetadata > &databases, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
static constexpr const char * PERMISSIONS_SYS_TABLE_NAME
Definition: Catalog.h:101
void populate_import_buffers_for_catalog_users(const std::list< Catalog_Namespace::UserMetadata > &all_users, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
std::map< std::string, std::vector< std::string > > user_names_by_role_
std::map< int32_t, std::vector< TableDescriptor > > tables_by_database_
void populate_import_buffers_for_catalog_roles(const std::set< std::string > &roles, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
std::map< int32_t, std::vector< DashboardDescriptor > > dashboards_by_database_

+ Here is the call graph for this function:

Member Data Documentation

std::map<int32_t, std::vector<DashboardDescriptor> > foreign_storage::InternalCatalogDataWrapper::dashboards_by_database_
private
std::list<Catalog_Namespace::DBMetadata> foreign_storage::InternalCatalogDataWrapper::databases_
private
std::vector<ObjectRoleDescriptor> foreign_storage::InternalCatalogDataWrapper::object_permissions_
private
std::set<std::string> foreign_storage::InternalCatalogDataWrapper::roles_
private
std::map<int32_t, std::vector<TableDescriptor> > foreign_storage::InternalCatalogDataWrapper::tables_by_database_
private
std::map<std::string, std::vector<std::string> > foreign_storage::InternalCatalogDataWrapper::user_names_by_role_
private
std::list<Catalog_Namespace::UserMetadata> foreign_storage::InternalCatalogDataWrapper::users_
private

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