Upload manager changes
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
#include "stdafx.h"
|
||||
#include "UploadManager.h"
|
||||
#include "SiaDriveConfig.h"
|
||||
|
||||
using namespace Sia::Api;
|
||||
|
||||
|
||||
CUploadManager::CUploadManager(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig) :
|
||||
CAutoThread(siaCurl, siaDriveConfig),
|
||||
_uploadDatabase(siaDriveConfig->GetRenter_UploadDbFilePath(), SQLite::OPEN_CREATE | SQLite::OPEN_READWRITE)
|
||||
@@ -19,3 +21,29 @@ void CUploadManager::AutoThreadCallback(const CSiaCurl& siaCurl, CSiaDriveConfig
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
#include "AutoThread.h"
|
||||
#include "SQLiteCpp/Database.h"
|
||||
#include <deque>
|
||||
|
||||
NS_BEGIN(Sia)
|
||||
NS_BEGIN(Api)
|
||||
@@ -8,6 +9,25 @@ NS_BEGIN(Api)
|
||||
class AFX_EXT_CLASS CUploadManager :
|
||||
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:
|
||||
CUploadManager(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig);
|
||||
|
||||
@@ -16,9 +36,19 @@ public:
|
||||
|
||||
private:
|
||||
SQLite::Database _uploadDatabase;
|
||||
std::mutex _uploadMutex;
|
||||
|
||||
protected:
|
||||
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)
|
Reference in New Issue
Block a user