Audacity 3.2.0
|
#include <CloudProjectsDatabase.h>
Public Member Functions | |
sqlite::SafeConnection::Lock | GetConnection () |
const sqlite::SafeConnection::Lock | GetConnection () const |
std::optional< DBProjectData > | GetProjectData (std::string_view projectId) const |
std::optional< DBProjectData > | GetProjectDataForPath (const std::string &projectPath) const |
std::vector< DBProjectData > | GetCloudProjects () const |
void | DeleteProject (std::string_view projectId) |
bool | MarkProjectAsSynced (std::string_view projectId, std::string_view snapshotId) |
void | UpdateProjectBlockList (std::string_view projectId, const SampleBlockIDSet &blockSet) |
std::optional< std::string > | GetBlockHash (std::string_view projectId, int64_t blockId) const |
void | UpdateBlockHashes (std::string_view projectId, const std::vector< std::pair< int64_t, std::string > > &hashes) |
bool | UpdateProjectData (const DBProjectData &projectData) |
bool | IsFirstSyncDialogShown (std::string_view projectId) const |
void | SetFirstSyncDialogShown (std::string_view projectId, bool shown=true) |
std::string | GetProjectUserSlug (std::string_view projectId) |
void | SetProjectUserSlug (std::string_view projectId, std::string_view slug) |
bool | IsProjectBlockLocked (std::string_view projectId, int64_t blockId) const |
void | AddPendingSnapshot (const PendingSnapshotData &snapshotData) |
void | RemovePendingSnapshot (std::string_view projectId, std::string_view snapshotId) |
std::vector< PendingSnapshotData > | GetPendingSnapshots (std::string_view projectId) const |
void | AddPendingProjectBlob (const PendingProjectBlobData &blobData) |
void | RemovePendingProjectBlob (std::string_view projectId, std::string_view snapshotId) |
std::optional< PendingProjectBlobData > | GetPendingProjectBlob (std::string_view projectId, std::string_view snapshotId) const |
void | AddPendingProjectBlocks (const std::vector< PendingProjectBlockData > &blockData) |
void | RemovePendingProjectBlock (std::string_view projectId, int64_t blockId) |
void | RemovePendingProjectBlocks (std::string_view projectId, std::string_view snapshotId) |
std::vector< PendingProjectBlockData > | GetPendingProjectBlocks (std::string_view projectId, std::string_view snapshotId) |
Static Public Member Functions | |
static CloudProjectsDatabase & | Get () |
Private Member Functions | |
CloudProjectsDatabase ()=default | |
~CloudProjectsDatabase ()=default | |
std::optional< DBProjectData > | DoGetProjectData (const sqlite::Row &result) const |
std::optional< DBProjectData > | DoGetProjectData (sqlite::RunResult result) const |
bool | OpenConnection () |
bool | RunMigrations () |
bool | DeleteProject (sqlite::SafeConnection::Lock &connection, std::string_view projectId) |
Private Attributes | |
std::mutex | mConnectionMutex |
std::shared_ptr< sqlite::SafeConnection > | mConnection |
Definition at line 78 of file CloudProjectsDatabase.h.
|
privatedefault |
|
privatedefault |
void audacity::cloud::audiocom::sync::CloudProjectsDatabase::AddPendingProjectBlob | ( | const PendingProjectBlobData & | blobData | ) |
Definition at line 561 of file CloudProjectsDatabase.cpp.
References audacity::cloud::audiocom::sync::PendingProjectBlobData::BlobData, audacity::cloud::audiocom::sync::PendingProjectBlobData::ConfirmUrl, audacity::cloud::audiocom::sync::PendingProjectBlobData::FailUrl, GetConnection(), audacity::cloud::audiocom::sync::PendingProjectBlobData::ProjectId, audacity::cloud::audiocom::sync::PendingProjectBlobData::SnapshotId, and audacity::cloud::audiocom::sync::PendingProjectBlobData::UploadUrl.
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::StorePendingSnapshot().
void audacity::cloud::audiocom::sync::CloudProjectsDatabase::AddPendingProjectBlocks | ( | const std::vector< PendingProjectBlockData > & | blockData | ) |
Definition at line 650 of file CloudProjectsDatabase.cpp.
References GetConnection().
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::StorePendingSnapshot().
void audacity::cloud::audiocom::sync::CloudProjectsDatabase::AddPendingSnapshot | ( | const PendingSnapshotData & | snapshotData | ) |
Definition at line 473 of file CloudProjectsDatabase.cpp.
References audacity::cloud::audiocom::sync::PendingSnapshotData::ConfirmUrl, GetConnection(), audacity::cloud::audiocom::sync::PendingSnapshotData::ProjectId, and audacity::cloud::audiocom::sync::PendingSnapshotData::SnapshotId.
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::StorePendingSnapshot().
|
private |
Definition at line 896 of file CloudProjectsDatabase.cpp.
References audacity::sqlite::Connection::CreateStatement().
void audacity::cloud::audiocom::sync::CloudProjectsDatabase::DeleteProject | ( | std::string_view | projectId | ) |
Definition at line 195 of file CloudProjectsDatabase.cpp.
Referenced by UpdateProjectData().
|
private |
Definition at line 769 of file CloudProjectsDatabase.cpp.
References audacity::cloud::audiocom::sync::DBProjectData::FirstSyncDialogShown, audacity::sqlite::Row::Get(), audacity::cloud::audiocom::sync::DBProjectData::LastAudioPreview, audacity::cloud::audiocom::sync::DBProjectData::LastModified, audacity::cloud::audiocom::sync::DBProjectData::LastRead, audacity::cloud::audiocom::sync::DBProjectData::LocalPath, audacity::cloud::audiocom::sync::DBProjectData::ProjectId, audacity::cloud::audiocom::sync::DBProjectData::SavesCount, audacity::cloud::audiocom::sync::DBProjectData::SnapshotId, and audacity::cloud::audiocom::sync::DBProjectData::SyncStatus.
Referenced by GetProjectData(), and GetProjectDataForPath().
|
private |
Definition at line 807 of file CloudProjectsDatabase.cpp.
|
static |
Definition at line 110 of file CloudProjectsDatabase.cpp.
Referenced by audacity::cloud::audiocom::sync::RemoteProjectSnapshot::AttachOriginalDB(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::CalculateKnownBlocks(), audacity::cloud::audiocom::sync::LocalProjectSnapshot::DeleteSnapshot(), audacity::cloud::audiocom::sync::LocalProjectSnapshot::ProjectBlocksLock::GetHash(), audacity::cloud::audiocom::sync::anonymous_namespace{RemoteProjectSnapshot.cpp}::ListAttachedDatabases(), audacity::cloud::audiocom::sync::LocalProjectSnapshot::MarkSnapshotSynced(), audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::MarkSnapshotSynced(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncHousekeeper.cpp}::Housekeeper::OnAppClosing(), audacity::cloud::audiocom::sync::LocalProjectSnapshot::OnSnapshotCreated(), audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::Perform(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncHousekeeper.cpp}::Housekeeper::PerformHousekeeping(), audacity::cloud::audiocom::sync::LocalProjectSnapshot::ProjectBlocksLock::ProjectBlocksLock(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::RemoteProjectSnapshot(), audacity::cloud::audiocom::sync::ResumeProjectUpload(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::SetupBlocksCopy(), audacity::cloud::audiocom::sync::LocalProjectSnapshot::StorePendingSnapshot(), audacity::cloud::audiocom::sync::LocalProjectSnapshot::ProjectBlocksLock::UpdateProjectHashesInCache(), audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::UpdateUrls(), audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::UploadBlocks(), audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::UploadSnapshot(), and audacity::cloud::audiocom::sync::RemoteProjectSnapshot::~RemoteProjectSnapshot().
std::optional< std::string > audacity::cloud::audiocom::sync::CloudProjectsDatabase::GetBlockHash | ( | std::string_view | projectId, |
int64_t | blockId | ||
) | const |
Definition at line 257 of file CloudProjectsDatabase.cpp.
References GetConnection().
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::ProjectBlocksLock::GetHash().
std::vector< DBProjectData > audacity::cloud::audiocom::sync::CloudProjectsDatabase::GetCloudProjects | ( | ) | const |
Definition at line 167 of file CloudProjectsDatabase.cpp.
sqlite::SafeConnection::Lock audacity::cloud::audiocom::sync::CloudProjectsDatabase::GetConnection | ( | ) |
Definition at line 116 of file CloudProjectsDatabase.cpp.
References mConnection, mConnectionMutex, and OpenConnection().
Referenced by AddPendingProjectBlob(), AddPendingProjectBlocks(), AddPendingSnapshot(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::AttachOriginalDB(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::CalculateKnownBlocks(), GetBlockHash(), GetConnection(), GetPendingProjectBlob(), GetPendingProjectBlocks(), GetPendingSnapshots(), GetProjectData(), GetProjectDataForPath(), GetProjectUserSlug(), IsProjectBlockLocked(), audacity::cloud::audiocom::sync::anonymous_namespace{RemoteProjectSnapshot.cpp}::ListAttachedDatabases(), MarkProjectAsSynced(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::RemoteProjectSnapshot(), RemovePendingProjectBlob(), RemovePendingProjectBlock(), RemovePendingProjectBlocks(), RemovePendingSnapshot(), SetProjectUserSlug(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::SetupBlocksCopy(), UpdateBlockHashes(), UpdateProjectBlockList(), UpdateProjectData(), and audacity::cloud::audiocom::sync::RemoteProjectSnapshot::~RemoteProjectSnapshot().
const sqlite::SafeConnection::Lock audacity::cloud::audiocom::sync::CloudProjectsDatabase::GetConnection | ( | ) | const |
Definition at line 127 of file CloudProjectsDatabase.cpp.
References GetConnection().
std::optional< PendingProjectBlobData > audacity::cloud::audiocom::sync::CloudProjectsDatabase::GetPendingProjectBlob | ( | std::string_view | projectId, |
std::string_view | snapshotId | ||
) | const |
Definition at line 603 of file CloudProjectsDatabase.cpp.
References audacity::cloud::audiocom::sync::PendingProjectBlobData::BlobData, audacity::cloud::audiocom::sync::PendingProjectBlobData::ConfirmUrl, audacity::cloud::audiocom::sync::PendingProjectBlobData::FailUrl, GetConnection(), audacity::cloud::audiocom::sync::PendingProjectBlobData::ProjectId, size, audacity::cloud::audiocom::sync::PendingProjectBlobData::SnapshotId, and audacity::cloud::audiocom::sync::PendingProjectBlobData::UploadUrl.
std::vector< PendingProjectBlockData > audacity::cloud::audiocom::sync::CloudProjectsDatabase::GetPendingProjectBlocks | ( | std::string_view | projectId, |
std::string_view | snapshotId | ||
) |
Definition at line 716 of file CloudProjectsDatabase.cpp.
References audacity::cloud::audiocom::sync::PendingProjectBlockData::BlockHash, audacity::cloud::audiocom::sync::PendingProjectBlockData::BlockId, audacity::cloud::audiocom::sync::PendingProjectBlockData::BlockSampleFormat, audacity::cloud::audiocom::sync::PendingProjectBlockData::ConfirmUrl, audacity::cloud::audiocom::sync::PendingProjectBlockData::FailUrl, GetConnection(), audacity::cloud::audiocom::sync::PendingProjectBlockData::ProjectId, audacity::cloud::audiocom::sync::PendingProjectBlockData::SnapshotId, and audacity::cloud::audiocom::sync::PendingProjectBlockData::UploadUrl.
std::vector< PendingSnapshotData > audacity::cloud::audiocom::sync::CloudProjectsDatabase::GetPendingSnapshots | ( | std::string_view | projectId | ) | const |
Definition at line 525 of file CloudProjectsDatabase.cpp.
References audacity::cloud::audiocom::sync::PendingSnapshotData::ConfirmUrl, GetConnection(), audacity::cloud::audiocom::sync::PendingSnapshotData::ProjectId, and audacity::cloud::audiocom::sync::PendingSnapshotData::SnapshotId.
std::optional< DBProjectData > audacity::cloud::audiocom::sync::CloudProjectsDatabase::GetProjectData | ( | std::string_view | projectId | ) | const |
Definition at line 133 of file CloudProjectsDatabase.cpp.
References DoGetProjectData(), and GetConnection().
Referenced by audacity::cloud::audiocom::sync::RemoteProjectSnapshot::AttachOriginalDB(), and audacity::cloud::audiocom::sync::RemoteProjectSnapshot::RemoteProjectSnapshot().
std::optional< DBProjectData > audacity::cloud::audiocom::sync::CloudProjectsDatabase::GetProjectDataForPath | ( | const std::string & | projectPath | ) | const |
Definition at line 149 of file CloudProjectsDatabase.cpp.
References DoGetProjectData(), and GetConnection().
std::string audacity::cloud::audiocom::sync::CloudProjectsDatabase::GetProjectUserSlug | ( | std::string_view | projectId | ) |
Definition at line 406 of file CloudProjectsDatabase.cpp.
References GetConnection().
bool audacity::cloud::audiocom::sync::CloudProjectsDatabase::IsFirstSyncDialogShown | ( | std::string_view | projectId | ) | const |
Definition at line 359 of file CloudProjectsDatabase.cpp.
bool audacity::cloud::audiocom::sync::CloudProjectsDatabase::IsProjectBlockLocked | ( | std::string_view | projectId, |
int64_t | blockId | ||
) | const |
Definition at line 451 of file CloudProjectsDatabase.cpp.
References GetConnection().
bool audacity::cloud::audiocom::sync::CloudProjectsDatabase::MarkProjectAsSynced | ( | std::string_view | projectId, |
std::string_view | snapshotId | ||
) |
Definition at line 208 of file CloudProjectsDatabase.cpp.
References GetConnection(), and audacity::cloud::audiocom::sync::DBProjectData::SyncStatusSynced.
|
private |
Definition at line 819 of file CloudProjectsDatabase.cpp.
References FileNames::ConfigDir(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectsDatabase.cpp}::createTableQuery, mConnection, audacity::sqlite::SafeConnection::Open(), RunMigrations(), and audacity::ToUTF8().
Referenced by GetConnection().
void audacity::cloud::audiocom::sync::CloudProjectsDatabase::RemovePendingProjectBlob | ( | std::string_view | projectId, |
std::string_view | snapshotId | ||
) |
Definition at line 585 of file CloudProjectsDatabase.cpp.
References GetConnection().
Referenced by audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::UpdateUrls(), and audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::UploadSnapshot().
void audacity::cloud::audiocom::sync::CloudProjectsDatabase::RemovePendingProjectBlock | ( | std::string_view | projectId, |
int64_t | blockId | ||
) |
Definition at line 681 of file CloudProjectsDatabase.cpp.
References GetConnection().
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::OnSnapshotCreated(), audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::UpdateUrls(), and audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::UploadBlocks().
void audacity::cloud::audiocom::sync::CloudProjectsDatabase::RemovePendingProjectBlocks | ( | std::string_view | projectId, |
std::string_view | snapshotId | ||
) |
Definition at line 698 of file CloudProjectsDatabase.cpp.
References GetConnection().
void audacity::cloud::audiocom::sync::CloudProjectsDatabase::RemovePendingSnapshot | ( | std::string_view | projectId, |
std::string_view | snapshotId | ||
) |
Definition at line 494 of file CloudProjectsDatabase.cpp.
References GetConnection().
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::DeleteSnapshot(), audacity::cloud::audiocom::sync::LocalProjectSnapshot::MarkSnapshotSynced(), audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::MarkSnapshotSynced(), and audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::UploadBlocks().
|
private |
Definition at line 845 of file CloudProjectsDatabase.cpp.
References mConnection, audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectsDatabase.cpp}::migrations, and size.
Referenced by OpenConnection().
void audacity::cloud::audiocom::sync::CloudProjectsDatabase::SetFirstSyncDialogShown | ( | std::string_view | projectId, |
bool | shown = true |
||
) |
Definition at line 388 of file CloudProjectsDatabase.cpp.
void audacity::cloud::audiocom::sync::CloudProjectsDatabase::SetProjectUserSlug | ( | std::string_view | projectId, |
std::string_view | slug | ||
) |
Definition at line 434 of file CloudProjectsDatabase.cpp.
References GetConnection().
void audacity::cloud::audiocom::sync::CloudProjectsDatabase::UpdateBlockHashes | ( | std::string_view | projectId, |
const std::vector< std::pair< int64_t, std::string > > & | hashes | ||
) |
Definition at line 286 of file CloudProjectsDatabase.cpp.
References GetConnection().
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::ProjectBlocksLock::UpdateProjectHashesInCache().
void audacity::cloud::audiocom::sync::CloudProjectsDatabase::UpdateProjectBlockList | ( | std::string_view | projectId, |
const SampleBlockIDSet & | blockSet | ||
) |
Definition at line 234 of file CloudProjectsDatabase.cpp.
References GetConnection().
Referenced by audacity::cloud::audiocom::sync::LocalProjectSnapshot::ProjectBlocksLock::ProjectBlocksLock().
bool audacity::cloud::audiocom::sync::CloudProjectsDatabase::UpdateProjectData | ( | const DBProjectData & | projectData | ) |
Definition at line 309 of file CloudProjectsDatabase.cpp.
References DeleteProject(), audacity::cloud::audiocom::sync::DBProjectData::FirstSyncDialogShown, GetConnection(), audacity::cloud::audiocom::sync::DBProjectData::LastAudioPreview, audacity::cloud::audiocom::sync::DBProjectData::LastModified, audacity::cloud::audiocom::sync::DBProjectData::LastRead, audacity::cloud::audiocom::sync::DBProjectData::LocalPath, audacity::cloud::audiocom::sync::DBProjectData::ProjectId, audacity::cloud::audiocom::sync::DBProjectData::SavesCount, audacity::cloud::audiocom::sync::DBProjectData::SnapshotId, and audacity::cloud::audiocom::sync::DBProjectData::SyncStatus.
|
private |
Definition at line 155 of file CloudProjectsDatabase.h.
Referenced by GetConnection(), OpenConnection(), and RunMigrations().
|
private |
Definition at line 154 of file CloudProjectsDatabase.h.
Referenced by GetConnection().