-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy paths3consolemanager.h
82 lines (63 loc) · 2.31 KB
/
s3consolemanager.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef S3CONSOLEMANAGER_H
#define S3CONSOLEMANAGER_H
#include <QObject>
#include <aws/core/Aws.h>
#include <aws/s3/S3Client.h>
#include <qs3client.h>
#include <config.h>
#include <cli.h>
using namespace qlibs3;
typedef std::uint64_t hash_t;
constexpr hash_t prime = 0x100000001B3ull;
constexpr hash_t basis = 0xCBF29CE484222325ull;
hash_t hash_(char const *str);
constexpr hash_t hash_compile_time(char const *str, hash_t last_value);
struct ObjectInfo {
QString fileName;
QString bucketName;
QString keyName;
};
class S3ConsoleManager : public QObject
{
Q_OBJECT
public:
Cli *m_cli;
explicit S3ConsoleManager(QObject *parent = 0, QS3Config *config = 0, Cli *cli = 0);
void ListObjects(const QString &bucketName, const QString &marker, const QString &prefix);
void PutObject(const QString &srcPath, const QString &bucketName, const QString &objectName);
void GetObject(const QString &bucketName, const QString &objectName, const QString &dstPath);
void CreateBucket(const QString &bucketName);
void DeleteBucket(const QString &bucketName);
void DeleteObject(const QString &bucketName, const QString &objectName);
void ListBuckets();
explicit S3ConsoleManager(QObject *parent = 0);
~S3ConsoleManager();
signals:
void Finished();
void Continue();
void ContinueList(const QString &bucketName, const QString &marker, const QString &prefix);
void ContinuePrepareGet(const QString &bucketName, const QString &marker, const QString &prefix,
const QString dstDir);
public slots:
void Execute();
void PutObjects();
void DeleteOneFile();
void ListBucketInfo(s3bucket bucket);
void Result(bool, s3error error);
void PrePareGetObjects(const QString &bucketName, const QString &marker, const QString &prefix,
QString &dstDir);
void GetObjects();
void ListObjectInfo(s3object);
void ListPrefixInfo(s3prefix);
void ListObjectResult(bool success, s3error error, bool truncated);
void stop();
void myProgress(uint64_t, uint64_t);
void downloadOrUploadresult(TransferStatus);
void progressError(s3error error);
void showLog(const QString &log);
private:
QS3Client *s3;
ObjectHandlerInterface *h;
QList<ObjectInfo> m_objectList;
};
#endif // S3CONSOLEMANAGER_H