1 #ifndef CARMA_DBMS_TABLEMANAGER_H
2 #define CARMA_DBMS_TABLEMANAGER_H
40 unsigned minFreeSpace;
84 const unsigned& requiredSpace,
85 std::string& tableName,
const std::string& tag);
101 bool persistentConnection_;
102 bool useProductionDB_;
105 std::map<int,Partition> partitions_;
108 static int minimumFrameRetentionFrames_;
109 static int minimumCorrelRetentionFrames_;
110 static int minimumMinuteRetentionFrames_;
145 const bool& connectionIsOpen);
166 unsigned getFreeMB(
const std::string& partition)
const;
173 unsigned getTotalMB(
const std::string& partition)
const;
183 void dropTable(
const std::string& tableName)
const;
190 TableManagerException (
const char* msg,
const char* fileName = __FILE__,
191 const int lineNum = __LINE__)
192 : carma::util::ErrorException (msg, fileName, lineNum) {};
194 TableManagerException (
const std::string msg,
195 const char* fileName = __FILE__,
196 const int lineNum = __LINE__)
197 : carma::util::ErrorException (msg.c_str(), fileName, lineNum) {};
void openDBConnectionIfNecessary()
open a connection to the database if one is not currently established
Class used for configuring a DBConnection.
void closeDBConnectionIfNecessary()
close the db connection and delete the db connection object if !persistentConnection_ ...
MonitorAggregateType
aggregate data type of the monitor[point,data file, table]
TableManager(const bool &persistentConnection=true, DBConfigurator *dbconf=NULL)
constructor
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 ...
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
This class is responsible for managing the large, short lived tables produced by CARMA.
DBConnection and DBConnectionFactory classes.
virtual int getAvailablePartition(const int &requiredSpace, const bool &connectionIsOpen)
find a partition on which a new table can be created.
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...
MonitorAverageType
average type of the monitor[point,data file,table]
Exception class for errors The exception comes with a text string that can be printed or logged...
unsigned getFreeMB(const std::string &partition) const
get the available space (for normal users) in MB of the specified partition
void loadConfigurationInformation()
(re)load config info regarding partitions from the db this is called by the constructor and can be ca...
void closeDBConnection()
close the DBConnection
an abstract class from which database queries may be launched.
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...
unsigned getTotalMB(const std::string &partition) const
get the total (used+free) size, in megabytes, of the specified partition