CARMA C++
|
This class is responsible for managing the large, short lived tables produced by CARMA. More...
#include <carma/dbms/TableManager.h>
Public Member Functions | |
virtual int | createMonitorDataTable (const carma::dbms::MonitorAverageType &averageType, const carma::dbms::MonitorAggregateType &aggType, const unsigned &requiredSpace, std::string &tableName, const std::string &tag) |
create a monitor data table table More... | |
void | loadConfigurationInformation () |
(re)load config info regarding partitions from the db this is called by the constructor and can be called periodically after construction to check for configuration changes More... | |
TableManager (const bool &persistentConnection=true, DBConfigurator *dbconf=NULL) | |
constructor More... | |
void | updateMonitorIndexTable (const std::string &tableName, const MonitorAverageType &averageType) |
insert the max and min frame counts into the specified row in the volatile tables table. More... | |
Protected Member Functions | |
void | closeDBConnection () |
close the DBConnection More... | |
void | closeDBConnectionIfNecessary () |
close the db connection and delete the db connection object if !persistentConnection_ More... | |
void | dropTable (const std::string &tableName) const |
removes a table from the db and removes its entry in MONITOR_INDEX_TABLE Callers from this class must already have opened a DBConnection More... | |
virtual int | getAvailablePartition (const int &requiredSpace, const bool &connectionIsOpen) |
find a partition on which a new table can be created. More... | |
std::map< int, Partition > | getEmptyPartitions (const bool &connectionIsOpen) |
get the partitions which do not have any volatile tables on them This method queries the database to determine this; it does not interrogate the filesystem the returned map has partition IDs as its keys and Partition objects as its values More... | |
unsigned | getFreeMB (const std::string &partition) const |
get the available space (for normal users) in MB of the specified partition More... | |
unsigned | getTotalMB (const std::string &partition) const |
get the total (used+free) size, in megabytes, of the specified partition More... | |
void | openDBConnectionIfNecessary () |
open a connection to the database if one is not currently established More... | |
Protected Attributes | |
carma::dbms::DBConnection * | dbc_ |
DBConfigurator * | dbconf_ |
std::map< int, Partition > | partitions_ |
bool | persistentConnection_ |
std::string | rdbms_ |
bool | useProductionDB_ |
Static Protected Attributes | |
static int | minimumCorrelRetentionFrames_ |
static int | minimumFrameRetentionFrames_ |
static int | minimumMinuteRetentionFrames_ |
This class is responsible for managing the large, short lived tables produced by CARMA.
Examples of such tables are the monitor data tables and the log tables. All requests to create new tables therefore must be submitted via this class. An object of this class maintains a map of partitions where tables can be located. Once partitions fill up, this class will drop old tables as it receives create table requests.
Definition at line 34 of file TableManager.h.
carma::dbms::TableManager::TableManager | ( | const bool & | persistentConnection = true , |
DBConfigurator * | dbconf = NULL |
||
) |
constructor
persistentConnection | maintain a persistent connection to the db for the life of this object? |
dbconf | DBConfigurator object used to configure the DBConnection objects this class creates. To guard against the caller deleting this pointer after a TableManager has been created, this constructor creates a copy of the dbconf object which is pointed to |
DBConnectionException |
|
protected |
close the DBConnection
|
protected |
close the db connection and delete the db connection object if !persistentConnection_
|
virtual |
create a monitor data table table
averageType | [in] averageType the average type of the table |
aggType | [in] dataType the type of data that will be loaded into the table |
requiredSpace | [in] requiredSpace the space required for the table, in MB |
tableName | [out] tableName the name of the created table which will have the tag parameter at the end |
tag | [in] tag string to append to the end of the table base name to assure that the table name is unique |
DBConnectionException |
|
protected |
removes a table from the db and removes its entry in MONITOR_INDEX_TABLE Callers from this class must already have opened a DBConnection
tableName | the table to be removed |
DBConnectionException |
|
protectedvirtual |
find a partition on which a new table can be created.
This method will delete tables to free up the specified amount of disk space if necessary. The target partition will be the partition with the oldest table which contains at least the required amount of space when empty
requiredSpace | the amount of space (in MB) above the minimum allowed space that must be made available |
connectionIsOpen | the caller (a method from this class) has already opened the connection to the database |
TableManagerException | if no available partition can be found |
|
protected |
get the partitions which do not have any volatile tables on them This method queries the database to determine this; it does not interrogate the filesystem the returned map has partition IDs as its keys and Partition objects as its values
connectionIsOpen | the caller (a method from this class) has already opened the connection to the database |
|
protected |
get the available space (for normal users) in MB of the specified partition
partition | the partition for which to get the available space |
|
protected |
get the total (used+free) size, in megabytes, of the specified partition
partition | the partition for which to get the total size |
void carma::dbms::TableManager::loadConfigurationInformation | ( | ) |
(re)load config info regarding partitions from the db this is called by the constructor and can be called periodically after construction to check for configuration changes
DBConnectionException |
|
protected |
open a connection to the database if one is not currently established
DBConnectionException |
void carma::dbms::TableManager::updateMonitorIndexTable | ( | const std::string & | tableName, |
const MonitorAverageType & | averageType | ||
) |
insert the max and min frame counts into the specified row in the volatile tables table.
Generally called after data has been copletely loaded into a table
tableName | update the data for this table |
DBConnectionException |