FOSSology  4.4.0
Open Source License Compliance by Open Source Software
fo::AgentDatabaseHandler Class Reference

Database handler for agents. More...

#include <libfossAgentDatabaseHandler.hpp>

Inheritance diagram for fo::AgentDatabaseHandler:
Inheritance graph
Collaboration diagram for fo::AgentDatabaseHandler:
Collaboration graph

Public Member Functions

 AgentDatabaseHandler (DbManager dbManager)
 
 AgentDatabaseHandler (AgentDatabaseHandler &&other)
 
 AgentDatabaseHandler (const AgentDatabaseHandler &)=delete
 
virtual ~AgentDatabaseHandler ()
 
AgentDatabaseHandler operator= (const AgentDatabaseHandler &)=delete
 
bool begin () const
 BEGIN a transaction block in DB. More...
 
bool commit () const
 COMMIT a transaction block in DB. More...
 
bool rollback () const
 ROLLBACK a transaction block in DB. More...
 
char * getPFileNameForFileId (unsigned long pfileId) const
 Get the file name of a give pfile id. More...
 
std::string queryUploadTreeTableName (int uploadId)
 Get the upload tree table name for a given upload id. More...
 
std::vector< unsigned long > queryFileIdsVectorForUpload (int uploadId, bool ignoreFilesWithMimeType) const
 Get pfile ids for a given upload id. More...
 
std::vector< unsigned long > queryFileIdsVectorForUpload (int uploadId, int agentId, bool ignoreFilesWithMimeType) const
 Get pfile ids for a given upload id which agent has not scanned. More...
 

Protected Attributes

DbManager dbManager
 DbManager to use.
 

Detailed Description

Database handler for agents.

Definition at line 25 of file libfossAgentDatabaseHandler.hpp.

Constructor & Destructor Documentation

◆ AgentDatabaseHandler() [1/3]

fo::AgentDatabaseHandler::AgentDatabaseHandler ( DbManager  _dbManager)

Constructor for AgentDatabaseHandler

Parameters
_dbManagerDbManager to use

Definition at line 24 of file libfossAgentDatabaseHandler.cc.

◆ AgentDatabaseHandler() [2/3]

fo::AgentDatabaseHandler::AgentDatabaseHandler ( AgentDatabaseHandler &&  other)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 32 of file libfossAgentDatabaseHandler.cc.

◆ AgentDatabaseHandler() [3/3]

fo::AgentDatabaseHandler::AgentDatabaseHandler ( const AgentDatabaseHandler )
delete

Explicitly disallow copy constructor

◆ ~AgentDatabaseHandler()

fo::AgentDatabaseHandler::~AgentDatabaseHandler ( )
virtual

Default destructor for AgentDatabaseHandler

Definition at line 40 of file libfossAgentDatabaseHandler.cc.

Member Function Documentation

◆ begin()

bool fo::AgentDatabaseHandler::begin ( ) const

BEGIN a transaction block in DB.

Returns
True on success;
False on failure;

Definition at line 49 of file libfossAgentDatabaseHandler.cc.

◆ commit()

bool fo::AgentDatabaseHandler::commit ( ) const

COMMIT a transaction block in DB.

Returns
True on success;
False on failure;

Definition at line 59 of file libfossAgentDatabaseHandler.cc.

◆ getPFileNameForFileId()

char * fo::AgentDatabaseHandler::getPFileNameForFileId ( unsigned long  pfileId) const

Get the file name of a give pfile id.

Parameters
pfileIdPfile to search
Returns
The file name (SHA1.MD5.SIZE)
See also
queryPFileForFileId()

Definition at line 80 of file libfossAgentDatabaseHandler.cc.

◆ operator=()

AgentDatabaseHandler fo::AgentDatabaseHandler::operator= ( const AgentDatabaseHandler )
delete

Explicitly disallow copy constructor

◆ queryFileIdsVectorForUpload() [1/2]

std::vector< unsigned long > fo::AgentDatabaseHandler::queryFileIdsVectorForUpload ( int  uploadId,
bool  ignoreFilesWithMimeType 
) const

Get pfile ids for a given upload id.

Parameters
uploadIdUpload id to fetch from
ignoreFilesWithMimeTypeignore files with particular mimetype
Returns
Vector of pfile ids in given upload id
See also
queryFileIdsForUpload()

Definition at line 92 of file libfossAgentDatabaseHandler.cc.

◆ queryFileIdsVectorForUpload() [2/2]

std::vector< unsigned long > fo::AgentDatabaseHandler::queryFileIdsVectorForUpload ( int  uploadId,
int  agentId,
bool  ignoreFilesWithMimeType 
) const

Get pfile ids for a given upload id which agent has not scanned.

Parameters
uploadIdUpload id to fetch from
agentIdAgent id to filter pfiles for
ignoreFilesWithMimeTypeignore files with particular mimetype
Returns
Vector of pfile ids in given upload id
See also
getSelectedPFiles()

Definition at line 106 of file libfossAgentDatabaseHandler.cc.

◆ queryUploadTreeTableName()

std::string fo::AgentDatabaseHandler::queryUploadTreeTableName ( int  uploadId)

Get the upload tree table name for a given upload id.

Parameters
uploadIdUpload id to check
Returns
Name of the table holding the upload tree

Definition at line 120 of file libfossAgentDatabaseHandler.cc.

◆ rollback()

bool fo::AgentDatabaseHandler::rollback ( ) const

ROLLBACK a transaction block in DB.

Returns
True on success;
False on failure;

Definition at line 69 of file libfossAgentDatabaseHandler.cc.


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