OmniSciDB  16c4e035a1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InsertDataLoader.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019, 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 #ifndef INSERT_DATA_LOADER_H_
18 #define INSERT_DATA_LOADER_H_
19 
20 #include "../Catalog/Catalog.h"
21 #include "Fragmenter.h"
22 
23 namespace Fragmenter_Namespace {
24 
26  public:
28  virtual size_t leafCount() = 0;
29  virtual void insertChunksToLeaf(
30  const Catalog_Namespace::SessionInfo& parent_session_info,
31  const size_t leaf_idx,
32  const Fragmenter_Namespace::InsertChunks& insert_chunks) = 0;
33  virtual void insertDataToLeaf(
34  const Catalog_Namespace::SessionInfo& parent_session_info,
35  const size_t leaf_idx,
36  Fragmenter_Namespace::InsertData& insert_data) = 0;
37  virtual void checkpoint(const Catalog_Namespace::SessionInfo& parent_session_info,
38  int tableId) = 0;
39  virtual void rollback(const Catalog_Namespace::SessionInfo& parent_session_info,
40  int tableId) = 0;
41 
42  virtual ~DistributedConnector() = default;
43  };
44 
46  : leaf_count_(connector.leafCount())
48  , connector_(connector){};
49 
50  void insertData(const Catalog_Namespace::SessionInfo& session_info,
51  InsertData& insert_data);
52 
53  void insertChunks(const Catalog_Namespace::SessionInfo& session_info,
54  const InsertChunks& insert_chunks);
55 
56  private:
63  size_t moveToNextLeaf();
64 
65  size_t leaf_count_;
68  std::shared_mutex current_leaf_index_mutex_;
69 };
70 
71 } // namespace Fragmenter_Namespace
72 
73 #endif
virtual void insertChunksToLeaf(const Catalog_Namespace::SessionInfo &parent_session_info, const size_t leaf_idx, const Fragmenter_Namespace::InsertChunks &insert_chunks)=0
InsertDataLoader(DistributedConnector &connector)
virtual void insertDataToLeaf(const Catalog_Namespace::SessionInfo &parent_session_info, const size_t leaf_idx, Fragmenter_Namespace::InsertData &insert_data)=0
virtual void rollback(const Catalog_Namespace::SessionInfo &parent_session_info, int tableId)=0
virtual void checkpoint(const Catalog_Namespace::SessionInfo &parent_session_info, int tableId)=0
void insertChunks(const Catalog_Namespace::SessionInfo &session_info, const InsertChunks &insert_chunks)
void insertData(const Catalog_Namespace::SessionInfo &session_info, InsertData &insert_data)
The data to be inserted using the fragment manager.
Definition: Fragmenter.h:66