source: src-qt4/life-preserver/LPWatcher.h @ f698804

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since f698804 was f698804, checked in by Ken Moore <ken@…>, 16 months ago

Get the new watcher class up to the same (or slightly more) functionality thatn the old implementation. Now to start adding the new checking for mirroring/resilvering and or zpool errors.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1#ifndef _LP_WATCHER_H
2#define _LP_WATCHER_H
3
4#include <QObject>
5#include <QFileSystemWatcher>
6#include <QStringList>
7#include <QString>
8#include <QHash>
9#include <QTimer>
10#include <QFile>
11#include <QTextStream>
12#include <QDebug>
13
14class LPWatcher : public QObject{
15        Q_OBJECT
16public:
17        LPWatcher();
18        ~LPWatcher();
19
20        QStringList getMessages(QString type, QStringList msgList);
21        QStringList getAllCurrentMessages();
22        bool isRunning();
23        bool hasError();
24
25public slots:
26        void start();
27        void stop();
28
29private:
30        //Internal paths for the lpreserver output files
31        QString FILE_LOG, FILE_ERROR, FILE_REPLICATION;
32        //Internal message Logs
33        QHash<unsigned int,QString> LOGS;
34        //File system watcher
35        QFileSystemWatcher *watcher;
36        QTimer *timer;
37        QFile *logfile, *repfile;
38        QTextStream *LFSTREAM, *RFSTREAM;
39        //Replication size variables
40        QString repTotK, lastSize;
41
42        void readLogFile(bool quiet = false);
43        void readReplicationFile(bool quiet = false);
44
45        void startRepFileWatcher();
46        void stopRepFileWatcher();
47
48        double displayToDoubleK(QString); // string->double conversion
49
50private slots:
51        void fileChanged(QString); //file system watcher saw a change
52        void checkErrorFile(); //check for serious system error file
53
54signals:
55        void MessageAvailable(QString type);
56};
57
58#endif
Note: See TracBrowser for help on using the repository browser.