OmniSciDB  085a039ca4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ForeignDataWrapper.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 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 "DataMgr/ChunkMetadata.h"
20 #include "ForeignStorageBuffer.h"
21 #include "Shared/types.h"
22 
23 #include <map>
24 
25 struct ColumnDescriptor;
26 namespace import_export {
28 }
29 
30 namespace foreign_storage {
31 struct ForeignServer;
32 struct ForeignTable;
33 struct UserMapping;
34 using ChunkToBufferMap = std::map<ChunkKey, AbstractBuffer*>;
35 
37  std::map<int, std::unique_ptr<import_export::RenderGroupAnalyzer>>;
38 
40  public:
41  ForeignDataWrapper() = default;
42  virtual ~ForeignDataWrapper() = default;
43 
50  virtual void populateChunkMetadata(ChunkMetadataVector& chunk_metadata_vector) = 0;
51 
65  virtual void populateChunkBuffers(const ChunkToBufferMap& required_buffers,
66  const ChunkToBufferMap& optional_buffers,
67  AbstractBuffer* delete_buffer = nullptr) = 0;
68 
72  virtual std::string getSerializedDataWrapper() const = 0;
73 
79  virtual void restoreDataWrapperInternals(const std::string& file_path,
80  const ChunkMetadataVector& chunk_metadata) = 0;
81 
82  // For testing, is this data wrapper restored from disk
83  virtual bool isRestored() const = 0;
84 
89  virtual void validateServerOptions(const ForeignServer* foreign_server) const = 0;
90 
95  virtual void validateTableOptions(const ForeignTable* foreign_table) const = 0;
96 
100  virtual const std::set<std::string_view>& getSupportedTableOptions() const = 0;
101 
105  virtual const std::set<std::string> getAlterableTableOptions() const { return {}; };
106 
111  virtual void validateUserMappingOptions(const UserMapping* user_mapping,
112  const ForeignServer* foreign_server) const = 0;
113 
117  virtual const std::set<std::string_view>& getSupportedUserMappingOptions() const = 0;
118 
123  virtual void validateSchema(const std::list<ColumnDescriptor>& columns) const {};
124 
143 
149  virtual ParallelismLevel getCachedParallelismLevel() const { return NONE; }
150 
157 
162  virtual void createRenderGroupAnalyzers() {}
163 };
164 } // namespace foreign_storage
virtual const std::set< std::string > getAlterableTableOptions() const
virtual void validateUserMappingOptions(const UserMapping *user_mapping, const ForeignServer *foreign_server) const =0
virtual ParallelismLevel getCachedParallelismLevel() const
std::map< ChunkKey, AbstractBuffer * > ChunkToBufferMap
virtual const std::set< std::string_view > & getSupportedTableOptions() const =0
virtual bool isRestored() const =0
virtual void validateTableOptions(const ForeignTable *foreign_table) const =0
virtual const std::set< std::string_view > & getSupportedUserMappingOptions() const =0
std::vector< std::pair< ChunkKey, std::shared_ptr< ChunkMetadata >>> ChunkMetadataVector
An AbstractBuffer is a unit of data management for a data manager.
virtual void populateChunkBuffers(const ChunkToBufferMap &required_buffers, const ChunkToBufferMap &optional_buffers, AbstractBuffer *delete_buffer=nullptr)=0
specifies the content in-memory of a row in the column metadata table
virtual void createRenderGroupAnalyzers()
Create RenderGroupAnalyzers for poly columns.
virtual void restoreDataWrapperInternals(const std::string &file_path, const ChunkMetadataVector &chunk_metadata)=0
virtual ParallelismLevel getNonCachedParallelismLevel() const
virtual std::string getSerializedDataWrapper() const =0
virtual void populateChunkMetadata(ChunkMetadataVector &chunk_metadata_vector)=0
std::map< int, std::unique_ptr< import_export::RenderGroupAnalyzer >> RenderGroupAnalyzerMap
virtual void validateServerOptions(const ForeignServer *foreign_server) const =0
virtual void validateSchema(const std::list< ColumnDescriptor > &columns) const