JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
StorageCollection Class Reference

#include <StorageCollection.h>

Collaboration diagram for StorageCollection:
[legend]

Public Member Functions

 StorageCollection (StorageCollection const &)=delete
 
void operator= (StorageCollection const &)=delete
 
virtual ~StorageCollection ()
 
std::shared_ptr< JSONStoragegetStorage (const std::string &name)
 
bool storageExists (const std::string &name)
 
std::shared_ptr< JSONStoragegetOrAddStorage (const std::string &name)
 
void removeStorage (const std::string &name)
 
std::vector< std::shared_ptr< JSONStorage > > getStorages ()
 
std::vector< std::shared_ptr< JSONStorage > > getTemporaryStorages ()
 
std::vector< std::pair< unsigned long, std::shared_ptr< JSONStorage > > > getTemporaryIDStorages ()
 
std::shared_ptr< JSONStoragegetStorage (unsigned long id)
 
unsigned long addTemporaryStorage (const std::shared_ptr< JSONStorage > &storage)
 
unsigned long addTemporaryStorage ()
 
void removeStorage (unsigned long id)
 
std::shared_ptr< JoinManagergetOrStartJoin (std::unique_ptr< joda::query::IValueProvider > &&valProv)
 
void stopJoin (const joda::query::IValueProvider &valProv)
 
void stopJoin (const JoinManager &jm)
 
void ensureSpace (unsigned long long estimatedSize, const std::shared_ptr< JSONStorage > &withoutDependency=nullptr)
 
void addDependency (const std::shared_ptr< JSONStorage > &store, const std::shared_ptr< JSONStorage > &dependson)
 
size_t estimateHierarchySize (const std::shared_ptr< JSONStorage > &store) const
 
long long estimatedStorageSize () const
 
size_t parsedHierarchySize (const std::shared_ptr< JSONStorage > &store) const
 
size_t estimatedSize () const
 
size_t estimatedParsedSize () const
 

Static Public Member Functions

static StorageCollectiongetInstance ()
 

Protected Member Functions

std::vector< JSONStorage * > getDependencies (const std::shared_ptr< JSONStorage > &store) const
 
std::vector< std::pair< JSONStorage *, size_t > > chooseStoragesToRemove (long long toFree, const std::vector< JSONStorage * > &except) const
 
void orderContainerBySize (std::vector< std::pair< JSONStorage *, size_t >> &candidates) const
 
void orderContainerByLRU (std::vector< std::pair< JSONStorage *, size_t >> &candidates) const
 
void orderContainerByFIFO (std::vector< std::pair< JSONStorage *, size_t >> &candidates) const
 
void orderContainerByDependencies (std::vector< std::pair< JSONStorage *, size_t >> &candidates) const
 
void orderContainerByRandomExplorer (std::vector< std::pair< JSONStorage *, size_t >> &candidates) const
 
std::string getJoinName (const joda::query::IValueProvider &valProv)
 
 StorageCollection ()
 

Protected Attributes

std::unordered_map< std::string, std::shared_ptr< JSONStorage > > storages
 
std::vector< std::string > storageInsertion
 
std::unordered_map< unsigned long, std::shared_ptr< JSONStorage > > resultStorage
 
std::unordered_map< std::string, std::shared_ptr< JoinManager > > runningJoins
 
std::mutex mut
 
std::atomic_ulong tmpRes {JODA_STORE_VALID_ID_START}
 
std::unordered_set< std::pair< std::shared_ptr< JSONStorage >, std::shared_ptr< JSONStorage > >, boost::hash< std::pair< std::shared_ptr< JSONStorage >, std::shared_ptr< JSONStorage > > > > dependencies
 

Friends

class CollectionTest
 
class CollectionTest_FIFO_Test
 
class CollectionTest_LARGEST_Test
 
class CollectionTest_DEPENDENCIES_Test
 

Detailed Description

StorageCollection represents a global repository of JSONStorage s. Here temporary result Collections and permanently named Collections are managed.

Constructor & Destructor Documentation

◆ StorageCollection() [1/2]

StorageCollection::StorageCollection ( StorageCollection const &  )
delete

◆ ~StorageCollection()

StorageCollection::~StorageCollection ( )
virtual

◆ StorageCollection() [2/2]

StorageCollection::StorageCollection ( )
inlineprotected

Member Function Documentation

◆ addDependency()

void StorageCollection::addDependency ( const std::shared_ptr< JSONStorage > &  store,
const std::shared_ptr< JSONStorage > &  dependson 
)
Here is the caller graph for this function:

◆ addTemporaryStorage() [1/2]

unsigned long StorageCollection::addTemporaryStorage ( )

Creates a new JSONStorage as temporary result.

Returns
The unique result ID of the created JSONStorage

◆ addTemporaryStorage() [2/2]

unsigned long StorageCollection::addTemporaryStorage ( const std::shared_ptr< JSONStorage > &  storage)

Adds an existing JSONStorage as temporary result.

Parameters
storageThe JSONStorage to add
Returns
The unique result ID
Here is the caller graph for this function:

◆ chooseStoragesToRemove()

std::vector< std::pair< JSONStorage *, size_t > > StorageCollection::chooseStoragesToRemove ( long long  toFree,
const std::vector< JSONStorage * > &  except 
) const
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ensureSpace()

void StorageCollection::ensureSpace ( unsigned long long  estimatedSize,
const std::shared_ptr< JSONStorage > &  withoutDependency = nullptr 
)

Ensures that the system has enough space for the comming operations. Not enough space is available, JSONStorage s will be serialized to disk and removed from memory according to a specified heuristic.

Parameters
estimatedSizeThe estimated required size (in Bytes) for the coming operation
withoutDependencyA JSONStorage that cannot be removed from memory for the coming operation.
Here is the call graph for this function:

◆ estimatedParsedSize()

size_t StorageCollection::estimatedParsedSize ( ) const

◆ estimatedSize()

size_t StorageCollection::estimatedSize ( ) const
Here is the caller graph for this function:

◆ estimatedStorageSize()

long long StorageCollection::estimatedStorageSize ( ) const
Here is the caller graph for this function:

◆ estimateHierarchySize()

size_t StorageCollection::estimateHierarchySize ( const std::shared_ptr< JSONStorage > &  store) const
Here is the caller graph for this function:

◆ getDependencies()

std::vector< JSONStorage * > StorageCollection::getDependencies ( const std::shared_ptr< JSONStorage > &  store) const
protected
Here is the caller graph for this function:

◆ getInstance()

static StorageCollection& StorageCollection::getInstance ( )
inlinestatic

(Creates and) returns the global StorageCollection instance.

Here is the caller graph for this function:

◆ getJoinName()

std::string StorageCollection::getJoinName ( const joda::query::IValueProvider valProv)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOrAddStorage()

std::shared_ptr< JSONStorage > StorageCollection::getOrAddStorage ( const std::string &  name)

Retrieves a named JSONStorage by its name. If it does not exist, a new JSONStorage is created and returned

Parameters
nameThe name of the JSONStorage
Returns
The JSONStorage
Here is the caller graph for this function:

◆ getOrStartJoin()

std::shared_ptr< JoinManager > StorageCollection::getOrStartJoin ( std::unique_ptr< joda::query::IValueProvider > &&  valProv)

Retrieves a running or starts a new join-process. The join is identified by the joining IValueProvider

Parameters
valProvthe identifying IValueProvider
Returns
The JoinManager used for this join
Here is the call graph for this function:

◆ getStorage() [1/2]

std::shared_ptr< JSONStorage > StorageCollection::getStorage ( const std::string &  name)

Retrieves a named JSONStorage by its name. If it does not exist, it returns a nullpointer

Parameters
nameThe name of the JSONStorage
Returns
The JSONStorage if it exists, nullpointer else
Here is the caller graph for this function:

◆ getStorage() [2/2]

std::shared_ptr< JSONStorage > StorageCollection::getStorage ( unsigned long  id)

Retrieves a temporary JSONStorage by its ID. If it does not exist, a nullpointer returned

Parameters
idThe ID of the JSONStorage
Returns
The JSONStorage

◆ getStorages()

std::vector< std::shared_ptr< JSONStorage > > StorageCollection::getStorages ( )

Returns a list of all named JSONStorage in the repository

Returns

◆ getTemporaryIDStorages()

std::vector< std::pair< unsigned long, std::shared_ptr< JSONStorage > > > StorageCollection::getTemporaryIDStorages ( )

Returns a list of all temporary JSONStorage in the repository together with their result ID

Returns

◆ getTemporaryStorages()

std::vector< std::shared_ptr< JSONStorage > > StorageCollection::getTemporaryStorages ( )

Returns a list of all temporary JSONStorage in the repository

Returns

◆ operator=()

void StorageCollection::operator= ( StorageCollection const &  )
delete

◆ orderContainerByDependencies()

void StorageCollection::orderContainerByDependencies ( std::vector< std::pair< JSONStorage *, size_t >> &  candidates) const
protected
Here is the caller graph for this function:

◆ orderContainerByFIFO()

void StorageCollection::orderContainerByFIFO ( std::vector< std::pair< JSONStorage *, size_t >> &  candidates) const
protected
Here is the caller graph for this function:

◆ orderContainerByLRU()

void StorageCollection::orderContainerByLRU ( std::vector< std::pair< JSONStorage *, size_t >> &  candidates) const
protected
Here is the caller graph for this function:

◆ orderContainerByRandomExplorer()

void StorageCollection::orderContainerByRandomExplorer ( std::vector< std::pair< JSONStorage *, size_t >> &  candidates) const
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ orderContainerBySize()

void StorageCollection::orderContainerBySize ( std::vector< std::pair< JSONStorage *, size_t >> &  candidates) const
protected
Here is the caller graph for this function:

◆ parsedHierarchySize()

size_t StorageCollection::parsedHierarchySize ( const std::shared_ptr< JSONStorage > &  store) const
Here is the caller graph for this function:

◆ removeStorage() [1/2]

void StorageCollection::removeStorage ( const std::string &  name)

Removes a named JSONStorage by its name.

Parameters
nameThe name of the JSONStorage
Here is the caller graph for this function:

◆ removeStorage() [2/2]

void StorageCollection::removeStorage ( unsigned long  id)

Removes a temporary JSONStorage by its ID.

Parameters
idThe id of the JSONStorage

◆ stopJoin() [1/2]

void StorageCollection::stopJoin ( const joda::query::IValueProvider valProv)

Stops a join-process by it's identifying IValueProvider

Parameters
valProvthe identifying IValueProvider
Here is the call graph for this function:

◆ stopJoin() [2/2]

void StorageCollection::stopJoin ( const JoinManager jm)

Stops a join-process by it's JoinManager

Parameters
jmthe JoinManager to stop
Here is the call graph for this function:

◆ storageExists()

bool StorageCollection::storageExists ( const std::string &  name)

Checks if a given named JSONStorage exists.

Parameters
nameThe name of the JSONStorage
Returns
True if it exists, false else

Friends And Related Function Documentation

◆ CollectionTest

friend class CollectionTest
friend

◆ CollectionTest_DEPENDENCIES_Test

friend class CollectionTest_DEPENDENCIES_Test
friend

◆ CollectionTest_FIFO_Test

friend class CollectionTest_FIFO_Test
friend

◆ CollectionTest_LARGEST_Test

friend class CollectionTest_LARGEST_Test
friend

Field Documentation

◆ dependencies

std::unordered_set< std::pair<std::shared_ptr<JSONStorage>, std::shared_ptr<JSONStorage> >, boost::hash<std::pair<std::shared_ptr<JSONStorage>, std::shared_ptr<JSONStorage> > > > StorageCollection::dependencies
protected

◆ mut

std::mutex StorageCollection::mut
protected

◆ resultStorage

std::unordered_map<unsigned long, std::shared_ptr<JSONStorage> > StorageCollection::resultStorage
protected

◆ runningJoins

std::unordered_map<std::string, std::shared_ptr<JoinManager> > StorageCollection::runningJoins
protected

◆ storageInsertion

std::vector<std::string> StorageCollection::storageInsertion
protected

◆ storages

std::unordered_map<std::string, std::shared_ptr<JSONStorage> > StorageCollection::storages
protected

◆ tmpRes

std::atomic_ulong StorageCollection::tmpRes {JODA_STORE_VALID_ID_START}
protected

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