OmniSciDB  471d68cefb
 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 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 
59  virtual std::string getSerializedDataWrapper() const = 0;
60 
66  virtual void restoreDataWrapperInternals(const std::string& file_path,
67  const ChunkMetadataVector& chunk_metadata) = 0;
68 
69  // For testing, is this data wrapper restored from disk
70  virtual bool isRestored() const = 0;
71 
76  virtual void validateServerOptions(const ForeignServer* foreign_server) const = 0;
77 
82  virtual void validateTableOptions(const ForeignTable* foreign_table) const = 0;
83 
87  virtual const std::set<std::string_view>& getSupportedTableOptions() const = 0;
88 
93  virtual void validateUserMappingOptions(const UserMapping* user_mapping,
94  const ForeignServer* foreign_server) const = 0;
95 
99  virtual const std::set<std::string_view>& getSupportedUserMappingOptions() const = 0;
100 
105  virtual void validateSchema(const std::list<ColumnDescriptor>& columns) const {};
106 
125 
131  virtual ParallelismLevel getCachedParallelismLevel() const { return NONE; }
132 
139 };
140 } // 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 std::string getSerializedDataWrapper() const =0
virtual void populateChunkBuffers(const ChunkToBufferMap &required_buffers, const ChunkToBufferMap &optional_buffers)=0
virtual void populateChunkMetadata(ChunkMetadataVector &chunk_metadata_vector)=0
virtual void validateServerOptions(const ForeignServer *foreign_server) const =0
virtual void validateSchema(const std::list< ColumnDescriptor > &columns) const