|  | Audacity 3.2.0
    | 
#include <CloudSyncService.h>
| Public Types | |
| enum class | SyncMode { Normal , ForceOverwrite , ForceNew } | 
| enum class | ProjectState { NotAvaliable , PendingSync , FullySynced } | 
| using | SyncPromise = std::promise< sync::ProjectSyncResult > | 
| using | SyncFuture = std::future< sync::ProjectSyncResult > | 
| using | GetProjectsPromise = std::promise< sync::GetProjectsResult > | 
| using | GetProjectsFuture = std::future< sync::GetProjectsResult > | 
| using | GetHeadSnapshotIDPromise = std::promise< sync::GetHeadSnapshotIDResult > | 
| using | GetHeadSnapshotIDFuture = std::future< sync::GetHeadSnapshotIDResult > | 
| Public Member Functions | |
| GetProjectsFuture | GetProjects (concurrency::CancellationContextPtr context, int page, int pageSize, std::string_view searchString) | 
| Retrieve the list of projects from the cloud.  More... | |
| SyncFuture | OpenFromCloud (std::string projectId, std::string snapshotId, SyncMode mode, sync::ProgressCallback callback) | 
| Open the project from the cloud. This operation is asynchronous.  More... | |
| SyncFuture | SyncProject (AudacityProject &project, const std::string &path, bool forceSync, sync::ProgressCallback callback) | 
| GetHeadSnapshotIDFuture | GetHeadSnapshotID (std::string_view projectId) | 
| Static Public Member Functions | |
| static CloudSyncService & | Get () | 
| static bool | IsCloudProject (const std::string &path) | 
| static ProjectState | GetProjectState (const std::string &projectId) | 
| Private Member Functions | |
| CloudSyncService ()=default | |
| ~CloudSyncService ()=default | |
| CloudSyncService (const CloudSyncService &)=delete | |
| CloudSyncService (CloudSyncService &&)=delete | |
| CloudSyncService & | operator= (const CloudSyncService &)=delete | 
| CloudSyncService & | operator= (CloudSyncService &&)=delete | 
| void | FailSync (ResponseResult responseResult) | 
| void | CompleteSync (std::string path) | 
| void | CompleteSync (sync::ProjectSyncResult result) | 
| void | SyncCloudSnapshot (const sync::ProjectInfo &projectInfo, const sync::SnapshotInfo &snapshotInfo, SyncMode mode) | 
| void | UpdateDowloadProgress (double downloadProgress) | 
| void | ReportUploadStats (std::string_view projectId, const TransferStats &stats) | 
| Private Attributes | |
| std::vector< std::shared_ptr< sync::LocalProjectSnapshot > > | mLocalSnapshots | 
| std::shared_ptr< sync::RemoteProjectSnapshot > | mRemoteSnapshot | 
| SyncPromise | mSyncPromise | 
| sync::ProgressCallback | mProgressCallback | 
| std::atomic< double > | mDownloadProgress { 0.0 } | 
| std::atomic< bool > | mProgressUpdateQueued { false } | 
| std::atomic< bool > | mSyncInProcess { false } | 
CloudSyncService is responsible for saving and loading projects from the cloud
Definition at line 63 of file CloudSyncService.h.
| using audacity::cloud::audiocom::CloudSyncService::GetHeadSnapshotIDFuture = std::future<sync::GetHeadSnapshotIDResult> | 
Definition at line 83 of file CloudSyncService.h.
| using audacity::cloud::audiocom::CloudSyncService::GetHeadSnapshotIDPromise = std::promise<sync::GetHeadSnapshotIDResult> | 
Definition at line 82 of file CloudSyncService.h.
| using audacity::cloud::audiocom::CloudSyncService::GetProjectsFuture = std::future<sync::GetProjectsResult> | 
Definition at line 80 of file CloudSyncService.h.
| using audacity::cloud::audiocom::CloudSyncService::GetProjectsPromise = std::promise<sync::GetProjectsResult> | 
Definition at line 79 of file CloudSyncService.h.
| using audacity::cloud::audiocom::CloudSyncService::SyncFuture = std::future<sync::ProjectSyncResult> | 
Definition at line 77 of file CloudSyncService.h.
| using audacity::cloud::audiocom::CloudSyncService::SyncPromise = std::promise<sync::ProjectSyncResult> | 
Definition at line 76 of file CloudSyncService.h.
| 
 | strong | 
| Enumerator | |
|---|---|
| NotAvaliable | |
| PendingSync | |
| FullySynced | |
Definition at line 108 of file CloudSyncService.h.
| 
 | strong | 
| Enumerator | |
|---|---|
| Normal | |
| ForceOverwrite | |
| ForceNew | |
Definition at line 85 of file CloudSyncService.h.
| 
 | privatedefault | 
| 
 | privatedefault | 
| 
 | privatedelete | 
| 
 | privatedelete | 
| 
 | private | 
Definition at line 507 of file CloudSyncService.cpp.
| 
 | private | 
Definition at line 513 of file CloudSyncService.cpp.
References audacity::cloud::audiocom::sync::ProjectSyncResult::Stats.
| 
 | private | 
Definition at line 499 of file CloudSyncService.cpp.
| 
 | static | 
Definition at line 280 of file CloudSyncService.cpp.
Referenced by audacity::cloud::audiocom::sync::OpenProjectFromCloud(), audacity::cloud::audiocom::sync::ProjectsListDialog::ProjectsTableData::Refresh(), and audacity::cloud::audiocom::sync::SyncCloudProject().
| CloudSyncService::GetHeadSnapshotIDFuture audacity::cloud::audiocom::CloudSyncService::GetHeadSnapshotID | ( | std::string_view | projectId | ) | 
Definition at line 477 of file CloudSyncService.cpp.
References ASSERT_MAIN_THREAD, audacity::cloud::audiocom::ResponseResult::Code, audacity::cloud::audiocom::GetOAuthService(), audacity::cloud::audiocom::anonymous_namespace{CloudSyncService.cpp}::GetProjectInfo(), audacity::cloud::audiocom::GetServiceConfig(), audacity::cloud::audiocom::sync::ProjectInfo::HeadSnapshot, and audacity::cloud::audiocom::sync::SnapshotInfo::Id.
Referenced by audacity::cloud::audiocom::sync::OpenProjectFromCloud().
| CloudSyncService::GetProjectsFuture audacity::cloud::audiocom::CloudSyncService::GetProjects | ( | concurrency::CancellationContextPtr | context, | 
| int | page, | ||
| int | pageSize, | ||
| std::string_view | searchString | ||
| ) | 
Retrieve the list of projects from the cloud.
Definition at line 286 of file CloudSyncService.cpp.
References audacity::network_manager::common_headers::Accept, audacity::network_manager::common_content_types::ApplicationJson, audacity::network_manager::common_headers::ContentType, audacity::cloud::audiocom::sync::DeserializePaginatedProjectsResponse(), anonymous_namespace{FrameStatistics.cpp}::GetInstance(), audacity::cloud::audiocom::GetOAuthService(), audacity::cloud::audiocom::GetResponseResult(), audacity::cloud::audiocom::GetServiceConfig(), and audacity::cloud::audiocom::SetCommonHeaders().
Referenced by audacity::cloud::audiocom::sync::ProjectsListDialog::ProjectsTableData::Refresh().
| 
 | static | 
Definition at line 458 of file CloudSyncService.cpp.
References BasicUI::Get(), and audacity::ToWXString().
Referenced by audacity::cloud::audiocom::sync::ProjectsListDialog::OnOpen().
| 
 | static | 
Definition at line 449 of file CloudSyncService.cpp.
References BasicUI::Get().
| CloudSyncService::SyncFuture audacity::cloud::audiocom::CloudSyncService::OpenFromCloud | ( | std::string | projectId, | 
| std::string | snapshotId, | ||
| SyncMode | mode, | ||
| sync::ProgressCallback | callback | ||
| ) | 
Open the project from the cloud. This operation is asynchronous.
Definition at line 339 of file CloudSyncService.cpp.
References ASSERT_MAIN_THREAD, audacity::cloud::audiocom::ResponseResult::Code, audacity::cloud::audiocom::GetOAuthService(), audacity::cloud::audiocom::GetServiceConfig(), and audacity::cloud::audiocom::anonymous_namespace{CloudSyncService.cpp}::GetSnapshotInfo().
Referenced by audacity::cloud::audiocom::sync::OpenProjectFromCloud().
| 
 | privatedelete | 
| 
 | privatedelete | 
| 
 | private | 
Definition at line 650 of file CloudSyncService.cpp.
References audacity::network_manager::common_content_types::ApplicationJson, audacity::cloud::audiocom::sync::NetworkStats::Blocks, audacity::cloud::audiocom::TransferStats::BlocksTransferred, audacity::cloud::audiocom::sync::NetworkStats::Bytes, audacity::cloud::audiocom::TransferStats::BytesTransferred, audacity::network_manager::common_headers::ContentType, audacity::cloud::audiocom::sync::NetworkStats::Files, anonymous_namespace{FrameStatistics.cpp}::GetInstance(), audacity::cloud::audiocom::GetServiceConfig(), audacity::cloud::audiocom::sync::NetworkStats::IsDownload, audacity::cloud::audiocom::sync::NetworkStats::Mixes, audacity::cloud::audiocom::TransferStats::ProjectFilesTransferred, audacity::cloud::audiocom::sync::Serialize(), and audacity::cloud::audiocom::SetCommonHeaders().
| 
 | private | 
Definition at line 526 of file CloudSyncService.cpp.
References audacity::cloud::audiocom::CloudProjectsSavePath, audacity::network_manager::HttpCode::Conflict, audacity::cloud::audiocom::anonymous_namespace{CloudSyncService.cpp}::DropAutosave(), BasicUI::Get(), ProjectFileIO::Get(), audacity::cloud::audiocom::anonymous_namespace{CloudSyncService.cpp}::HasAutosave(), audacity::cloud::audiocom::sync::SnapshotInfo::Id, audacity::cloud::audiocom::sync::ProjectInfo::Id, ProjectFileIO::LoadProject(), audacity::cloud::audiocom::sync::MakeSafeProjectPath(), FileNames::MkDir(), audacity::cloud::audiocom::sync::ProjectInfo::Name, project, Setting< T >::Read(), Journal::Sync(), audacity::ToUTF8(), and audacity::ToWXString().
| CloudSyncService::SyncFuture audacity::cloud::audiocom::CloudSyncService::SyncProject | ( | AudacityProject & | project, | 
| const std::string & | path, | ||
| bool | forceSync, | ||
| sync::ProgressCallback | callback | ||
| ) | 
Definition at line 380 of file CloudSyncService.cpp.
References ASSERT_MAIN_THREAD, BasicUI::Get(), audacity::cloud::audiocom::GetOAuthService(), audacity::cloud::audiocom::anonymous_namespace{CloudSyncService.cpp}::GetProjectInfo(), audacity::cloud::audiocom::GetServiceConfig(), audacity::cloud::audiocom::sync::ProjectInfo::HeadSnapshot, audacity::cloud::audiocom::sync::SnapshotInfo::Id, and project.
Referenced by audacity::cloud::audiocom::sync::SyncCloudProject().
| 
 | private | 
Definition at line 631 of file CloudSyncService.cpp.
References BasicUI::CallAfter().
| 
 | private | 
Definition at line 140 of file CloudSyncService.h.
| 
 | private | 
Definition at line 134 of file CloudSyncService.h.
| 
 | private | 
Definition at line 138 of file CloudSyncService.h.
| 
 | private | 
Definition at line 141 of file CloudSyncService.h.
| 
 | private | 
Definition at line 135 of file CloudSyncService.h.
| 
 | private | 
Definition at line 143 of file CloudSyncService.h.
| 
 | private | 
Definition at line 137 of file CloudSyncService.h.