A platform for high-performance distributed tool and library development written in C++. It can be deployed in two different cluster modes: standalone or distributed. API for v0.5.0, released on June 13, 2018.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
PageScanner.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * *
3  * Copyright 2018 Rice University *
4  * *
5  * Licensed under the Apache License, Version 2.0 (the "License"); *
6  * you may not use this file except in compliance with the License. *
7  * You may obtain a copy of the License at *
8  * *
9  * http://www.apache.org/licenses/LICENSE-2.0 *
10  * *
11  * Unless required by applicable law or agreed to in writing, software *
12  * distributed under the License is distributed on an "AS IS" BASIS, *
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14  * See the License for the specific language governing permissions and *
15  * limitations under the License. *
16  * *
17  *****************************************************************************/
18 /*
19  * File: PageScanner.h
20  * Author: Jia
21  *
22  * Created on November 17, 2015, 10:04 AM
23  */
24 
25 #ifndef PAGESCANNER_H
26 #define PAGESCANNER_H
27 
28 #include "PDBCommunicator.h"
29 #include "PDBLogger.h"
31 #include "SharedMem.h"
32 #include "DataTypes.h"
33 #include "StoragePagePinned.h"
34 #include <string.h>
35 #include <pthread.h>
36 #include <memory>
37 using namespace std;
38 
40 typedef shared_ptr<PageScanner> PageScannerPtr;
41 
53 class PageScanner {
54 
55 public:
57  SharedMemPtr shm,
58  pdb::PDBLoggerPtr logger,
59  int numThreads,
60  int recvBufSize,
61  NodeID nodeId);
62  ~PageScanner();
63 
69  vector<PageCircularBufferIteratorPtr> getSetIterators(NodeID nodeId,
70  DatabaseID dbId,
71  UserTypeID typeId,
72  SetID setId);
73 
77  bool acceptPagePinned(pdb::PDBCommunicatorPtr myCommunicator,
78  string& errMsg,
79  bool& morePagesToLoad,
80  NodeID& dataNodeId,
81  DatabaseID& dataDbId,
82  UserTypeID& dataTypeId,
83  SetID& dataSetId,
84  PageID& dataPageId,
85  size_t& pageSize,
86  size_t& offset);
87 
91  bool sendPagePinnedAck(pdb::PDBCommunicatorPtr myCommunicator,
92  bool wasError,
93  string info,
94  string& errMsg);
95 
105  bool recvPagesLoop(pdb::Handle<pdb::StoragePagePinned> pinnedPage,
106  pdb::PDBCommunicatorPtr myCommunicator);
107 
111  void closeBuffer();
112 
116  void openBuffer();
117 
118 
119 private:
123  unsigned int numThreads;
126 };
127 
128 
129 #endif /* PAGESCANNER_H */
shared_ptr< PageScanner > PageScannerPtr
Definition: PageScanner.h:39
unsigned int SetID
Definition: DataTypes.h:31
unsigned int NodeID
Definition: DataTypes.h:27
shared_ptr< SharedMem > SharedMemPtr
Definition: SharedMem.h:32
unsigned int DatabaseID
Definition: DataTypes.h:29
std::shared_ptr< PDBCommunicator > PDBCommunicatorPtr
unsigned int PageID
Definition: DataTypes.h:26
std::shared_ptr< PDBLogger > PDBLoggerPtr
Definition: PDBLogger.h:40
PageCircularBufferPtr buffer
Definition: PageScanner.h:122
shared_ptr< PageCircularBuffer > PageCircularBufferPtr
pdb::PDBCommunicatorPtr communicator
Definition: PageScanner.h:120
SharedMemPtr shm
Definition: PageScanner.h:124
unsigned int numThreads
Definition: PageScanner.h:123
unsigned int UserTypeID
Definition: DataTypes.h:25
pdb::PDBLoggerPtr logger
Definition: PageScanner.h:121
NodeID nodeId
Definition: PageScanner.h:125