OmniSciDB  a987f07e93
 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 void createRenderGroupAnalyzers ()
 Create RenderGroupAnalyzers for poly columns. More...
 
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 482 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.

483  {
484  row_count_ = 0;
485 
486  // Dashboads are handled separately since they are only on the aggregator in
487  // distributed. All others are only on the first leaf.
490  // Only the aggregator can contain dashboards in distributed.
491  return;
492  }
493  dashboards_by_database_.clear();
495  for (const auto& [db_id, dashboards] : dashboards_by_database_) {
496  row_count_ += dashboards.size();
497  }
498  return;
499  }
500 
502  // For every table except dashboards, only the first leaf returns information in
503  // distributed.
504  return;
505  }
506  auto& sys_catalog = Catalog_Namespace::SysCatalog::instance();
508  users_.clear();
509  users_ = sys_catalog.getAllUserMetadata();
510  row_count_ = users_.size();
512  tables_by_database_.clear();
514  for (const auto& [db_id, tables] : tables_by_database_) {
515  row_count_ += tables.size();
516  }
518  object_permissions_.clear();
519  object_permissions_ = sys_catalog.getMetadataForAllObjects();
522  databases_.clear();
523  databases_ = sys_catalog.getAllDBMetadata();
524  row_count_ = databases_.size();
526  roles_.clear();
527  roles_ = sys_catalog.getCreatedRoles();
528  row_count_ = roles_.size();
529  } else if (foreign_table_->tableName ==
531  user_names_by_role_.clear();
533  for (const auto& [role, user_names] : user_names_by_role_) {
534  row_count_ += user_names.size();
535  }
536  } else {
537  UNREACHABLE() << "Unexpected table name: " << foreign_table_->tableName;
538  }
539 }
bool is_first_leaf()
Definition: distributed.cpp:25
std::string tableName
static constexpr const char * DASHBOARDS_SYS_TABLE_NAME
Definition: Catalog.h:106
std::map< int32_t, std::vector< DashboardDescriptor > > get_all_dashboards()
#define UNREACHABLE()
Definition: Logger.h:333
std::vector< ObjectRoleDescriptor > object_permissions_
static constexpr const char * ROLES_SYS_TABLE_NAME
Definition: Catalog.h:109
static SysCatalog & instance()
Definition: SysCatalog.h:341
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:110
static constexpr const char * USERS_SYS_TABLE_NAME
Definition: Catalog.h:104
static constexpr const char * DATABASES_SYS_TABLE_NAME
Definition: Catalog.h:107
std::list< Catalog_Namespace::DBMetadata > databases_
static constexpr const char * TABLES_SYS_TABLE_NAME
Definition: Catalog.h:105
bool is_aggregator()
Definition: distributed.cpp:33
static constexpr const char * PERMISSIONS_SYS_TABLE_NAME
Definition: Catalog.h:108
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 541 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.

543  {
550  import_buffers);
557  } else if (foreign_table_->tableName ==
560  import_buffers);
561  } else {
562  UNREACHABLE() << "Unexpected table name: " << foreign_table_->tableName;
563  }
564 }
std::string tableName
static constexpr const char * DASHBOARDS_SYS_TABLE_NAME
Definition: Catalog.h:106
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:333
std::vector< ObjectRoleDescriptor > object_permissions_
static constexpr const char * ROLES_SYS_TABLE_NAME
Definition: Catalog.h:109
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:110
static constexpr const char * USERS_SYS_TABLE_NAME
Definition: Catalog.h:104
static constexpr const char * DATABASES_SYS_TABLE_NAME
Definition: Catalog.h:107
std::list< Catalog_Namespace::DBMetadata > databases_
static constexpr const char * TABLES_SYS_TABLE_NAME
Definition: Catalog.h:105
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:108
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: