OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InternalSystemDataWrapper.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 "ForeignDataWrapper.h"
20 
21 namespace import_export {
22 class TypedImportBuffer;
23 }
24 
25 namespace foreign_storage {
26 constexpr const char* kDeletedValueIndicator{"<DELETED>"};
27 
28 std::string get_db_name(int32_t db_id);
29 std::string get_table_name(int32_t db_id, int32_t table_id);
30 
31 void set_node_name(
32  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers);
33 
35  public:
37 
38  InternalSystemDataWrapper(const int db_id, const ForeignTable* foreign_table);
39 
40  void populateChunkMetadata(ChunkMetadataVector& chunk_metadata_vector) override;
41 
42  void populateChunkBuffers(const ChunkToBufferMap& required_buffers,
43  const ChunkToBufferMap& optional_buffers,
44  AbstractBuffer* delete_buffer) override;
45 
46  void validateServerOptions(const ForeignServer* foreign_server) const override;
47 
48  void validateTableOptions(const ForeignTable* foreign_table) const override;
49 
50  const std::set<std::string_view>& getSupportedTableOptions() const override;
51 
52  void validateUserMappingOptions(const UserMapping* user_mapping,
53  const ForeignServer* foreign_server) const override;
54 
55  const std::set<std::string_view>& getSupportedUserMappingOptions() const override;
56 
57  std::string getSerializedDataWrapper() const override;
58 
59  void restoreDataWrapperInternals(const std::string& file_path,
60  const ChunkMetadataVector& chunk_metadata) override;
61 
62  bool isRestored() const override;
63 
64  protected:
65  virtual void initializeObjectsForTable(const std::string& table_name) = 0;
66  virtual void populateChunkBuffersForTable(
67  const std::string& table_name,
68  std::map<std::string, import_export::TypedImportBuffer*>& import_buffers) = 0;
69 
70  const int db_id_;
72  size_t row_count_{0};
73 };
74 } // namespace foreign_storage
virtual void initializeObjectsForTable(const std::string &table_name)=0
constexpr const char * kDeletedValueIndicator
const std::set< std::string_view > & getSupportedTableOptions() const override
std::map< ChunkKey, AbstractBuffer * > ChunkToBufferMap
void validateTableOptions(const ForeignTable *foreign_table) const override
void restoreDataWrapperInternals(const std::string &file_path, const ChunkMetadataVector &chunk_metadata) override
void validateUserMappingOptions(const UserMapping *user_mapping, const ForeignServer *foreign_server) const override
void set_node_name(std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
std::vector< std::pair< ChunkKey, std::shared_ptr< ChunkMetadata >>> ChunkMetadataVector
virtual void populateChunkBuffersForTable(const std::string &table_name, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)=0
An AbstractBuffer is a unit of data management for a data manager.
void populateChunkMetadata(ChunkMetadataVector &chunk_metadata_vector) override
void populateChunkBuffers(const ChunkToBufferMap &required_buffers, const ChunkToBufferMap &optional_buffers, AbstractBuffer *delete_buffer) override
void validateServerOptions(const ForeignServer *foreign_server) const override
std::string get_db_name(int32_t db_id)
const std::set< std::string_view > & getSupportedUserMappingOptions() const override
std::string get_table_name(int32_t db_id, int32_t table_id)