#ifndef __DatabaseThreadShared_h_ #define __DatabaseThreadShared_h_ #include "../shared/DatabaseWithRetry.h" #include "../shared/XmlSupport.h" #include "Types.h" // These are used by the units which work closely with the database thread. // The names of these modules is unfortunate. In fact, there are now several // threads which talk to the database. // When asked for the alert starting place, you can reply with this value. static const AlertId displayNoAlertData = -1; // This is used in mulitple places. inline void sendLastId(XmlNode &message, AlertId lastId) { message["RESTART"].properties["LAST_ID"] = ntoa(lastId); } struct LastIdCacheInfo { AlertId lastAlertId; // This is live data for paying customers. AlertId delayedAlertId; // This is delayed 20 minutes for DEMO users. TimeVal nextAlertIdCheck; int lastAlertIdValidCount; LastIdCacheInfo() : lastAlertId(-1), delayedAlertId(-1), lastAlertIdValidCount(0) { } }; AlertId getLastAlertId(DatabaseWithRetry &database, LastIdCacheInfo &cache, bool live); #endif