OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 struct ColumnDescriptor;
24 namespace foreign_storage {
25 struct ForeignServer;
26 struct ForeignTable;
27 struct UserMapping;
28 using ChunkToBufferMap = std::map<ChunkKey, AbstractBuffer*>;
29 
31  public:
32  ForeignDataWrapper() = default;
33  virtual ~ForeignDataWrapper() = default;
34 
41  virtual void populateChunkMetadata(ChunkMetadataVector& chunk_metadata_vector) = 0;
42 
53  virtual void populateChunkBuffers(const ChunkToBufferMap& required_buffers,
54  const ChunkToBufferMap& optional_buffers) = 0;
55 
60  virtual void serializeDataWrapperInternals(const std::string& file_path) const = 0;
61 
67  virtual void restoreDataWrapperInternals(const std::string& file_path,
68  const ChunkMetadataVector& chunk_metadata) = 0;
69 
70  // For testing, is this data wrapper restored from disk
71  virtual bool isRestored() const = 0;
72 
77  virtual void validateServerOptions(const ForeignServer* foreign_server) const = 0;
78 
83  virtual void validateTableOptions(const ForeignTable* foreign_table) const = 0;
84 
88  virtual const std::set<std::string_view>& getSupportedTableOptions() const = 0;
89 
94  virtual void validateUserMappingOptions(const UserMapping* user_mapping,
95  const ForeignServer* foreign_server) const = 0;
96 
100  virtual const std::set<std::string_view>& getSupportedUserMappingOptions() const = 0;
101 
106  virtual void validateSchema(const std::list<ColumnDescriptor>& columns) const {};
107 
126 
132  virtual ParallelismLevel getCachedParallelismLevel() const { return NONE; }
133 
140 };
141 } // namespace foreign_storage
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
specifies the content in-memory of a row in the column metadata table
virtual void restoreDataWrapperInternals(const std::string &file_path, const ChunkMetadataVector &chunk_metadata)=0
virtual ParallelismLevel getNonCachedParallelismLevel() const
virtual void populateChunkBuffers(const ChunkToBufferMap &required_buffers, const ChunkToBufferMap &optional_buffers)=0
virtual void populateChunkMetadata(ChunkMetadataVector &chunk_metadata_vector)=0
virtual void serializeDataWrapperInternals(const std::string &file_path) const =0
virtual void validateServerOptions(const ForeignServer *foreign_server) const =0
virtual void validateSchema(const std::list< ColumnDescriptor > &columns) const