OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InternalCatalogDataWrapper.h
Go to the documentation of this file.
1 /*
2  * Copyright 2021 OmniSci, 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 #pragma once
18 
19 #include <list>
20 
22 #include "Catalog/ForeignTable.h"
23 #include "Catalog/SysCatalog.h"
24 #include "DataMgr/Chunk/Chunk.h"
25 #include "ForeignDataWrapper.h"
26 
27 namespace foreign_storage {
28 
30  public:
32 
33  InternalCatalogDataWrapper(const int db_id, const ForeignTable* foreign_table);
34 
35  void populateChunkMetadata(ChunkMetadataVector& chunk_metadata_vector) override;
36 
37  void populateChunkBuffers(const ChunkToBufferMap& required_buffers,
38  const ChunkToBufferMap& optional_buffers) override;
39 
40  void validateServerOptions(const ForeignServer* foreign_server) const override;
41 
42  void validateTableOptions(const ForeignTable* foreign_table) const override;
43 
44  const std::set<std::string_view>& getSupportedTableOptions() const override;
45 
46  void validateUserMappingOptions(const UserMapping* user_mapping,
47  const ForeignServer* foreign_server) const override;
48 
49  const std::set<std::string_view>& getSupportedUserMappingOptions() const override;
50 
51  std::string getSerializedDataWrapper() const override;
52 
53  void restoreDataWrapperInternals(const std::string& file_path,
54  const ChunkMetadataVector& chunk_metadata) override;
55 
56  bool isRestored() const override;
57 
58  private:
59  void initializeObjectsForTable(const std::string& table_name);
61  const std::string& table_name,
62  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers);
63 
64  const int db_id_;
66  std::list<Catalog_Namespace::UserMetadata> users_;
67  std::map<int32_t, std::vector<TableDescriptor>> tables_by_database_;
68  std::map<int32_t, std::vector<DashboardDescriptor>> dashboards_by_database_;
69  std::vector<ObjectRoleDescriptor> object_permissions_;
70  std::list<Catalog_Namespace::DBMetadata> databases_;
71  std::set<std::string> roles_;
72  std::map<std::string, std::vector<std::string>> user_names_by_role_;
73  size_t row_count_{0};
74 };
75 } // namespace foreign_storage
void validateUserMappingOptions(const UserMapping *user_mapping, const ForeignServer *foreign_server) const override
std::map< ChunkKey, AbstractBuffer * > ChunkToBufferMap
std::vector< ObjectRoleDescriptor > object_permissions_
void populateChunkMetadata(ChunkMetadataVector &chunk_metadata_vector) override
This file contains the class specification and related data structures for SysCatalog.
const std::set< std::string_view > & getSupportedTableOptions() const override
void validateTableOptions(const ForeignTable *foreign_table) const override
std::list< Catalog_Namespace::UserMetadata > users_
void restoreDataWrapperInternals(const std::string &file_path, const ChunkMetadataVector &chunk_metadata) override
std::vector< std::pair< ChunkKey, std::shared_ptr< ChunkMetadata >>> ChunkMetadataVector
void populateChunkBuffersForTable(const std::string &table_name, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
void validateServerOptions(const ForeignServer *foreign_server) const override
std::list< Catalog_Namespace::DBMetadata > databases_
const std::set< std::string_view > & getSupportedUserMappingOptions() const override
std::map< std::string, std::vector< std::string > > user_names_by_role_
void populateChunkBuffers(const ChunkToBufferMap &required_buffers, const ChunkToBufferMap &optional_buffers) override
std::map< int32_t, std::vector< TableDescriptor > > tables_by_database_
void initializeObjectsForTable(const std::string &table_name)
std::map< int32_t, std::vector< DashboardDescriptor > > dashboards_by_database_