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.
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
PageHandle.cc
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
#ifndef PAGE_HANDLE_CC
20
#define PAGE_HANDLE_CC
21
22
#include "
PageHandle.h
"
23
#include <iostream>
24
25
26
PageHandle::PageHandle
(
DataProxyPtr
proxy,
PDBPagePtr
page) {
27
this->proxy =
proxy
;
28
this->page =
page
;
29
}
30
31
PageHandle::~PageHandle
() {}
32
33
void
PageHandle::pin
() {
34
if
(this->
page
->isPinned()) {
35
return
;
36
}
37
// temp page
38
if
((this->
page
->getDbID() == 0) && (this->
page
->getTypeID() == 0)) {
39
proxy
->pinTempPage(
page
->getSetID(),
page
->getPageID(), this->
page
);
40
}
41
// user page
42
else
{
43
proxy
->pinUserPage(
page
->getNodeID(),
44
page
->getDbID(),
45
page
->getTypeID(),
46
page
->getSetID(),
47
page
->getPageID(),
48
this->
page
);
49
}
50
}
51
52
void
PageHandle::unpin
() {
53
if
(!this->
page
->isPinned()) {
54
cout <<
"PageHandle: can not unpin because page is already unpinned.\n"
;
55
return
;
56
}
57
// temp page
58
if
((this->
page
->getDbID() == 0) && (this->
page
->getTypeID() == 0)) {
59
proxy
->unpinTempPage(
page
->getSetID(),
page
);
60
}
61
// user page
62
else
{
63
proxy
->unpinUserPage(
64
page
->getNodeID(),
page
->getDbID(),
page
->getTypeID(),
page
->getSetID(),
page
);
65
}
66
this->
page
->setPinned(
false
);
67
}
68
69
70
void
*
PageHandle::getRAM
() {
71
return
this->
page
->getRawBytes();
72
}
73
74
void
*
PageHandle::getWritableBytes
() {
75
return
this->
page
->getBytes();
76
}
77
78
size_t
PageHandle::getSize
() {
79
return
this->
page
->getRawSize();
80
}
81
82
size_t
PageHandle::getWritableSize
() {
83
return
this->
page
->getSize();
84
}
85
86
PageID
PageHandle::getPageID
() {
87
return
this->
page
->getPageID();
88
}
89
90
#endif
PDBPagePtr
shared_ptr< PDBPage > PDBPagePtr
Definition:
PDBPage.h:32
PageHandle::getWritableSize
size_t getWritableSize()
Definition:
PageHandle.cc:82
DataProxyPtr
shared_ptr< DataProxy > DataProxyPtr
Definition:
DataProxy.h:30
PageHandle::getRAM
void * getRAM()
Definition:
PageHandle.cc:70
PageHandle::unpin
void unpin()
Definition:
PageHandle.cc:52
PageHandle::proxy
DataProxyPtr proxy
Definition:
PageHandle.h:67
PageHandle::PageHandle
PageHandle(DataProxyPtr proxy, PDBPagePtr page)
Definition:
PageHandle.cc:26
PageID
unsigned int PageID
Definition:
DataTypes.h:26
PageHandle::page
PDBPagePtr page
Definition:
PageHandle.h:68
PageHandle::getPageID
PageID getPageID()
Definition:
PageHandle.cc:86
PageHandle::getSize
size_t getSize()
Definition:
PageHandle.cc:78
PageHandle::~PageHandle
~PageHandle()
Definition:
PageHandle.cc:31
PageHandle::getWritableBytes
void * getWritableBytes()
Definition:
PageHandle.cc:74
PageHandle::pin
void pin()
Definition:
PageHandle.cc:33
PageHandle.h
plinycompute
pdb
src
storage
source
PageHandle.cc
Generated on Mon Jun 18 2018 18:10:37 by
1.8.6