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
TempSet.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 
20 #ifndef TEMP_SET_CC
21 #define TEMP_SET_CC
22 
23 #include "TempSet.h"
24 #include "PartitionedFile.h"
25 #include "Configuration.h"
26 #include <vector>
27 using namespace std;
28 
29 
31  string setName,
32  string metaTempPath,
33  vector<string> dataTempPaths,
34  SharedMemPtr shm,
35  PageCachePtr cache,
36  pdb::PDBLoggerPtr logger,
37  LocalityType localityType,
39  OperationType operation,
40  DurabilityType durability,
41  PersistenceType persistence,
42  size_t pageSize)
43  : UserSet(logger,
44  shm,
45  0,
46  0,
47  0,
48  setId,
49  setName,
50  cache,
51  localityType,
52  policy,
53  operation,
54  durability,
55  persistence,
56  pageSize) {
57  vector<string> dataPaths;
58  int numDataPaths = dataTempPaths.size();
59  int i;
60  string dataPath;
62  for (i = 0; i < numDataPaths; i++) {
63  dataPath = this->encodePath(dataTempPaths.at(i), setName);
64  dataPaths.push_back(dataPath);
65  }
66  file = make_shared<PartitionedFile>(
67  0, 0, 0, setId, this->encodePath(metaTempPath, setName), dataPaths, logger, pageSize);
68  this->lastFlushedPageId = (unsigned int)(-1);
69  this->setFile(file);
70  this->getFile()->openAll();
71 }
72 
73 
75 
76 
78  this->getFile()->clear();
79 }
80 
81 string TempSet::encodePath(string tempPath, string setName) {
82  char buffer[500];
83  sprintf(buffer, "%s/%d_%s", tempPath.c_str(), setId, setName.c_str());
84  return string(buffer);
85 }
86 
87 
88 #endif
unsigned int SetID
Definition: DataTypes.h:31
OperationType
Definition: DataTypes.h:57
shared_ptr< PageCache > PageCachePtr
Definition: PageCache.h:39
void setFile(PartitionedFilePtr file)
Definition: UserSet.h:254
TempSet(SetID setId, string setName, string metaTempPath, vector< string > dataTempPaths, SharedMemPtr shm, PageCachePtr cache, pdb::PDBLoggerPtr logger, LocalityType localityType=ShuffleData, LocalitySetReplacementPolicy policy=MRU, OperationType operation=Write, DurabilityType durability=TryCache, PersistenceType persistence=Transient, size_t pageSize=DEFAULT_PAGE_SIZE)
Definition: TempSet.cc:30
string encodePath(string tempPath, string setName)
Definition: TempSet.cc:81
LocalityType
Definition: DataTypes.h:50
PageID lastFlushedPageId
Definition: UserSet.h:398
DurabilityType
Definition: DataTypes.h:59
LocalitySetReplacementPolicy
Definition: DataTypes.h:52
shared_ptr< PartitionedFile > PartitionedFilePtr
shared_ptr< SharedMem > SharedMemPtr
Definition: SharedMem.h:32
size_t pageSize
Definition: UserSet.h:407
string setName
Definition: UserSet.h:397
PersistenceType
Definition: DataTypes.h:68
PartitionedFilePtr file
Definition: UserSet.h:389
void clear()
Definition: TempSet.cc:77
std::shared_ptr< PDBLogger > PDBLoggerPtr
Definition: PDBLogger.h:40
~TempSet()
Definition: TempSet.cc:74
SetID setId
Definition: UserSet.h:396
pdb::PDBLoggerPtr logger
Definition: UserSet.h:392
PartitionedFilePtr getFile()
Definition: UserSet.h:247