Upload manager changes
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "UploadManager.h"
|
#include "UploadManager.h"
|
||||||
#include "SiaDriveConfig.h"
|
#include "SiaDriveConfig.h"
|
||||||
|
|
||||||
using namespace Sia::Api;
|
using namespace Sia::Api;
|
||||||
|
|
||||||
|
|
||||||
CUploadManager::CUploadManager(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig) :
|
CUploadManager::CUploadManager(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig) :
|
||||||
CAutoThread(siaCurl, siaDriveConfig),
|
CAutoThread(siaCurl, siaDriveConfig),
|
||||||
_uploadDatabase(siaDriveConfig->GetRenter_UploadDbFilePath(), SQLite::OPEN_CREATE | SQLite::OPEN_READWRITE)
|
_uploadDatabase(siaDriveConfig->GetRenter_UploadDbFilePath(), SQLite::OPEN_CREATE | SQLite::OPEN_READWRITE)
|
||||||
@@ -18,4 +20,30 @@ CUploadManager::~CUploadManager()
|
|||||||
void CUploadManager::AutoThreadCallback(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig)
|
void CUploadManager::AutoThreadCallback(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UploadStatus CUploadManager::GetUploadStatus(const String& siaPath) const
|
||||||
|
{
|
||||||
|
return UploadStatus::NotFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUploadManager::AddOrUpdate(const String& siaPath, const String& filePath)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUploadManager::PurgeCompleteStatus()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUploadManager::PurgeErrorStatus()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CUploadManager::Remove(const String& siaPath)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "AutoThread.h"
|
#include "AutoThread.h"
|
||||||
#include "SQLiteCpp/Database.h"
|
#include "SQLiteCpp/Database.h"
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
NS_BEGIN(Sia)
|
NS_BEGIN(Sia)
|
||||||
NS_BEGIN(Api)
|
NS_BEGIN(Api)
|
||||||
@@ -8,6 +9,25 @@ NS_BEGIN(Api)
|
|||||||
class AFX_EXT_CLASS CUploadManager :
|
class AFX_EXT_CLASS CUploadManager :
|
||||||
public CAutoThread
|
public CAutoThread
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
enum class _UploadStatus
|
||||||
|
{
|
||||||
|
NotFound,
|
||||||
|
Queued,
|
||||||
|
Uploading,
|
||||||
|
Complete,
|
||||||
|
Error
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
std::uint64_t Id;
|
||||||
|
String SiaPath;
|
||||||
|
String CachePath;
|
||||||
|
_UploadStatus Status;
|
||||||
|
} UploadData;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CUploadManager(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig);
|
CUploadManager(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig);
|
||||||
|
|
||||||
@@ -16,9 +36,19 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SQLite::Database _uploadDatabase;
|
SQLite::Database _uploadDatabase;
|
||||||
|
std::mutex _uploadMutex;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void AutoThreadCallback(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig) override;
|
virtual void AutoThreadCallback(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig) override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
_UploadStatus GetUploadStatus(const String& siaPath) const;
|
||||||
|
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)
|
NS_END(2)
|
Reference in New Issue
Block a user