mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 20:48:43 +00:00
Update backup locator proto.
This commit is contained in:
@@ -25,8 +25,10 @@ class ArchivedAttachment : Attachment {
|
|||||||
constructor(
|
constructor(
|
||||||
contentType: String?,
|
contentType: String?,
|
||||||
size: Long,
|
size: Long,
|
||||||
cdn: Cdn,
|
cdn: Int,
|
||||||
cdnKey: ByteArray,
|
key: ByteArray,
|
||||||
|
cdnKey: String?,
|
||||||
|
archiveCdn: Int?,
|
||||||
archiveMediaName: String,
|
archiveMediaName: String,
|
||||||
archiveMediaId: String,
|
archiveMediaId: String,
|
||||||
digest: ByteArray,
|
digest: ByteArray,
|
||||||
@@ -46,9 +48,9 @@ class ArchivedAttachment : Attachment {
|
|||||||
transferState = AttachmentTable.TRANSFER_NEEDS_RESTORE,
|
transferState = AttachmentTable.TRANSFER_NEEDS_RESTORE,
|
||||||
size = size,
|
size = size,
|
||||||
fileName = null,
|
fileName = null,
|
||||||
cdn = cdn,
|
cdn = Cdn.fromCdnNumber(cdn),
|
||||||
remoteLocation = null,
|
remoteLocation = cdnKey,
|
||||||
remoteKey = Base64.encodeWithoutPadding(cdnKey),
|
remoteKey = Base64.encodeWithoutPadding(key),
|
||||||
remoteDigest = digest,
|
remoteDigest = digest,
|
||||||
incrementalDigest = incrementalMac,
|
incrementalDigest = incrementalMac,
|
||||||
fastPreflightId = null,
|
fastPreflightId = null,
|
||||||
@@ -65,7 +67,7 @@ class ArchivedAttachment : Attachment {
|
|||||||
audioHash = null,
|
audioHash = null,
|
||||||
transformProperties = null
|
transformProperties = null
|
||||||
) {
|
) {
|
||||||
this.archiveCdn = cdn.cdnNumber
|
this.archiveCdn = archiveCdn ?: Cdn.CDN_3.cdnNumber
|
||||||
this.archiveMediaName = archiveMediaName
|
this.archiveMediaName = archiveMediaName
|
||||||
this.archiveMediaId = archiveMediaId
|
this.archiveMediaId = archiveMediaId
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -618,8 +618,10 @@ class ChatItemImportInserter(
|
|||||||
return ArchivedAttachment(
|
return ArchivedAttachment(
|
||||||
contentType = contentType,
|
contentType = contentType,
|
||||||
size = pointer.backupLocator.size.toLong(),
|
size = pointer.backupLocator.size.toLong(),
|
||||||
cdn = Cdn.fromCdnNumber(pointer.backupLocator.cdnNumber),
|
cdn = pointer.backupLocator.transitCdnNumber ?: Cdn.CDN_0.cdnNumber,
|
||||||
cdnKey = pointer.backupLocator.key.toByteArray(),
|
key = pointer.backupLocator.key.toByteArray(),
|
||||||
|
cdnKey = pointer.backupLocator.transitCdnKey,
|
||||||
|
archiveCdn = pointer.backupLocator.cdnNumber,
|
||||||
archiveMediaName = pointer.backupLocator.mediaName,
|
archiveMediaName = pointer.backupLocator.mediaName,
|
||||||
archiveMediaId = backupState.backupKey.deriveMediaId(MediaName(pointer.backupLocator.mediaName)).encode(),
|
archiveMediaId = backupState.backupKey.deriveMediaId(MediaName(pointer.backupLocator.mediaName)).encode(),
|
||||||
digest = pointer.backupLocator.digest.toByteArray(),
|
digest = pointer.backupLocator.digest.toByteArray(),
|
||||||
|
|||||||
@@ -388,10 +388,16 @@ message FilePointer {
|
|||||||
// References attachments in the backup (media) storage tier.
|
// References attachments in the backup (media) storage tier.
|
||||||
message BackupLocator {
|
message BackupLocator {
|
||||||
string mediaName = 1;
|
string mediaName = 1;
|
||||||
uint32 cdnNumber = 2;
|
// If present, the cdn number of the succesful upload.
|
||||||
|
// If empty/0, may still have been uploaded, and clients
|
||||||
|
// can discover the cdn number via the list endpoint.
|
||||||
|
optional uint32 cdnNumber = 2;
|
||||||
bytes key = 3;
|
bytes key = 3;
|
||||||
bytes digest = 4;
|
bytes digest = 4;
|
||||||
uint32 size = 5;
|
uint32 size = 5;
|
||||||
|
// Fallback in case backup tier upload failed.
|
||||||
|
optional string transitCdnKey = 6;
|
||||||
|
optional uint32 transitCdnNumber = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
// References attachments in the transit storage tier.
|
// References attachments in the transit storage tier.
|
||||||
|
|||||||
Reference in New Issue
Block a user