OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ForeignServer.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 <string>
20 #include <unordered_map>
21 
24 
25 namespace foreign_storage {
27  int32_t id;
28  std::string name;
29  std::string data_wrapper_type;
30  int32_t user_id;
31  time_t creation_time;
32 
34 
35  ForeignServer(const int32_t server_id,
36  const std::string& server_name,
37  const std::string& data_wrapper_type,
38  const std::string& options_str,
39  const int32_t user_id,
40  const time_t creation_time)
41  : OptionsContainer(options_str)
42  , id(server_id)
43  , name(server_name)
44  , data_wrapper_type(data_wrapper_type)
45  , user_id(user_id)
46  , creation_time(creation_time) {}
47 
48  ForeignServer(const std::string& server_name,
49  const std::string& data_wrapper_type,
50  const std::map<std::string, std::string, std::less<>>& options,
51  const int32_t user_id)
53  , name(server_name)
54  , data_wrapper_type(data_wrapper_type)
55  , user_id(user_id) {}
56 
57  void validate() {
60  }
61 
62  private:
65  ->validateServerOptions(this);
66  }
67 };
68 } // namespace foreign_storage
static const ForeignDataWrapper * createForValidation(const std::string &data_wrapper_type, const ForeignTable *foreign_table=nullptr)
static void validateDataWrapperType(const std::string &data_wrapper_type)
ForeignServer(const int32_t server_id, const std::string &server_name, const std::string &data_wrapper_type, const std::string &options_str, const int32_t user_id, const time_t creation_time)
Definition: ForeignServer.h:35
ForeignServer(const std::string &server_name, const std::string &data_wrapper_type, const std::map< std::string, std::string, std::less<>> &options, const int32_t user_id)
Definition: ForeignServer.h:48
virtual void validateServerOptions(const ForeignServer *foreign_server) const =0