Begin refactoring upload manager
This commit is contained in:
@@ -20,7 +20,6 @@ public:
|
||||
{
|
||||
NotFound,
|
||||
Queued,
|
||||
Modified,
|
||||
Uploading,
|
||||
Complete,
|
||||
Error
|
||||
@@ -50,19 +49,19 @@ public:
|
||||
virtual ~CUploadManager();
|
||||
|
||||
private:
|
||||
CSiaDriveConfig* _siaDriveConfig;
|
||||
SQLite::Database _uploadDatabase;
|
||||
std::mutex _uploadMutex;
|
||||
SString _activeSiaPath;
|
||||
|
||||
private:
|
||||
void HandleFileRemove(const CSiaCurl& siaCurl, const SString& siaPath, const SString& siaDriveFilePath);
|
||||
CSiaDriveConfig* GetSiaDriveConfig() const { return _siaDriveConfig; }
|
||||
|
||||
bool HandleFileRemove(const CSiaCurl& siaCurl, const SString& siaPath, const SString& siaDriveFilePath = "");
|
||||
bool CreateSiaDriveFile(const SString& siaPath, const SString& filePath, const SString& tempSourcePath, const SString& siaDriveFilePath);
|
||||
void DeleteFilesRemovedFromSia(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig, const bool& isStartup = false);
|
||||
void RemoveFileFromSia(const CSiaCurl& siaCurl, const SString& siaPath, FilePath removeFilePath);
|
||||
|
||||
protected:
|
||||
virtual void AutoThreadCallback(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig) override;
|
||||
|
||||
public:
|
||||
static SString UploadStatusToString(const _UploadStatus& uploadStatus);
|
||||
|
||||
@@ -507,6 +506,40 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class RenameModifiedFileFailed :
|
||||
public CEvent
|
||||
{
|
||||
public:
|
||||
RenameModifiedFileFailed(const SString& siaPath, const SString& filePath, const SString& tempSourcePath) :
|
||||
_siaPath(siaPath),
|
||||
_filePath(filePath),
|
||||
_tempSourcePath(tempSourcePath)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~RenameModifiedFileFailed()
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
const SString _siaPath;
|
||||
const SString _filePath;
|
||||
const SString _tempSourcePath;
|
||||
|
||||
public:
|
||||
virtual SString GetSingleLineMessage() const override
|
||||
{
|
||||
return L"RenameModifiedFileFailed|SP|" + _siaPath + L"|FP|" + _filePath + L"|TSP|" + _tempSourcePath;
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<CEvent> Clone() const override
|
||||
{
|
||||
return std::shared_ptr<CEvent>(new RenameModifiedFileFailed(_siaPath, _filePath, _tempSourcePath));
|
||||
}
|
||||
};
|
||||
|
||||
class DeleteTemporarySiaDriveFileFailed :
|
||||
public CEvent
|
||||
{
|
||||
|
Reference in New Issue
Block a user