|
|
|
|
|
|
|
|
|
|
|
|
|
|
snfGBUdbmgr::snfGBUdbmgr() : // Clean init and start thread. |
|
|
snfGBUdbmgr::snfGBUdbmgr() : // Clean init and start thread. |
|
|
Thread(snfGBUdbmgr::Type, "GBUdb Manager"), // XCI Manager type and Name. |
|
|
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. |
|
|
CondenseGuardTime(600000), // 10 minute guard time by default. |
|
|
TimeTriggerOnOff(true), // By default, condense once per day. |
|
|
TimeTriggerOnOff(true), // By default, condense once per day. |
|
|
TimeTrigger(84600000), |
|
|
TimeTrigger(84600000), |
|
|
|
|
|
|
|
|
SizeTriggerOnOff(true), // By default trigger on size as a |
|
|
SizeTriggerOnOff(true), // By default trigger on size as a |
|
|
SizeTriggerValue(150), // safety valve at 150Mbytes. |
|
|
SizeTriggerValue(150), // safety valve at 150Mbytes. |
|
|
CheckpointOnOff(true), // By default save a snapshot once |
|
|
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. |
|
|
run(); // Start our thread. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ScopeMutex JustMe(MyMutex); // Lock for the config change. |
|
|
ScopeMutex JustMe(MyMutex); // Lock for the config change. |
|
|
MyLOGmgr = &L; // Set the new link. |
|
|
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. |
|
|
void snfGBUdbmgr::configure(snfCFGData& CFGData) { // Establish or change our CFG. |
|
|
ScopeMutex JustMe(MyMutex); // Only when we're not busy. |
|
|
ScopeMutex JustMe(MyMutex); // Only when we're not busy. |
|
|
|
|
|
|
|
|
// Being careful not to muck with running timers unless their |
|
|
// Being careful not to muck with running timers unless their |
|
|
// configuration values have actually changed... |
|
|
// 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? |
|
|
TimeTriggerOnOff = CFGData.gbudb_database_condense_time_trigger_on_off; // Time-Trigger On? |
|
|
|
|
|
|
|
|
if(TimeTrigger.getDuration() != // Time-Trigger different? |
|
|
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. |
|
|
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) |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CheckpointOnOff = CFGData.gbudb_database_checkpoint_on_off; // Checkpoint on? |
|
|
CheckpointOnOff = CFGData.gbudb_database_checkpoint_on_off; // Checkpoint on? |
|
|
|
|
|
|
|
|
if(CheckpointTrigger.getDuration() != // If the Checkpoint time is |
|
|
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. |
|
|
CheckpointTrigger.setDuration( // adopt the new value. |
|
|
(SECsASms * CFGData.gbudb_database_checkpoint_secs) |
|
|
|
|
|
|
|
|
toDuration(CFGData.gbudb_database_checkpoint_secs) |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|