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

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

Add the ability to detect the results of a scrub on the system, as well as set up the system for detecting pool errors, and any resilvering. Just need to finish adding the parsing for the active tasks (as well as the disk errors).

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