Audacity 3.2.0
CloudSyncDTO.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 CloudSyncDTO.h
7
8 Dmitry Vedenko
9
10**********************************************************************/
11#pragma once
12
13#include <cstdint>
14#include <string>
15#include <string_view>
16#include <optional>
17#include <unordered_set>
18#include <vector>
19#include <memory>
20
21#include <wx/string.h>
22
23enum class sampleFormat : unsigned;
24class SampleBlock;
25using SampleBlockPtr = std::shared_ptr<SampleBlock>;
26using SampleBlockID = long long;
27using SampleBlockIDSet = std::unordered_set<SampleBlockID>;
28
30{
31
32using BlockID = int64_t;
33using BlockHash = std::string;
34using SampleBlockHashes = std::vector<BlockHash>;
35
36struct LockedBlock final
37{
42}; // struct LockedBlock
43
44struct ProjectForm final
45{
46 std::string Name;
47 std::string HeadSnapshotId;
49 bool Force {};
50}; // struct ProjectForm
51
52struct UploadUrls final
53{
54 std::string Id;
55 std::string UploadUrl;
56 std::string SuccessUrl;
57 std::string FailUrl;
58}; // struct UploadUrls
59
60struct VersionInfo final
61{
62 std::string Id;
63 std::string Name;
64 std::string SnapshotId;
65 int64_t Created {};
66 int64_t Updated {};
67}; // struct VersionInfo
68
70{
72 std::string Url;
73}; // struct SnapshotBlockInfo
74
75struct SnapshotInfo final
76{
77 std::string Id;
78 std::string ParentId;
79
80 int64_t Created {};
81 int64_t Updated {};
82 int64_t Synced {};
83
84 int64_t FileSize;
85 int64_t BlocksSize;
86
87 std::string FileUrl;
88
89 std::vector<SnapshotBlockInfo> Blocks;
90}; // struct SnapshotInfo
91
92struct ProjectInfo final
93{
94 std::string Id;
95
96 std::string Username;
97 std::string AuthorName;
98 std::string Slug;
99 std::string Name;
100 std::string Details;
101
104
105 int64_t Created {};
106 int64_t Updated {};
107}; // struct ProjectInfo
108
110{
113 std::vector<UploadUrls> MissingBlocks;
114}; // struct ProjectSyncState
115
117{
120
122}; // struct CreateSnapshotResponse
123
124struct PaginationInfo final
125{
129 int PageSize {};
130}; // struct PaginationInfo
131
133{
134 std::vector<ProjectInfo> Items;
136}; // struct PaginatedProjectsResponse
137
138struct NetworkStats final
139{
140 int64_t Files {};
141 int64_t Blocks {};
142 int64_t Bytes {};
143 int64_t Mixes {};
144 bool IsDownload {};
145}; // struct NetworkStats
146
147std::string Serialize(const ProjectForm& form);
148
149std::optional<ProjectSyncState>
150DeserializeProjectSyncState(const std::string& data);
151
152std::optional<CreateSnapshotResponse>
153DeserializeCreateSnapshotResponse(const std::string& data);
154std::optional<PaginatedProjectsResponse>
155DeserializePaginatedProjectsResponse(const std::string& data);
156
157std::optional<ProjectInfo> DeserializeProjectInfo(const std::string& data);
158std::optional<SnapshotInfo> DeserializeSnapshotInfo(const std::string& data);
159
160std::string Serialize(NetworkStats stats);
161
162CLOUD_AUDIOCOM_API wxString
163MakeSafeProjectPath(const wxString& rootDir, const wxString& projectName);
164
165} // namespace audacity::cloud::audiocom::sync
std::shared_ptr< SampleBlock > SampleBlockPtr
Definition: CloudSyncDTO.h:25
long long SampleBlockID
Definition: CloudSyncDTO.h:26
std::unordered_set< SampleBlockID > SampleBlockIDSet
Definition: CloudSyncDTO.h:27
sampleFormat
The ordering of these values with operator < agrees with the order of increasing bit width.
Definition: SampleFormat.h:30
Abstract class allows access to contents of a block of sound samples, serialization as XML,...
Definition: SampleBlock.h:47
std::optional< ProjectSyncState > DeserializeProjectSyncState(const std::string &data)
std::optional< ProjectInfo > DeserializeProjectInfo(const std::string &data)
std::vector< BlockHash > SampleBlockHashes
Definition: CloudSyncDTO.h:34
wxString MakeSafeProjectPath(const wxString &rootDir, const wxString &projectName)
std::string Serialize(const ProjectForm &form)
std::optional< PaginatedProjectsResponse > DeserializePaginatedProjectsResponse(const std::string &data)
std::optional< SnapshotInfo > DeserializeSnapshotInfo(const std::string &data)
std::optional< CreateSnapshotResponse > DeserializeCreateSnapshotResponse(const std::string &data)
std::vector< SnapshotBlockInfo > Blocks
Definition: CloudSyncDTO.h:89