OmniSciDB  a5dc49c757
 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, AbstractBuffer *delete_buffer) 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 const std::set
< std::string > 
getAlterableTableOptions () const
 
virtual void validateSchema (const std::list< ColumnDescriptor > &columns) const
 
virtual ParallelismLevel getCachedParallelismLevel () const
 
virtual ParallelismLevel getNonCachedParallelismLevel () const
 
virtual bool isLazyFragmentFetchingEnabled () 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 489 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(), dist::is_aggregator(), dist::is_distributed(), dist::is_first_leaf(), 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.

490  {
491  row_count_ = 0;
492 
493  // Dashboads are handled separately since they are only on the aggregator in
494  // distributed. All others are only on the first leaf.
497  // Only the aggregator can contain dashboards in distributed.
498  return;
499  }
500  dashboards_by_database_.clear();
502  for (const auto& [db_id, dashboards] : dashboards_by_database_) {
503  row_count_ += dashboards.size();
504  }
505  return;
506  }
507 
509  // For every table except dashboards, only the first leaf returns information in
510  // distributed.
511  return;
512  }
513  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
515  users_.clear();
516  users_ = sys_catalog.getAllUserMetadata();
517  row_count_ = users_.size();
519  tables_by_database_.clear();
521  for (const auto& [db_id, tables] : tables_by_database_) {
522  row_count_ += tables.size();
523  }
525  object_permissions_.clear();
526  object_permissions_ = sys_catalog.getMetadataForAllObjects();
529  databases_.clear();
530  databases_ = sys_catalog.getAllDBMetadata();
531  row_count_ = databases_.size();
533  roles_.clear();
534  roles_ = sys_catalog.getCreatedRoles();
535  row_count_ = roles_.size();
536  } else if (foreign_table_->tableName ==
538  user_names_by_role_.clear();
540  for (const auto& [role, user_names] : user_names_by_role_) {
541  row_count_ += user_names.size();
542  }
543  } else {
544  UNREACHABLE() << "Unexpected table name: " << foreign_table_->tableName;
545  }
546 }
bool is_first_leaf()
Definition: distributed.cpp:25
std::string tableName
static constexpr const char * DASHBOARDS_SYS_TABLE_NAME
Definition: Catalog.h:114
std::map< int32_t, std::vector< DashboardDescriptor > > get_all_dashboards()
#define UNREACHABLE()
Definition: Logger.h:338
std::vector< ObjectRoleDescriptor > object_permissions_
static constexpr const char * ROLES_SYS_TABLE_NAME
Definition: Catalog.h:117
static SysCatalog & instance()
Definition: SysCatalog.h:343
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:118
static constexpr const char * USERS_SYS_TABLE_NAME
Definition: Catalog.h:112
static constexpr const char * DATABASES_SYS_TABLE_NAME
Definition: Catalog.h:115
std::list< Catalog_Namespace::DBMetadata > databases_
static constexpr const char * TABLES_SYS_TABLE_NAME
Definition: Catalog.h:113
bool is_aggregator()
Definition: distributed.cpp:33
static constexpr const char * PERMISSIONS_SYS_TABLE_NAME
Definition: Catalog.h:116
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_
bool is_distributed()
Definition: distributed.cpp:21

+ 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 548 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.

550  {
557  import_buffers);
564  } else if (foreign_table_->tableName ==
567  import_buffers);
568  } else {
569  UNREACHABLE() << "Unexpected table name: " << foreign_table_->tableName;
570  }
571 }
std::string tableName
static constexpr const char * DASHBOARDS_SYS_TABLE_NAME
Definition: Catalog.h:114
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:338
std::vector< ObjectRoleDescriptor > object_permissions_
static constexpr const char * ROLES_SYS_TABLE_NAME
Definition: Catalog.h:117
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:118
static constexpr const char * USERS_SYS_TABLE_NAME
Definition: Catalog.h:112
static constexpr const char * DATABASES_SYS_TABLE_NAME
Definition: Catalog.h:115
std::list< Catalog_Namespace::DBMetadata > databases_
static constexpr const char * TABLES_SYS_TABLE_NAME
Definition: Catalog.h:113
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:116
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: