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
pdb::PangeaStorageServer Class Reference

#include <PangeaStorageServer.h>

+ Inheritance diagram for pdb::PangeaStorageServer:
+ Collaboration diagram for pdb::PangeaStorageServer:

Public Member Functions

 PangeaStorageServer (SharedMemPtr shm, PDBWorkerQueuePtr workers, PDBLoggerPtr logger, ConfigurationPtr conf, bool standalone=true)
 
void writeBackRecords (pair< std::string, std::string > databaseAndSet, bool flushOrNot=true, bool directPutOrNot=false)
 
PDBPagePtr getNewPage (pair< std::string, std::string > databaseAndSet)
 
SetPtr getSet (std::pair< std::string, std::string > databaseAndSet)
 
void registerHandlers (PDBServer &forMe) override
 
size_t bufferRecord (pair< std::string, std::string > databaseAndSet, Record< Vector< Handle< Object >>> *addMe)
 
 ~PangeaStorageServer ()
 
string getServerName ()
 
NodeID getNodeId ()
 
string getPathToBackEndServer ()
 
PDBLoggerPtr getLogger ()
 
ConfigurationPtr getConf ()
 
SharedMemPtr getSharedMem ()
 
PageCachePtr getCache ()
 
PageCircularBufferPtr getFlushBuffer ()
 
bool addDatabase (std::string dbName, DatabaseID dbId)
 
bool addDatabase (std::string dbName)
 
bool removeDatabase (std::string dbName)
 
bool addType (std::string typeName, UserTypeID typeId)
 
bool removeTypeFromDatabase (std::string dbName, std::string typeName)
 
bool removeType (std::string typeName)
 
bool addSet (std::string dbName, std::string typeName, std::string setName, SetID setId, size_t pageSize=DEFAULT_PAGE_SIZE)
 
bool addSet (std::string dbName, std::string typeName, std::string setName, size_t pageSize=DEFAULT_PAGE_SIZE)
 
bool addSet (std::string dbName, std::string setName, size_t pageSize=DEFAULT_PAGE_SIZE)
 
bool removeSet (std::string dbName, std::string typeName, std::string setName)
 
bool removeSet (std::string dbName, std::string setName)
 
DefaultDatabasePtr getDatabase (DatabaseID dbId)
 
bool addTempSet (std::string setName, SetID &setId, size_t pageSize=DEFAULT_PAGE_SIZE)
 
bool removeTempSet (SetID setId)
 
TempSetPtr getTempSet (SetID setId)
 
SetPtr getSet (DatabaseID dbId, UserTypeID typeId, SetID setId)
 
void startFlushConsumerThreads ()
 
void stopFlushConsumerThreads ()
 
PDBWorkerPtr getWorker ()
 
bool isStandalone ()
 
void cleanup (bool flushOrNot=true)
 
bool exportToFile (std::string dbName, std::string setName, std::string path, std::string format, std::string &errMsg)
 
bool exportToHDFSFile (std::string dbName, std::string setName, std::string hdfsNameNodeIp, int hdfsNameNodePort, std::string path, std::string format, std::string &errMsg)
 
- Public Member Functions inherited from pdb::ServerFunctionality
virtual void cleanup ()
 
template<class Functionality >
Functionality & getFunctionality ()
 
void recordServer (PDBServer &recordMe)
 
PDBWorkerPtr getWorker ()
 
PDBLoggerPtr getLogger ()
 

Protected Member Functions

string encodeDBPath (string rootPath, DatabaseID dbId, string dbName)
 
void createTempDirs ()
 
void createRootDirs ()
 
bool initializeFromRootDirs (string metaRootPath, vector< string > dataRootPath)
 
void clearDB (DatabaseID dbId, string dbName)
 
void addDatabaseBySequenceFiles (string dbName, DatabaseID dbId, boost::filesystem::path dbPath)
 
void addDatabaseByPartitionedFiles (string dbName, DatabaseID dbId, boost::filesystem::path dbMetaPath)
 

Private Attributes

std::map< std::pair
< DatabaseID, SetID >, SetPtr > * 
userSets
 
std::map< std::pair
< std::string, std::string >
, std::pair< DatabaseID, SetID > > * 
names2ids
 
std::map< std::string,
UserTypeID > * 
typename2id
 
std::map< SetID, TempSetPtr > * tempSets
 
std::map< std::string, SetID > * name2tempSetId
 
PDBLoggerPtr logger
 
ConfigurationPtr conf
 
std::string serverName
 
NodeID nodeId
 
SharedMemPtr shm
 
std::string metaTempPath
 
std::vector< std::string > dataTempPaths
 
std::string metaRootPath
 
std::vector< std::string > dataRootPaths
 
PageCachePtr cache
 
string pathToBackEndServer
 
pthread_mutex_t databaseLock
 
pthread_mutex_t typeLock
 
pthread_mutex_t usersetLock
 
pthread_mutex_t tempsetLock
 
SequenceID tempsetSeqId
 
SequenceID databaseSeqId
 
std::map< std::string,
SequenceID * > * 
usersetSeqIds
 
PDBWorkerQueuePtr workers
 
PageCircularBufferPtr flushBuffer
 
std::vector< PDBWorkPtrflushers
 
bool standalone = true
 
std::map< pair< std::string,
std::string >, std::vector
< Record< Vector< Handle
< Object > > > * > > 
allRecords
 
std::map< pair< std::string,
std::string >, size_t > 
sizes
 
std::map< DatabaseID,
DefaultDatabasePtr > * 
dbs
 
std::map< std::string,
DatabaseID > * 
name2id
 
long totalObjects
 
pthread_mutex_t workingMutex
 
pthread_mutex_t counterMutex
 
int numWaitingBufferDataRequests
 

Detailed Description

Definition at line 76 of file PangeaStorageServer.h.

Constructor & Destructor Documentation

pdb::PangeaStorageServer::PangeaStorageServer ( SharedMemPtr  shm,
PDBWorkerQueuePtr  workers,
PDBLoggerPtr  logger,
ConfigurationPtr  conf,
bool  standalone = true 
)

Definition at line 102 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

pdb::PangeaStorageServer::~PangeaStorageServer ( )

Definition at line 190 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

Member Function Documentation

bool pdb::PangeaStorageServer::addDatabase ( std::string  dbName,
DatabaseID  dbId 
)

Add a new and empty database

+ Here is the caller graph for this function:

bool pdb::PangeaStorageServer::addDatabase ( std::string  dbName)

Add a new and empty database using only name

Definition at line 1688 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

void pdb::PangeaStorageServer::addDatabaseByPartitionedFiles ( string  dbName,
DatabaseID  dbId,
boost::filesystem::path  dbMetaPath 
)
protected

Add an existing database based on Partitioned file (by default)

Add an existing database based on Partitioned file

Definition at line 2202 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

void pdb::PangeaStorageServer::addDatabaseBySequenceFiles ( string  dbName,
DatabaseID  dbId,
boost::filesystem::path  dbPath 
)
protected

Add an existing database based on Sequence file (deprecated)

Definition at line 2167 of file PangeaStorageServer.cc.

bool pdb::PangeaStorageServer::addSet ( std::string  dbName,
std::string  typeName,
std::string  setName,
SetID  setId,
size_t  pageSize = DEFAULT_PAGE_SIZE 
)

Add a new and empty set

Definition at line 1800 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool pdb::PangeaStorageServer::addSet ( std::string  dbName,
std::string  typeName,
std::string  setName,
size_t  pageSize = DEFAULT_PAGE_SIZE 
)

Add a new and empty set using only name

Definition at line 1867 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

bool pdb::PangeaStorageServer::addSet ( std::string  dbName,
std::string  setName,
size_t  pageSize = DEFAULT_PAGE_SIZE 
)

Add a set using only database name and set name

Definition at line 1886 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

bool pdb::PangeaStorageServer::addTempSet ( std::string  setName,
SetID setId,
size_t  pageSize = DEFAULT_PAGE_SIZE 
)

Add a new and empty temporary set

Definition at line 1957 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool pdb::PangeaStorageServer::addType ( std::string  typeName,
UserTypeID  typeId 
)

Add a new and empty type

Definition at line 1751 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

size_t pdb::PangeaStorageServer::bufferRecord ( pair< std::string, std::string >  databaseAndSet,
Record< Vector< Handle< Object >>> *  addMe 
)

Definition at line 88 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

void pdb::PangeaStorageServer::cleanup ( bool  flushOrNot = true)

Definition at line 169 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

void pdb::PangeaStorageServer::clearDB ( DatabaseID  dbId,
string  dbName 
)
protected

Clear db data and disk files for removal

Definition at line 1701 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void pdb::PangeaStorageServer::createRootDirs ( )
protected

Create root directories

Definition at line 1621 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

void pdb::PangeaStorageServer::createTempDirs ( )
protected

Create temp directories

Definition at line 1589 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

string pdb::PangeaStorageServer::encodeDBPath ( string  rootPath,
DatabaseID  dbId,
string  dbName 
)
protected

Encode database path

Definition at line 1582 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

bool pdb::PangeaStorageServer::exportToFile ( std::string  dbName,
std::string  setName,
std::string  path,
std::string  format,
std::string &  errMsg 
)

Definition at line 357 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool pdb::PangeaStorageServer::exportToHDFSFile ( std::string  dbName,
std::string  setName,
std::string  hdfsNameNodeIp,
int  hdfsNameNodePort,
std::string  path,
std::string  format,
std::string &  errMsg 
)

Definition at line 427 of file PangeaStorageServer.cc.

PageCachePtr pdb::PangeaStorageServer::getCache ( )

Returns cache

Definition at line 2289 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

ConfigurationPtr pdb::PangeaStorageServer::getConf ( )

Returns configuration

Definition at line 2281 of file PangeaStorageServer.cc.

DefaultDatabasePtr pdb::PangeaStorageServer::getDatabase ( DatabaseID  dbId)

Returns a specified database. If database doesn't exist, returns nullptr

Definition at line 1742 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

PageCircularBufferPtr pdb::PangeaStorageServer::getFlushBuffer ( )

returns the flush buffer

Definition at line 2081 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

PDBLoggerPtr pdb::PangeaStorageServer::getLogger ( )

Returns logger

Definition at line 2277 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

PDBPagePtr pdb::PangeaStorageServer::getNewPage ( pair< std::string, std::string >  databaseAndSet)

Definition at line 208 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

NodeID pdb::PangeaStorageServer::getNodeId ( )

Returns nodeId

Definition at line 1577 of file PangeaStorageServer.cc.

string pdb::PangeaStorageServer::getPathToBackEndServer ( )

Returns the ipc path to backEnd

Definition at line 1567 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

string pdb::PangeaStorageServer::getServerName ( )

Returns server name

Definition at line 1572 of file PangeaStorageServer.cc.

SetPtr pdb::PangeaStorageServer::getSet ( std::pair< std::string, std::string >  databaseAndSet)

+ Here is the caller graph for this function:

SetPtr pdb::PangeaStorageServer::getSet ( DatabaseID  dbId,
UserTypeID  typeId,
SetID  setId 
)

Returns a set specified

Definition at line 2014 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

SharedMemPtr pdb::PangeaStorageServer::getSharedMem ( )

Returns shared memory handle, for caching

Definition at line 2285 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

TempSetPtr pdb::PangeaStorageServer::getTempSet ( SetID  setId)

Returns a temporary set specified

Definition at line 2001 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

PDBWorkerPtr pdb::PangeaStorageServer::getWorker ( )

returns a worker from thread pool

Definition at line 2074 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

bool pdb::PangeaStorageServer::initializeFromRootDirs ( string  metaRootPath,
vector< string >  dataRootPath 
)
protected

Initialize storage from existing root directories

Initialize databases in the storage from data already exists at configured root paths. Return true if successful; Return false, if data persisted on disk is not consistent.

Definition at line 2092 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

bool pdb::PangeaStorageServer::isStandalone ( )

return whether the PangeaStorageServer instance is running standalone or in cluster mode.

Definition at line 2294 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

void pdb::PangeaStorageServer::registerHandlers ( PDBServer forMe)
overridevirtual

Implements pdb::ServerFunctionality.

Definition at line 438 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

bool pdb::PangeaStorageServer::removeDatabase ( std::string  dbName)

Remove an existing database

Definition at line 1714 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool pdb::PangeaStorageServer::removeSet ( std::string  dbName,
std::string  typeName,
std::string  setName 
)

Remove an existing set

Definition at line 1918 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool pdb::PangeaStorageServer::removeSet ( std::string  dbName,
std::string  setName 
)

Remove an existing set

Definition at line 1890 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

bool pdb::PangeaStorageServer::removeTempSet ( SetID  setId)

Remove an existing temporary set

Definition at line 1985 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

bool pdb::PangeaStorageServer::removeType ( std::string  typeName)

Remove a type from the typeName to typeId mapping

Definition at line 1786 of file PangeaStorageServer.cc.

bool pdb::PangeaStorageServer::removeTypeFromDatabase ( std::string  dbName,
std::string  typeName 
)

Remove a type from a database, and also remove all sets in the database having that type

Definition at line 1766 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

void pdb::PangeaStorageServer::startFlushConsumerThreads ( )

Start flushing main threads, which are also consumer threads, to flush data in the flush buffer to disk files.

Definition at line 2039 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

void pdb::PangeaStorageServer::stopFlushConsumerThreads ( )

Stop flushing main threads, and close flushBuffer.

Definition at line 2062 of file PangeaStorageServer.cc.

+ Here is the caller graph for this function:

void pdb::PangeaStorageServer::writeBackRecords ( pair< std::string, std::string >  databaseAndSet,
bool  flushOrNot = true,
bool  directPutOrNot = false 
)

Definition at line 220 of file PangeaStorageServer.cc.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

std::map<pair<std::string, std::string>, std::vector<Record<Vector<Handle<Object> > >*> > pdb::PangeaStorageServer::allRecords
private

Definition at line 436 of file PangeaStorageServer.h.

PageCachePtr pdb::PangeaStorageServer::cache
private

Definition at line 390 of file PangeaStorageServer.h.

ConfigurationPtr pdb::PangeaStorageServer::conf
private

Definition at line 366 of file PangeaStorageServer.h.

pthread_mutex_t pdb::PangeaStorageServer::counterMutex
private

Definition at line 453 of file PangeaStorageServer.h.

pthread_mutex_t pdb::PangeaStorageServer::databaseLock
private

Definition at line 396 of file PangeaStorageServer.h.

SequenceID pdb::PangeaStorageServer::databaseSeqId
private

Definition at line 411 of file PangeaStorageServer.h.

std::vector<std::string> pdb::PangeaStorageServer::dataRootPaths
private

Definition at line 387 of file PangeaStorageServer.h.

std::vector<std::string> pdb::PangeaStorageServer::dataTempPaths
private

Definition at line 381 of file PangeaStorageServer.h.

std::map<DatabaseID, DefaultDatabasePtr>* pdb::PangeaStorageServer::dbs
private

Definition at line 445 of file PangeaStorageServer.h.

PageCircularBufferPtr pdb::PangeaStorageServer::flushBuffer
private

Definition at line 420 of file PangeaStorageServer.h.

std::vector<PDBWorkPtr> pdb::PangeaStorageServer::flushers
private

Definition at line 423 of file PangeaStorageServer.h.

PDBLoggerPtr pdb::PangeaStorageServer::logger
private

Definition at line 363 of file PangeaStorageServer.h.

std::string pdb::PangeaStorageServer::metaRootPath
private

Definition at line 384 of file PangeaStorageServer.h.

std::string pdb::PangeaStorageServer::metaTempPath
private

Definition at line 378 of file PangeaStorageServer.h.

std::map<std::string, DatabaseID>* pdb::PangeaStorageServer::name2id
private

Definition at line 448 of file PangeaStorageServer.h.

std::map<std::string, SetID>* pdb::PangeaStorageServer::name2tempSetId
private

Definition at line 360 of file PangeaStorageServer.h.

std::map<std::pair<std::string, std::string>, std::pair<DatabaseID, SetID> >* pdb::PangeaStorageServer::names2ids
private

Definition at line 351 of file PangeaStorageServer.h.

NodeID pdb::PangeaStorageServer::nodeId
private

Definition at line 372 of file PangeaStorageServer.h.

int pdb::PangeaStorageServer::numWaitingBufferDataRequests
private

Definition at line 454 of file PangeaStorageServer.h.

string pdb::PangeaStorageServer::pathToBackEndServer
private

Definition at line 393 of file PangeaStorageServer.h.

std::string pdb::PangeaStorageServer::serverName
private

Definition at line 369 of file PangeaStorageServer.h.

SharedMemPtr pdb::PangeaStorageServer::shm
private

Definition at line 375 of file PangeaStorageServer.h.

std::map<pair<std::string, std::string>, size_t> pdb::PangeaStorageServer::sizes
private

Definition at line 439 of file PangeaStorageServer.h.

bool pdb::PangeaStorageServer::standalone = true
private

Definition at line 428 of file PangeaStorageServer.h.

pthread_mutex_t pdb::PangeaStorageServer::tempsetLock
private

Definition at line 405 of file PangeaStorageServer.h.

std::map<SetID, TempSetPtr>* pdb::PangeaStorageServer::tempSets
private

Definition at line 357 of file PangeaStorageServer.h.

SequenceID pdb::PangeaStorageServer::tempsetSeqId
private

Definition at line 408 of file PangeaStorageServer.h.

long pdb::PangeaStorageServer::totalObjects
private

Definition at line 450 of file PangeaStorageServer.h.

pthread_mutex_t pdb::PangeaStorageServer::typeLock
private

Definition at line 399 of file PangeaStorageServer.h.

std::map<std::string, UserTypeID>* pdb::PangeaStorageServer::typename2id
private

Definition at line 354 of file PangeaStorageServer.h.

pthread_mutex_t pdb::PangeaStorageServer::usersetLock
private

Definition at line 402 of file PangeaStorageServer.h.

std::map<std::pair<DatabaseID, SetID>, SetPtr>* pdb::PangeaStorageServer::userSets
private

Definition at line 348 of file PangeaStorageServer.h.

std::map<std::string, SequenceID*>* pdb::PangeaStorageServer::usersetSeqIds
private

Definition at line 414 of file PangeaStorageServer.h.

PDBWorkerQueuePtr pdb::PangeaStorageServer::workers
private

Definition at line 417 of file PangeaStorageServer.h.

pthread_mutex_t pdb::PangeaStorageServer::workingMutex
private

Definition at line 452 of file PangeaStorageServer.h.


The documentation for this class was generated from the following files: