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
PageHandle.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: PageHandle.h
20  * Author: Jia
21  *
22  * Created on November 25, 2015, 1:22 PM
23  */
24 
25 #ifndef PAGEHANDLE_H
26 #define PAGEHANDLE_H
27 
28 #include "PDBPage.h"
29 #include "DataProxy.h"
30 #include "PDBObject.h"
31 #include "PDBLogger.h"
32 #include <memory>
33 using namespace std;
34 class PageHandle;
35 typedef shared_ptr<PageHandle> PageHandlePtr;
36 
37 // this class wraps interfaces of manipulating a page in backend.
38 class PageHandle {
39 
40 public:
41  PageHandle(DataProxyPtr proxy, PDBPagePtr page);
42  ~PageHandle();
43 
44  // must be called before a call to getRAM; after this call (and until the
45  // next call to unPin) all calls to getRAM return the same value
46  void pin();
47 
48  // after a page is unPinned, the storage manager may move it around
49  void unpin();
50 
51  // returns a pointer to the bytes making up the page
52  void* getRAM();
53 
54  // returns a pointer to the bytes after meta data
55  void* getWritableBytes();
56 
57  // gets the page size, in bytes
58  size_t getSize();
59 
60  // returns the size of writable bytes in the page
61  size_t getWritableSize();
62 
63  // gets pageId
64  PageID getPageID();
65 
66 private:
69 };
70 
71 
72 #endif /* PAGEHANDLE_H */
shared_ptr< PDBPage > PDBPagePtr
Definition: PDBPage.h:32
shared_ptr< DataProxy > DataProxyPtr
Definition: DataProxy.h:30
shared_ptr< PageHandle > PageHandlePtr
Definition: PageHandle.h:34
DataProxyPtr proxy
Definition: PageHandle.h:67
unsigned int PageID
Definition: DataTypes.h:26
PDBPagePtr page
Definition: PageHandle.h:68