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

#include <JSONStorage.h>

Collaboration diagram for JSONStorage:
[legend]

Public Member Functions

virtual ~JSONStorage ()
 
void preparePurge ()
 
 JSONStorage (std::string query_string)
 
void insertDocumentsQueue (JsonContainerQueue::queue_t *queue)
 
void insertDocumentsQueue (JsonContainerQueue::queue_t *queue, size_t &insertedDocs, size_t &insertedConts)
 
void insertDocuments (moodycamel::ConcurrentQueue< std::unique_ptr< JSONContainer >> &queue, const std::atomic_bool &cf, std::atomic_uint &cs)
 
void insertDocuments (std::unique_ptr< JSONContainer > &&cont)
 
void getDocumentsQueue (JsonContainerRefQueue::queue_t *queue)
 
unsigned long size () const
 
unsigned long contSize () const
 
size_t estimatedSize () const
 
size_t estimatedCapacity () const
 
void freeAllMemory ()
 
size_t parsedSize () const
 
const std::string & getName () const
 
void writeFile (const std::string &file)
 
void writeFiles (const std::string &file)
 
std::vector< std::string > stringify (unsigned long start=0, unsigned long end=ULONG_MAX)
 
std::vector< std::shared_ptr< RJDocument > > getRaw (unsigned long start=0, unsigned long end=ULONG_MAX)
 
template<class Handler >
std::vector< bool > AcceptDocuments (Handler &handler, unsigned long start=0, unsigned long end=ULONG_MAX)
 
const std::string & getRegtmpdir () const
 
unsigned long getLastUsed () const
 
void addQueryString (const std::string &query_string)
 
const std::string & getQueryString () const
 

Protected Member Functions

const std::vector< std::unique_ptr< JSONContainer > > & getContainer () const
 
size_t threadCount (size_t containerSize) const
 
std::string getStorageID () const
 

Protected Attributes

friend QueryPlan
 
std::string name
 
std::string regtmpdir
 
std::string query
 
std::mutex documentMutex
 
std::vector< std::unique_ptr< JSONContainer > > container
 
unsigned long docCount = 0
 

Detailed Description

Represents a logical collection of JSON documents. They are either permanently named or temporary collections of result documents.

Constructor & Destructor Documentation

◆ ~JSONStorage()

JSONStorage::~JSONStorage ( )
virtual
Here is the call graph for this function:

◆ JSONStorage()

JSONStorage::JSONStorage ( std::string  query_string)
explicit
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ AcceptDocuments()

template<class Handler >
std::vector<bool> JSONStorage::AcceptDocuments ( Handler &  handler,
unsigned long  start = 0,
unsigned long  end = ULONG_MAX 
)
inline

Accepts a subset of all documents in the Container with the given handler

Parameters
handlerThe handler to use
startThe (inclusive) start index of the documents to accept
startThe (inclusive) end index of the documents to accept
Returns
a list of boolean values, one for each checked document.

◆ addQueryString()

void JSONStorage::addQueryString ( const std::string &  query_string)

Add query strings that resulted in the generation of this storage

Parameters
query_stringThe optimized final query string

◆ contSize()

unsigned long JSONStorage::contSize ( ) const

Returns the number of containers in the collection

Returns
Here is the caller graph for this function:

◆ estimatedCapacity()

size_t JSONStorage::estimatedCapacity ( ) const

Returns the estimated memory capacity of the collection (in bytes)

Returns
Here is the call graph for this function:

◆ estimatedSize()

size_t JSONStorage::estimatedSize ( ) const

Returns the estimated memory size of the collection (in bytes)

Returns
Here is the call graph for this function:

◆ freeAllMemory()

void JSONStorage::freeAllMemory ( )

Frees all non-essential memory. This includes all document contents (Metadata required for reparsing is excluded)

◆ getContainer()

const std::vector< std::unique_ptr< JSONContainer > > & JSONStorage::getContainer ( ) const
protected

◆ getDocumentsQueue()

void JSONStorage::getDocumentsQueue ( JsonContainerRefQueue::queue_t queue)

Fills the queue with references to all containers within the JSONStorage

Parameters
queuethe queue through which the containers are sent
Here is the call graph for this function:

◆ getLastUsed()

unsigned long JSONStorage::getLastUsed ( ) const

Returns a UNIX timestamp showing when the collection was last used.

◆ getName()

const std::string & JSONStorage::getName ( ) const

Returns the name of the JSONStorage. If temporary storage, then a reserved name is returned

Returns
Here is the caller graph for this function:

◆ getQueryString()

const std::string & JSONStorage::getQueryString ( ) const

Returns the query string that resulted in the creation of this Storage

Returns
The query string that resulted in the creation of this Storage

◆ getRaw()

std::vector< std::shared_ptr< RJDocument > > JSONStorage::getRaw ( unsigned long  start = 0,
unsigned long  end = ULONG_MAX 
)

Returns the internal content of a range of documents (all by default)

Parameters
startThe start of the range (inclusive)
endThe end of the range (inclusive)
Returns
a list of RJDocument

◆ getRegtmpdir()

const std::string & JSONStorage::getRegtmpdir ( ) const

Returns the directory used for temporarily serializing documents

Returns

◆ getStorageID()

std::string JSONStorage::getStorageID ( ) const
protected

◆ insertDocuments() [1/2]

void JSONStorage::insertDocuments ( moodycamel::ConcurrentQueue< std::unique_ptr< JSONContainer >> &  queue,
const std::atomic_bool &  cf,
std::atomic_uint &  cs 
)

Consumes containers from the given queue and inserts them into the JSONStorage

Parameters
queuethe queue through which the containers arrive
cfFlag signalling when insertion is finished
csCounter of remaining containers in the queue

◆ insertDocuments() [2/2]

void JSONStorage::insertDocuments ( std::unique_ptr< JSONContainer > &&  cont)

Inserts a single container into the JSONStorage

Parameters
contThe container to insert

◆ insertDocumentsQueue() [1/2]

void JSONStorage::insertDocumentsQueue ( JsonContainerQueue::queue_t queue)

Consumes documents from the given queue and inserts them into the JSONStorage

Parameters
queuethe queue through which the documents arrive
Here is the call graph for this function:

◆ insertDocumentsQueue() [2/2]

void JSONStorage::insertDocumentsQueue ( JsonContainerQueue::queue_t queue,
size_t &  insertedDocs,
size_t &  insertedConts 
)

Consumes documents from the given queue and inserts them into the JSONStorage, while keeping statistics

Parameters
queuethe queue through which the documents arrive
insertedDocsNumber of inserted documents, which will be increased by the JSONStorage
insertedContsNumber of inserted containers, which will be increased by the JSONStorage
Here is the call graph for this function:

◆ parsedSize()

size_t JSONStorage::parsedSize ( ) const
Here is the call graph for this function:

◆ preparePurge()

void JSONStorage::preparePurge ( )

◆ size()

unsigned long JSONStorage::size ( ) const

Returns the number of documents in the collection

Returns
Here is the caller graph for this function:

◆ stringify()

std::vector< std::string > JSONStorage::stringify ( unsigned long  start = 0,
unsigned long  end = ULONG_MAX 
)

Stringifies all documents in the specified range (all by default) into a list of strings.

Parameters
startThe start of the range (inclusive)
endThe end of the range (inclusive)
Returns
a list of strings

◆ threadCount()

size_t JSONStorage::threadCount ( size_t  containerSize) const
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeFile()

void JSONStorage::writeFile ( const std::string &  file)
Here is the call graph for this function:

◆ writeFiles()

void JSONStorage::writeFiles ( const std::string &  file)
Here is the call graph for this function:

Field Documentation

◆ container

std::vector<std::unique_ptr<JSONContainer> > JSONStorage::container
protected

◆ docCount

unsigned long JSONStorage::docCount = 0
protected

◆ documentMutex

std::mutex JSONStorage::documentMutex
protected

◆ name

std::string JSONStorage::name
protected

◆ query

std::string JSONStorage::query
protected

◆ QueryPlan

friend JSONStorage::QueryPlan
protected

◆ regtmpdir

std::string JSONStorage::regtmpdir
protected

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