Audacity 3.2.0
|
#include <LocalProjectSnapshot.h>
Classes | |
struct | ProjectBlocksLock |
struct | SnapshotData |
struct | Tag |
Public Types | |
using | Promise = std::promise< SnapshotData > |
using | Future = std::future< SnapshotData > |
Public Member Functions | |
LocalProjectSnapshot (Tag, const ServiceConfig &config, const OAuthService &oauthService, ProjectCloudExtension &extension, std::string name, UploadMode mode, AudiocomTrace trace) | |
~LocalProjectSnapshot () override | |
bool | IsCompleted () const override |
std::shared_ptr< AudacityProject > | GetProject () |
void | Start () override |
void | SetUploadData (const ProjectUploadData &data) override |
void | Cancel () override |
void | Abort () |
Public Member Functions inherited from audacity::cloud::audiocom::sync::ProjectUploadOperation | |
virtual | ~ProjectUploadOperation ()=default |
virtual void | Start ()=0 |
virtual void | SetUploadData (const ProjectUploadData &data)=0 |
virtual bool | IsCompleted () const =0 |
Public Member Functions inherited from audacity::concurrency::ICancellable | |
virtual | ~ICancellable ()=default |
virtual void | Cancel ()=0 |
Static Public Member Functions | |
static Future | Create (const ServiceConfig &config, const OAuthService &oauthService, ProjectCloudExtension &extension, std::string name, UploadMode mode, AudiocomTrace trace) |
Private Member Functions | |
void | UploadFailed (CloudSyncError error) |
void | DataUploadFailed (const ResponseResult &uploadResult) |
void | DataUploadFailed (const MissingBlocksUploadProgress &uploadResult) |
void | UpdateProjectSnapshot () |
void | OnSnapshotCreated (const CreateSnapshotResponse &response, bool newProject) |
void | StorePendingSnapshot (const CreateSnapshotResponse &response, const ProjectUploadData &data) |
void | MarkSnapshotSynced () |
void | DeleteSnapshot () |
Private Attributes | |
ProjectCloudExtension & | mProjectCloudExtension |
std::weak_ptr< AudacityProject > | mWeakProject |
std::promise< ProjectUploadData > | mProjectDataPromise |
const ServiceConfig & | mServiceConfig |
const OAuthService & | mOAuthService |
const AudiocomTrace | mAudiocomTrace |
std::string | mProjectName |
std::unique_ptr< ProjectBlocksLock > | mProjectBlocksLock |
std::shared_ptr< MissingBlocksUploader > | mMissingBlockUploader |
std::mutex | mCreateSnapshotResponseMutex |
std::optional< CreateSnapshotResponse > | mCreateSnapshotResponse |
UploadMode | mUploadMode { UploadMode::Normal } |
Promise | mCreateSnapshotPromise |
concurrency::CancellationContextPtr | mCancellationContext |
std::atomic< bool > | mCompleted { false } |
std::atomic< bool > | mCancelled { false } |
std::atomic< bool > | mProjectDataReady { false } |
Definition at line 48 of file LocalProjectSnapshot.h.
using audacity::cloud::audiocom::sync::LocalProjectSnapshot::Future = std::future<SnapshotData> |
Definition at line 64 of file LocalProjectSnapshot.h.
using audacity::cloud::audiocom::sync::LocalProjectSnapshot::Promise = std::promise<SnapshotData> |
Definition at line 63 of file LocalProjectSnapshot.h.
audacity::cloud::audiocom::sync::LocalProjectSnapshot::LocalProjectSnapshot | ( | Tag | , |
const ServiceConfig & | config, | ||
const OAuthService & | oauthService, | ||
ProjectCloudExtension & | extension, | ||
std::string | name, | ||
UploadMode | mode, | ||
AudiocomTrace | trace | ||
) |
Definition at line 200 of file LocalProjectSnapshot.cpp.
|
override |
Definition at line 215 of file LocalProjectSnapshot.cpp.
void audacity::cloud::audiocom::sync::LocalProjectSnapshot::Abort | ( | ) |
Definition at line 287 of file LocalProjectSnapshot.cpp.
References audacity::cloud::audiocom::sync::CloudSyncError::Aborted, DeleteSnapshot(), mCancellationContext, mCancelled, mProjectDataPromise, mProjectDataReady, and UploadFailed().
|
overridevirtual |
Implements audacity::concurrency::ICancellable.
Definition at line 275 of file LocalProjectSnapshot.cpp.
References audacity::cloud::audiocom::sync::CloudSyncError::Cancelled, mCancellationContext, mCancelled, mProjectDataPromise, mProjectDataReady, and UploadFailed().
|
static |
Definition at line 219 of file LocalProjectSnapshot.cpp.
References anonymous_namespace{CloudProjectFileIOExtensions.cpp}::extension, name, and project.
|
private |
Definition at line 313 of file LocalProjectSnapshot.cpp.
References audacity::cloud::audiocom::sync::CloudSyncError::Cancelled, audacity::cloud::audiocom::Conflict, audacity::cloud::audiocom::sync::CloudSyncError::DataUploadFailed, audacity::cloud::audiocom::sync::DeduceError(), audacity::cloud::audiocom::sync::CloudSyncError::Network, audacity::cloud::audiocom::sync::CloudSyncError::ProjectStorageLimitReached, audacity::cloud::audiocom::Success, audacity::cloud::audiocom::sync::MissingBlocksUploadProgress::UploadErrors, and UploadFailed().
|
private |
Definition at line 308 of file LocalProjectSnapshot.cpp.
References audacity::cloud::audiocom::ResponseResult::Code, audacity::cloud::audiocom::ResponseResult::Content, audacity::cloud::audiocom::sync::DeduceError(), and UploadFailed().
Referenced by OnSnapshotCreated().
|
private |
Definition at line 608 of file LocalProjectSnapshot.cpp.
References audacity::network_manager::NetworkManager::doDelete(), audacity::cloud::audiocom::sync::CloudProjectsDatabase::Get(), audacity::cloud::audiocom::ServiceConfig::GetDeleteSnapshotUrl(), audacity::network_manager::NetworkManager::GetInstance(), mCreateSnapshotResponse, mServiceConfig, audacity::cloud::audiocom::sync::CloudProjectsDatabase::RemovePendingSnapshot(), and audacity::cloud::audiocom::SetCommonHeaders().
Referenced by Abort().
std::shared_ptr< AudacityProject > audacity::cloud::audiocom::sync::LocalProjectSnapshot::GetProject | ( | ) |
Definition at line 259 of file LocalProjectSnapshot.cpp.
References mWeakProject.
|
overridevirtual |
Implements audacity::cloud::audiocom::sync::ProjectUploadOperation.
Definition at line 254 of file LocalProjectSnapshot.cpp.
References mCompleted.
|
private |
Definition at line 573 of file LocalProjectSnapshot.cpp.
References audacity::cloud::audiocom::sync::DeduceUploadError(), audacity::network_manager::NetworkManager::doPost(), audacity::cloud::audiocom::sync::CloudProjectsDatabase::Get(), audacity::network_manager::NetworkManager::GetInstance(), audacity::cloud::audiocom::ServiceConfig::GetSnapshotSyncUrl(), mAudiocomTrace, mCancellationContext, mCompleted, mCreateSnapshotResponse, mProjectCloudExtension, mServiceConfig, audacity::cloud::audiocom::sync::ProjectCloudExtension::OnSyncCompleted(), audacity::cloud::audiocom::sync::CloudProjectsDatabase::RemovePendingSnapshot(), audacity::cloud::audiocom::SetCommonHeaders(), and UploadFailed().
Referenced by OnSnapshotCreated().
|
private |
Definition at line 442 of file LocalProjectSnapshot.cpp.
References audacity::cloud::audiocom::ResponseResult::Code, audacity::cloud::audiocom::sync::MissingBlocksUploader::Create(), DataUploadFailed(), audacity::cloud::audiocom::sync::ProjectSyncState::FileUrls, audacity::cloud::audiocom::sync::CloudProjectsDatabase::Get(), audacity::cloud::audiocom::sync::DataUploader::Get(), audacity::cloud::audiocom::IsUploadRecoverable(), audacity::cloud::audiocom::sync::MakeClientFailure(), MarkSnapshotSynced(), mCancellationContext, mCancelled, mCreateSnapshotPromise, mCreateSnapshotResponse, mCreateSnapshotResponseMutex, audacity::cloud::audiocom::sync::ProjectSyncState::MissingBlocks, mMissingBlockUploader, mProjectBlocksLock, mProjectCloudExtension, mProjectDataPromise, mServiceConfig, mWeakProject, audacity::cloud::audiocom::sync::ProjectCloudExtension::OnBlockUploaded(), audacity::cloud::audiocom::sync::ProjectCloudExtension::OnProjectDataUploaded(), audacity::cloud::audiocom::sync::ProjectCloudExtension::OnSnapshotCreated(), project, audacity::cloud::audiocom::sync::CloudProjectsDatabase::RemovePendingProjectBlock(), StorePendingSnapshot(), audacity::cloud::audiocom::Success, audacity::cloud::audiocom::sync::CreateSnapshotResponse::SyncState, audacity::cloud::audiocom::sync::DataUploader::Upload(), UploadFailed(), and XO().
Referenced by UpdateProjectSnapshot().
|
overridevirtual |
Implements audacity::cloud::audiocom::sync::ProjectUploadOperation.
Definition at line 269 of file LocalProjectSnapshot.cpp.
References mProjectDataPromise, and mProjectDataReady.
|
overridevirtual |
Implements audacity::cloud::audiocom::sync::ProjectUploadOperation.
Definition at line 264 of file LocalProjectSnapshot.cpp.
References UpdateProjectSnapshot().
|
private |
Definition at line 542 of file LocalProjectSnapshot.cpp.
References audacity::cloud::audiocom::sync::CloudProjectsDatabase::AddPendingProjectBlob(), audacity::cloud::audiocom::sync::CloudProjectsDatabase::AddPendingProjectBlocks(), audacity::cloud::audiocom::sync::CloudProjectsDatabase::AddPendingSnapshot(), audacity::cloud::audiocom::sync::UploadUrls::FailUrl, audacity::cloud::audiocom::sync::ProjectSyncState::FileUrls, audacity::cloud::audiocom::sync::CloudProjectsDatabase::Get(), audacity::cloud::audiocom::ServiceConfig::GetSnapshotSyncUrl(), audacity::cloud::audiocom::sync::SnapshotInfo::Id, audacity::cloud::audiocom::sync::ProjectInfo::Id, mProjectBlocksLock, mServiceConfig, audacity::cloud::audiocom::sync::CreateSnapshotResponse::Project, audacity::cloud::audiocom::sync::ProjectUploadData::ProjectSnapshot, audacity::cloud::audiocom::sync::CreateSnapshotResponse::Snapshot, audacity::cloud::audiocom::sync::UploadUrls::SuccessUrl, audacity::cloud::audiocom::sync::CreateSnapshotResponse::SyncState, and audacity::cloud::audiocom::sync::UploadUrls::UploadUrl.
Referenced by OnSnapshotCreated().
|
private |
Definition at line 345 of file LocalProjectSnapshot.cpp.
References audacity::network_manager::common_headers::Accept, audacity::network_manager::common_headers::AcceptLanguage, audacity::network_manager::common_content_types::ApplicationJson, audacity::network_manager::common_headers::Authorization, audacity::network_manager::common_headers::ContentType, audacity::cloud::audiocom::sync::CreateNew, audacity::cloud::audiocom::sync::DeduceUploadError(), audacity::cloud::audiocom::sync::DeserializeCreateSnapshotResponse(), audacity::network_manager::NetworkManager::doPost(), audacity::cloud::audiocom::sync::ProjectForm::Force, audacity::cloud::audiocom::sync::ForceOverwrite, audacity::cloud::audiocom::ServiceConfig::GetAcceptLanguageValue(), audacity::cloud::audiocom::OAuthService::GetAccessToken(), audacity::cloud::audiocom::sync::ProjectCloudExtension::GetCloudProjectId(), audacity::cloud::audiocom::ServiceConfig::GetCreateProjectUrl(), audacity::cloud::audiocom::ServiceConfig::GetCreateSnapshotUrl(), audacity::network_manager::NetworkManager::GetInstance(), audacity::cloud::audiocom::sync::ProjectCloudExtension::GetSnapshotId(), audacity::cloud::audiocom::sync::ProjectForm::Hashes, audacity::cloud::audiocom::sync::ProjectForm::HeadSnapshotId, audacity::cloud::audiocom::sync::ProjectCloudExtension::IsCloudProject(), audacity::cloud::audiocom::sync::MakeClientFailure(), mCancellationContext, mCreateSnapshotPromise, mOAuthService, mProjectBlocksLock, mProjectCloudExtension, mProjectName, mServiceConfig, mUploadMode, mWeakProject, audacity::cloud::audiocom::sync::ProjectForm::Name, OnSnapshotCreated(), project, audacity::cloud::audiocom::sync::Serialize(), UploadFailed(), and XO().
Referenced by Start().
|
private |
Definition at line 301 of file LocalProjectSnapshot.cpp.
References mAudiocomTrace, mCompleted, mProjectCloudExtension, and audacity::cloud::audiocom::sync::ProjectCloudExtension::OnSyncCompleted().
Referenced by Abort(), Cancel(), DataUploadFailed(), MarkSnapshotSynced(), OnSnapshotCreated(), and UpdateProjectSnapshot().
|
private |
Definition at line 109 of file LocalProjectSnapshot.h.
Referenced by MarkSnapshotSynced(), and UploadFailed().
|
private |
Definition at line 125 of file LocalProjectSnapshot.h.
Referenced by Abort(), Cancel(), MarkSnapshotSynced(), OnSnapshotCreated(), and UpdateProjectSnapshot().
|
private |
Definition at line 128 of file LocalProjectSnapshot.h.
Referenced by Abort(), Cancel(), and OnSnapshotCreated().
|
private |
Definition at line 127 of file LocalProjectSnapshot.h.
Referenced by IsCompleted(), MarkSnapshotSynced(), and UploadFailed().
|
private |
Definition at line 123 of file LocalProjectSnapshot.h.
Referenced by OnSnapshotCreated(), and UpdateProjectSnapshot().
|
private |
Definition at line 119 of file LocalProjectSnapshot.h.
Referenced by DeleteSnapshot(), MarkSnapshotSynced(), and OnSnapshotCreated().
|
private |
Definition at line 118 of file LocalProjectSnapshot.h.
Referenced by OnSnapshotCreated().
|
private |
Definition at line 116 of file LocalProjectSnapshot.h.
Referenced by OnSnapshotCreated().
|
private |
Definition at line 108 of file LocalProjectSnapshot.h.
Referenced by UpdateProjectSnapshot().
|
private |
Definition at line 114 of file LocalProjectSnapshot.h.
Referenced by OnSnapshotCreated(), StorePendingSnapshot(), and UpdateProjectSnapshot().
|
private |
Definition at line 102 of file LocalProjectSnapshot.h.
Referenced by MarkSnapshotSynced(), OnSnapshotCreated(), UpdateProjectSnapshot(), and UploadFailed().
|
private |
Definition at line 105 of file LocalProjectSnapshot.h.
Referenced by Abort(), Cancel(), OnSnapshotCreated(), and SetUploadData().
|
private |
Definition at line 129 of file LocalProjectSnapshot.h.
Referenced by Abort(), Cancel(), and SetUploadData().
|
private |
Definition at line 111 of file LocalProjectSnapshot.h.
Referenced by UpdateProjectSnapshot().
|
private |
Definition at line 107 of file LocalProjectSnapshot.h.
Referenced by DeleteSnapshot(), MarkSnapshotSynced(), OnSnapshotCreated(), StorePendingSnapshot(), and UpdateProjectSnapshot().
|
private |
Definition at line 121 of file LocalProjectSnapshot.h.
Referenced by UpdateProjectSnapshot().
|
private |
Definition at line 103 of file LocalProjectSnapshot.h.
Referenced by GetProject(), OnSnapshotCreated(), and UpdateProjectSnapshot().