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
UserType.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
#ifndef USERTYPE_H
20
#define USERTYPE_H
21
22
#include "
DataTypes.h
"
23
#include "
SequenceFile.h
"
24
#include "
PageCache.h
"
25
#include "
PageCircularBuffer.h
"
26
#include "
UserSet.h
"
27
28
#include <string>
29
#include <map>
30
#include <memory>
31
#include <stdlib.h>
32
#include <sys/types.h>
33
#include <sys/stat.h>
34
#include <unistd.h>
35
#include <vector>
36
#include <boost/filesystem.hpp>
37
38
using namespace
std;
39
40
// create a smart pointer for Type objects
41
class
UserType
;
42
typedef
shared_ptr<UserType>
TypePtr
;
43
44
using namespace
boost::filesystem;
45
52
class
UserType
{
53
public
:
57
UserType
(
NodeID
nodeId,
58
DatabaseID
dbId,
59
UserTypeID
id
,
60
string
name,
61
ConfigurationPtr
conf,
62
pdb::PDBLoggerPtr
logger,
63
SharedMemPtr
shm,
64
string
metaTypePath,
65
vector<string>* dataTypePaths,
66
PageCachePtr
cache,
67
PageCircularBufferPtr
flushBuffer);
68
73
~
UserType
();
74
78
void
flush();
79
80
// add new set
81
int
addSet(
string
setName,
SetID
setId,
size_t
pageSize =
DEFAULT_PAGE_SIZE
);
82
83
// Remove an existing set, including all the disk files associated with the set.
84
// If successful, return 0.
85
// Otherwise, e.g. the set doesn't exist, return -1.
86
int
removeSet(
SetID
setId);
87
88
// Return the specified Set instance that is belonging to this type instance.
89
// If no such set, returns nullptr.
90
SetPtr
getSet(
SetID
setId);
91
92
// Initialize type instance based on disk dirs and files.
93
// This function is only used for SequenceFile instances.
94
bool
initializeFromTypeDir(path typeDir);
95
96
// Initialize type instance based on disk dirs and files.
97
// This function is only used for PartitionedFile instances.
98
bool
initializeFromMetaTypeDir(path metaTypeDir);
99
100
// Return TypeID of the type instance.
101
UserTypeID
getId
()
const
{
102
return
id;
103
}
104
105
// Return name of the type instance.
106
string
getName
()
const
{
107
return
name;
108
}
109
110
// Set the TypeID for the type instance.
111
void
setId
(
UserTypeID
id
) {
112
this->
id
= id;
113
}
114
115
// Set the name for the type instance.
116
void
setName
(
string
name) {
117
this->name = name;
118
}
119
120
// Return the total number of sets belonging to the type instance.
121
unsigned
int
getNumSets
() {
122
return
this->numSets;
123
}
124
125
map<SetID, SetPtr>*
getSets
() {
126
return
this->sets;
127
}
128
129
130
protected
:
134
string
encodePath(
string
typePath,
SetID
setId,
string
setName);
135
136
private
:
137
string
name
;
138
UserTypeID
id
;
139
NodeID
nodeId
;
140
DatabaseID
dbId
;
141
int
numSets
;
142
map<SetID, SetPtr>*
sets
;
143
ConfigurationPtr
conf
;
144
pdb::PDBLoggerPtr
logger
;
145
SharedMemPtr
shm
;
146
string
metaPath
;
147
vector<string>*
dataPaths
;
148
PageCachePtr
cache
;
149
PageCircularBufferPtr
flushBuffer
;
150
pthread_mutex_t
setLock
;
151
};
152
153
154
#endif
/* PDBTYPE_H */
UserType::setId
void setId(UserTypeID id)
Definition:
UserType.h:111
SetID
unsigned int SetID
Definition:
DataTypes.h:31
UserType::getNumSets
unsigned int getNumSets()
Definition:
UserType.h:121
UserType::nodeId
NodeID nodeId
Definition:
UserType.h:139
TypePtr
shared_ptr< UserType > TypePtr
Definition:
UserType.h:41
UserType::name
string name
Definition:
UserType.h:137
UserType::conf
ConfigurationPtr conf
Definition:
UserType.h:143
UserType
Definition:
UserType.h:52
PageCachePtr
shared_ptr< PageCache > PageCachePtr
Definition:
PageCache.h:39
UserType::cache
PageCachePtr cache
Definition:
UserType.h:148
NodeID
unsigned int NodeID
Definition:
DataTypes.h:27
UserSet.h
UserType::sets
map< SetID, SetPtr > * sets
Definition:
UserType.h:142
UserType::metaPath
string metaPath
Definition:
UserType.h:146
SequenceFile.h
UserType::dataPaths
vector< string > * dataPaths
Definition:
UserType.h:147
SharedMemPtr
shared_ptr< SharedMem > SharedMemPtr
Definition:
SharedMem.h:32
DataTypes.h
UserType::numSets
int numSets
Definition:
UserType.h:141
DatabaseID
unsigned int DatabaseID
Definition:
DataTypes.h:29
UserType::setName
void setName(string name)
Definition:
UserType.h:116
UserType::id
UserTypeID id
Definition:
UserType.h:138
PageCircularBuffer.h
ConfigurationPtr
shared_ptr< Configuration > ConfigurationPtr
Definition:
Configuration.h:89
UserType::shm
SharedMemPtr shm
Definition:
UserType.h:145
UserType::getName
string getName() const
Definition:
UserType.h:106
UserType::getId
UserTypeID getId() const
Definition:
UserType.h:101
UserType::dbId
DatabaseID dbId
Definition:
UserType.h:140
pdb::PDBLoggerPtr
std::shared_ptr< PDBLogger > PDBLoggerPtr
Definition:
PDBLogger.h:40
UserType::getSets
map< SetID, SetPtr > * getSets()
Definition:
UserType.h:125
SetPtr
shared_ptr< UserSet > SetPtr
Definition:
UserSet.h:36
DEFAULT_PAGE_SIZE
#define DEFAULT_PAGE_SIZE
Definition:
Configuration.h:36
UserType::flushBuffer
PageCircularBufferPtr flushBuffer
Definition:
UserType.h:149
UserType::setLock
pthread_mutex_t setLock
Definition:
UserType.h:150
UserType::logger
pdb::PDBLoggerPtr logger
Definition:
UserType.h:144
PageCircularBufferPtr
shared_ptr< PageCircularBuffer > PageCircularBufferPtr
Definition:
PageCircularBuffer.h:27
PageCache.h
UserTypeID
unsigned int UserTypeID
Definition:
DataTypes.h:25
plinycompute
pdb
src
storage
headers
UserType.h
Generated on Mon Jun 18 2018 18:10:36 by
1.8.6