OmniSciDB  a5dc49c757
 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 2022 HEAVY.AI, 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 
27 namespace foreign_storage {
28 struct ForeignServer;
29 struct ForeignTable;
30 struct UserMapping;
31 using ChunkToBufferMap = std::map<ChunkKey, AbstractBuffer*>;
32 
34  public:
35  ForeignDataWrapper() = default;
36  virtual ~ForeignDataWrapper() = default;
37 
44  virtual void populateChunkMetadata(ChunkMetadataVector& chunk_metadata_vector) = 0;
45 
59  virtual void populateChunkBuffers(const ChunkToBufferMap& required_buffers,
60  const ChunkToBufferMap& optional_buffers,
61  AbstractBuffer* delete_buffer = nullptr) = 0;
62 
66  virtual std::string getSerializedDataWrapper() const = 0;
67 
73  virtual void restoreDataWrapperInternals(const std::string& file_path,
74  const ChunkMetadataVector& chunk_metadata) = 0;
75 
76  // For testing, is this data wrapper restored from disk
77  virtual bool isRestored() const = 0;
78 
83  virtual void validateServerOptions(const ForeignServer* foreign_server) const = 0;
84 
89  virtual void validateTableOptions(const ForeignTable* foreign_table) const = 0;
90 
94  virtual const std::set<std::string_view>& getSupportedTableOptions() const = 0;
95 
99  virtual const std::set<std::string> getAlterableTableOptions() const { return {}; };
100 
105  virtual void validateUserMappingOptions(const UserMapping* user_mapping,
106  const ForeignServer* foreign_server) const = 0;
107 
111  virtual const std::set<std::string_view>& getSupportedUserMappingOptions() const = 0;
112 
117  virtual void validateSchema(const std::list<ColumnDescriptor>& columns) const {};
118 
137 
143  virtual ParallelismLevel getCachedParallelismLevel() const { return NONE; }
144 
151 
163  virtual bool isLazyFragmentFetchingEnabled() const { return false; }
164 };
165 } // 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 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
virtual void validateServerOptions(const ForeignServer *foreign_server) const =0
virtual bool isLazyFragmentFetchingEnabled() const
virtual void validateSchema(const std::list< ColumnDescriptor > &columns) const