Skip to content

Commit

Permalink
Optimize blob downloading
Browse files Browse the repository at this point in the history
Use archive tokens when downloading blobs when possible

Try to split requests by archive

Closes #8069

Co-authored-by: ivk <ivk@tutao.de>
Co-authored-by: BijinDev <bir@tutao.de>
  • Loading branch information
3 people committed Dec 19, 2024
1 parent 41933f8 commit c9a2d5e
Show file tree
Hide file tree
Showing 16 changed files with 417 additions and 93 deletions.
13 changes: 12 additions & 1 deletion schemas/storage.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
{
"app": "storage",
"versions": []
"versions": [
{
"version": 10,
"changes": [
{
"name": "AddValue",
"sourceType": "BlobServerAccessInfo",
"info": "AddValue BlobServerAccessInfo/tokenKind/208."
}
]
}
]
}
5 changes: 5 additions & 0 deletions src/common/api/common/TutanotaConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,11 @@ export enum PublicKeyIdentifierType {
GROUP_ID = "1",
}

export enum BlobAccessTokenKind {
Archive = "0",
Instances = "1",
}

export function asPublicKeyIdentifier(maybe: NumberString): PublicKeyIdentifierType {
if (Object.values(PublicKeyIdentifierType).includes(maybe as PublicKeyIdentifierType)) {
return maybe as PublicKeyIdentifierType
Expand Down
4 changes: 2 additions & 2 deletions src/common/api/entities/storage/ModelInfo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const modelInfo = {
version: 9,
compatibleSince: 0,
version: 10,
compatibleSince: 10,
}

export default modelInfo
35 changes: 22 additions & 13 deletions src/common/api/entities/storage/TypeModels.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const typeModels = {
}
},
"app": "storage",
"version": "9"
"version": "10"
},
"BlobAccessTokenPostOut": {
"name": "BlobAccessTokenPostOut",
Expand Down Expand Up @@ -91,7 +91,7 @@ export const typeModels = {
}
},
"app": "storage",
"version": "9"
"version": "10"
},
"BlobArchiveRef": {
"name": "BlobArchiveRef",
Expand Down Expand Up @@ -152,7 +152,7 @@ export const typeModels = {
}
},
"app": "storage",
"version": "9"
"version": "10"
},
"BlobGetIn": {
"name": "BlobGetIn",
Expand Down Expand Up @@ -204,7 +204,7 @@ export const typeModels = {
}
},
"app": "storage",
"version": "9"
"version": "10"
},
"BlobId": {
"name": "BlobId",
Expand Down Expand Up @@ -236,7 +236,7 @@ export const typeModels = {
},
"associations": {},
"app": "storage",
"version": "9"
"version": "10"
},
"BlobPostOut": {
"name": "BlobPostOut",
Expand Down Expand Up @@ -268,7 +268,7 @@ export const typeModels = {
},
"associations": {},
"app": "storage",
"version": "9"
"version": "10"
},
"BlobReadData": {
"name": "BlobReadData",
Expand Down Expand Up @@ -320,7 +320,7 @@ export const typeModels = {
}
},
"app": "storage",
"version": "9"
"version": "10"
},
"BlobReferenceDeleteIn": {
"name": "BlobReferenceDeleteIn",
Expand Down Expand Up @@ -381,7 +381,7 @@ export const typeModels = {
}
},
"app": "storage",
"version": "9"
"version": "10"
},
"BlobReferencePutIn": {
"name": "BlobReferencePutIn",
Expand Down Expand Up @@ -442,7 +442,7 @@ export const typeModels = {
}
},
"app": "storage",
"version": "9"
"version": "10"
},
"BlobServerAccessInfo": {
"name": "BlobServerAccessInfo",
Expand Down Expand Up @@ -479,6 +479,15 @@ export const typeModels = {
"type": "Date",
"cardinality": "One",
"encrypted": false
},
"tokenKind": {
"final": false,
"name": "tokenKind",
"id": 208,
"since": 10,
"type": "Number",
"cardinality": "One",
"encrypted": false
}
},
"associations": {
Expand All @@ -494,7 +503,7 @@ export const typeModels = {
}
},
"app": "storage",
"version": "9"
"version": "10"
},
"BlobServerUrl": {
"name": "BlobServerUrl",
Expand Down Expand Up @@ -526,7 +535,7 @@ export const typeModels = {
},
"associations": {},
"app": "storage",
"version": "9"
"version": "10"
},
"BlobWriteData": {
"name": "BlobWriteData",
Expand Down Expand Up @@ -558,7 +567,7 @@ export const typeModels = {
},
"associations": {},
"app": "storage",
"version": "9"
"version": "10"
},
"InstanceId": {
"name": "InstanceId",
Expand Down Expand Up @@ -590,6 +599,6 @@ export const typeModels = {
},
"associations": {},
"app": "storage",
"version": "9"
"version": "10"
}
}
1 change: 1 addition & 0 deletions src/common/api/entities/storage/TypeRefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export type BlobServerAccessInfo = {
_id: Id;
blobAccessToken: string;
expires: Date;
tokenKind: NumberString;

servers: BlobServerUrl[];
}
Expand Down
Loading

0 comments on commit c9a2d5e

Please sign in to comment.