|
|
@@ -13,6 +13,9 @@ const ThreadType snfGBUdbmgr::Type("snfGBUdbmgr"); |
|
|
|
|
|
|
|
snfGBUdbmgr::snfGBUdbmgr() : // Clean init and start thread. |
|
|
|
Thread(snfGBUdbmgr::Type, "GBUdb Manager"), // XCI Manager type and Name. |
|
|
|
MyGBUdb(NULL), // NULL our links to avoid
|
|
|
|
MyLOGmgr(NULL), // any errors when the thread starts.
|
|
|
|
TimeToStop(false), // It is not time to stop ;-)
|
|
|
|
CondenseGuardTime(600000), // 10 minute guard time by default. |
|
|
|
TimeTriggerOnOff(true), // By default, condense once per day. |
|
|
|
TimeTrigger(84600000), |
|
|
@@ -23,10 +26,7 @@ snfGBUdbmgr::snfGBUdbmgr() : |
|
|
|
SizeTriggerOnOff(true), // By default trigger on size as a |
|
|
|
SizeTriggerValue(150), // safety valve at 150Mbytes. |
|
|
|
CheckpointOnOff(true), // By default save a snapshot once |
|
|
|
CheckpointTrigger(3600000), // every hour. |
|
|
|
MyGBUdb(NULL), // NULL our links to avoid |
|
|
|
MyLOGmgr(NULL), // any errors when the thread starts. |
|
|
|
TimeToStop(false) { // It is not time to stop ;-) |
|
|
|
CheckpointTrigger(3600000) { // every hour. |
|
|
|
run(); // Start our thread. |
|
|
|
} |
|
|
|
|
|
|
@@ -46,6 +46,11 @@ void snfGBUdbmgr::linkLOGmgr(snfLOGmgr& L) { |
|
|
|
ScopeMutex JustMe(MyMutex); // Lock for the config change. |
|
|
|
MyLOGmgr = &L; // Set the new link. |
|
|
|
} |
|
|
|
|
|
|
|
const int SECsASms = 1000; // How to convert seconds to milliseconds.
|
|
|
|
msclock toDuration(int Configuration_Integer) { // Convert int Seconds to timer duration.
|
|
|
|
return (Configuration_Integer * SECsASms); // Do the math and send it back.
|
|
|
|
}
|
|
|
|
|
|
|
|
void snfGBUdbmgr::configure(snfCFGData& CFGData) { // Establish or change our CFG. |
|
|
|
ScopeMutex JustMe(MyMutex); // Only when we're not busy. |
|
|
@@ -55,21 +60,19 @@ void snfGBUdbmgr::configure(snfCFGData& CFGData) { |
|
|
|
// Being careful not to muck with running timers unless their |
|
|
|
// configuration values have actually changed... |
|
|
|
|
|
|
|
const int SECsASms = 1000; // How to convert seconds to milliseconds. |
|
|
|
|
|
|
|
if(CondenseGuardTime.getDuration() != // If the condensation guard time is |
|
|
|
(SECsASms * CFGData.gbudb_database_condense_minimum_seconds_between)) { // new and different then set the |
|
|
|
CondenseGuardTime.setDuration( // condensation guard timer to the |
|
|
|
(SECsASms * CFGData.gbudb_database_condense_minimum_seconds_between) // new value. |
|
|
|
if(CondenseGuardTime.getDuration() != // If the condensation guard time is |
|
|
|
toDuration(CFGData.gbudb_database_condense_minimum_seconds_between)) { // new and different then set the |
|
|
|
CondenseGuardTime.setDuration( // condensation guard timer to the |
|
|
|
toDuration(CFGData.gbudb_database_condense_minimum_seconds_between) // new value. |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
TimeTriggerOnOff = CFGData.gbudb_database_condense_time_trigger_on_off; // Time-Trigger On? |
|
|
|
|
|
|
|
if(TimeTrigger.getDuration() != // Time-Trigger different? |
|
|
|
(SECsASms * CFGData.gbudb_database_condense_time_trigger_seconds)) { |
|
|
|
toDuration(CFGData.gbudb_database_condense_time_trigger_seconds)) { |
|
|
|
TimeTrigger.setDuration( // If it is then adopt the new value. |
|
|
|
SECsASms * CFGData.gbudb_database_condense_time_trigger_seconds |
|
|
|
toDuration(CFGData.gbudb_database_condense_time_trigger_seconds) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
@@ -87,9 +90,9 @@ void snfGBUdbmgr::configure(snfCFGData& CFGData) { |
|
|
|
CheckpointOnOff = CFGData.gbudb_database_checkpoint_on_off; // Checkpoint on? |
|
|
|
|
|
|
|
if(CheckpointTrigger.getDuration() != // If the Checkpoint time is |
|
|
|
(SECsASms * CFGData.gbudb_database_checkpoint_secs)) { // new and different then |
|
|
|
toDuration(CFGData.gbudb_database_checkpoint_secs)) { // new and different then |
|
|
|
CheckpointTrigger.setDuration( // adopt the new value. |
|
|
|
(SECsASms * CFGData.gbudb_database_checkpoint_secs) |
|
|
|
toDuration(CFGData.gbudb_database_checkpoint_secs) |
|
|
|
); |
|
|
|
} |
|
|
|
|