open-source-search-engine/Process.h

108 lines
2.4 KiB
C
Raw Normal View History

2013-08-03 00:12:24 +04:00
// Gigablast, Inc., Copyright Mar 2007
#ifndef _PROCESS_H_
#define _PROCESS_H_
#define NO_MODE 0
#define EXIT_MODE 1
#define SAVE_MODE 2
#define LOCK_MODE 3
#include "HttpRequest.h"
//#include "Msg28.h"
2013-08-03 00:12:24 +04:00
2014-09-21 03:58:12 +04:00
#include "PageInject.h" // resumeImports() function
2013-08-03 00:12:24 +04:00
class Process {
public:
2014-05-11 23:48:56 +04:00
bool getFilesToCopy ( char *srcDir , class SafeBuf *buf ) ;
2013-08-03 00:12:24 +04:00
bool checkFiles ( char *dir );
// . the big save command
// . does not save everything, just the important stuff
bool save ( );
// . this will save everything and exit
// . urgent is true if we cored
bool shutdown ( bool urgent,
void *state = NULL,
void (*callback) (void *state ) = NULL);
bool checkNTPD();
Process ( ) ;
bool init ( ) ;
bool isAnyTreeSaving ( ) ;
2013-08-03 00:12:24 +04:00
bool save2 ( ) ;
bool shutdown2 ( ) ;
2015-02-12 08:54:36 +03:00
void disableTreeWrites ( bool shuttingDown ) ;
void enableTreeWrites ( bool shuttingDown ) ;
2013-08-03 00:12:24 +04:00
bool isRdbDumping ( ) ;
bool isRdbMerging ( ) ;
2015-02-12 08:54:36 +03:00
bool saveRdbTrees ( bool useThread , bool shuttingDown ) ;
2013-08-03 00:12:24 +04:00
bool saveRdbMaps ( bool useThread ) ;
bool saveRdbCaches ( bool useThread ) ;
bool saveBlockingFiles1 ( ) ;
bool saveBlockingFiles2 ( ) ;
void resetAll ( ) ;
void resetPageCaches ( ) ;
double getLoadAvg ( );
void resetLoadAvg ( );
2014-10-30 22:36:39 +03:00
int64_t getTotalDocsIndexed();
int64_t m_totalDocsIndexed;
2013-08-03 00:12:24 +04:00
class Rdb *m_rdbs[32];
2014-11-11 01:45:11 +03:00
int32_t m_numRdbs;
2013-08-03 00:12:24 +04:00
bool m_urgent;
char m_mode;
2014-10-30 22:36:39 +03:00
int64_t m_lastSaveTime;
int64_t m_processStartTime;
2013-08-03 00:12:24 +04:00
bool m_sentShutdownNote;
bool m_blockersNeedSave;
bool m_repairNeedsSave;
2014-11-11 01:45:11 +03:00
int32_t m_try;
2014-10-30 22:36:39 +03:00
int64_t m_firstShutdownTime;
2013-08-03 00:12:24 +04:00
void *m_callbackState;
void (*m_callback) (void *state);
// a timestamp for the sig alarm handler in Loop.cpp
2014-10-30 22:36:39 +03:00
int64_t m_lastHeartbeatApprox;
2013-08-03 00:12:24 +04:00
void callHeartbeat ();
bool m_threadOut;
bool m_suspendAutoSave;
bool gotPower ( TcpSocket *s );
bool m_powerReqOut;
bool m_powerIsOn;
2014-10-30 22:36:39 +03:00
int64_t m_powerOffTime;
2013-08-03 00:12:24 +04:00
HttpRequest m_r;
//Msg28 m_msg28;
2013-08-03 00:12:24 +04:00
bool m_exiting;
bool m_calledSave;
bool gotFanReply ( TcpSocket *s );
void checkFanSwitch ( ) ;
bool m_fanReqOut;
float m_dataCtrTemp;
float m_roofTemp;
2014-11-11 01:45:11 +03:00
int32_t m_currentFanState;
int32_t m_desiredFanState;
float m_diskUsage;
2014-10-30 22:36:39 +03:00
int64_t m_diskAvail;
2014-05-11 23:48:56 +04:00
char m_swapEnabled;
2013-08-03 00:12:24 +04:00
};
extern Process g_process;
extern char *g_files[];
#endif