58 lines
1.1 KiB
C++
58 lines
1.1 KiB
C++
#pragma once
|
|
#include "AutoThread.h"
|
|
#include "SQLiteCpp/Database.h"
|
|
#include <deque>
|
|
|
|
NS_BEGIN(Sia)
|
|
NS_BEGIN(Api)
|
|
|
|
class AFX_EXT_CLASS CUploadManager :
|
|
public CAutoThread
|
|
{
|
|
public:
|
|
enum class _UploadStatus : unsigned
|
|
{
|
|
NotFound,
|
|
Copying,
|
|
Queued,
|
|
Modified,
|
|
Uploading,
|
|
Complete,
|
|
Error
|
|
};
|
|
|
|
private:
|
|
typedef struct
|
|
{
|
|
std::uint64_t Id;
|
|
String SiaPath;
|
|
String FilePath;
|
|
String TempPath;
|
|
_UploadStatus Status;
|
|
} UploadData;
|
|
|
|
public:
|
|
CUploadManager(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig);
|
|
|
|
public:
|
|
virtual ~CUploadManager();
|
|
|
|
private:
|
|
SQLite::Database _uploadDatabase;
|
|
std::mutex _uploadMutex;
|
|
CSiaDriveConfig* _siaDriveConfig;
|
|
|
|
protected:
|
|
virtual void AutoThreadCallback(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig) override;
|
|
|
|
public:
|
|
_UploadStatus GetUploadStatus(const String& siaPath);
|
|
void AddOrUpdate(const String& siaPath, const String& filePath);
|
|
void Remove(const String& siaPath);
|
|
void PurgeCompleteStatus();
|
|
void PurgeErrorStatus();
|
|
};
|
|
|
|
typedef Sia::Api::CUploadManager::_UploadStatus UploadStatus;
|
|
|
|
NS_END(2) |