This repository has been archived by the owner on Dec 4, 2020. It is now read-only.
/
LPBackend.h
51 lines (46 loc) · 2.28 KB
/
LPBackend.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef _LP_BACKEND_H
#define _LP_BACKEND_H
#include <QProcess>
#include <QString>
#include <QStringList>
#include <QDebug>
#include <QDir>
#include <QCoreApplication>
//Class of static functions for using the "lpreserver" backend
class LPBackend{
public:
//Informational
static QStringList listPossibleDatasets(); //list all possible datasets on the system
static QStringList listDatasets(); //list all current lifepreserver datasets
static QStringList listDatasetSubsets(QString dataset); //list all subsets of the main dataset
static QStringList listSnapshots(QString dsmountpoint); //list all snapshots for a particular dataset mountpoint
static QStringList listLPSnapshots(QString dataset); //list all snapshots created by life preserver
static QStringList listReplicationTargets(); //list all datasets with replication enabled
static QStringList listCurrentStatus(); //list the current snapshot/replication status
//Dataset Management
static bool setupDataset(QString dataset, int time, int numToKeep); //add or configure dataset
static bool removeDataset(QString dataset);
static bool datasetInfo(QString dataset, int& time, int& numToKeep); //get current settings for a dataset
//Snapshop Management
static void newSnapshot(QString dataset, QString snapshotname);
static bool removeSnapshot(QString dataset, QString snapshot);
static bool revertSnapshot(QString dataset, QString snapshot); //revert to given snapshot
static QString revertSnapshotFile(QString dataset, QString snapshot, QString filepath);
//Replication Management
static bool setupReplication(QString dataset, QString remotehost, QString user, int port, QString remotedataset, int time);
static bool removeReplication(QString dataset);
static bool replicationInfo(QString dataset, QString& remotehost, QString& user, int& port, QString& remotedataset, int& time);
//SSH Key Management
static bool setupSSHKey(QString remoteHost, QString remoteUser, int remotePort);
static QStringList findValidUSBDevices();
static bool copySSHKey(QString mountPath, QString localHost);
//Device Management
static QStringList listDevices();
static bool isMounted(QString device);
static bool unmountDevice(QString device);
//Mirroring Management
private:
static QStringList getCmdOutput(QString);
static int runCmd(QString);
};
#endif