Lazy restore attachments.

pull/1/head
Matthew Chen 7 years ago
parent cb8ee3536a
commit 8254052bb2

@ -12,9 +12,6 @@ import CloudKit
// Note that all of our CloudKit records are immutable. // Note that all of our CloudKit records are immutable.
// "Persistent" records are only uploaded once. // "Persistent" records are only uploaded once.
// "Ephemeral" records are always uploaded to a new record name. // "Ephemeral" records are always uploaded to a new record name.
//
// TODO: We could store known encryption ids locally to
// facilitate "resume" of failed backup exports.
@objc public class OWSBackupAPI: NSObject { @objc public class OWSBackupAPI: NSObject {
// If we change the record types, we need to ensure indices // If we change the record types, we need to ensure indices

@ -219,7 +219,7 @@ NSString *const kOWSBackup_ImportDatabaseKeySpec = @"kOWSBackup_ImportDatabaseKe
@"Indicates that the backup import data is being downloaded.") @"Indicates that the backup import data is being downloaded.")
progress:@(progress)]; progress:@(progress)];
// Use a predictable file path so that multiple "import backup" attempts // TODO: Use a predictable file path so that multiple "import backup" attempts
// will leverage successful file downloads from previous attempts. // will leverage successful file downloads from previous attempts.
// //
// TODO: This will also require imports using a predictable jobTempDirPath. // TODO: This will also require imports using a predictable jobTempDirPath.
@ -287,7 +287,7 @@ NSString *const kOWSBackup_ImportDatabaseKeySpec = @"kOWSBackup_ImportDatabaseKe
// Attachment-related errors are recoverable and can be ignored. // Attachment-related errors are recoverable and can be ignored.
continue; continue;
} }
[attachment updateWithLazyRestoreFragment:item transaction:transaction]; [attachment markForLazyRestoreWithFragment:item transaction:transaction];
count++; count++;
[self updateProgressWithDescription:NSLocalizedString(@"BACKUP_IMPORT_PHASE_RESTORING_FILES", [self updateProgressWithDescription:NSLocalizedString(@"BACKUP_IMPORT_PHASE_RESTORING_FILES",
@"Indicates that the backup import data is being restored.") @"Indicates that the backup import data is being restored.")

@ -69,8 +69,8 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Update With... Methods #pragma mark - Update With... Methods
// Marks attachment as needing "lazy backup restore." // Marks attachment as needing "lazy backup restore."
- (void)updateWithLazyRestoreFragment:(OWSBackupFragment *)lazyRestoreFragment - (void)markForLazyRestoreWithFragment:(OWSBackupFragment *)lazyRestoreFragment
transaction:(YapDatabaseReadWriteTransaction *)transaction; transaction:(YapDatabaseReadWriteTransaction *)transaction;
// Marks attachment as having completed "lazy backup restore." // Marks attachment as having completed "lazy backup restore."
- (void)updateWithLazyRestoreComplete; - (void)updateWithLazyRestoreComplete;

@ -623,8 +623,8 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Update With... Methods #pragma mark - Update With... Methods
- (void)updateWithLazyRestoreFragment:(OWSBackupFragment *)lazyRestoreFragment - (void)markForLazyRestoreWithFragment:(OWSBackupFragment *)lazyRestoreFragment
transaction:(YapDatabaseReadWriteTransaction *)transaction transaction:(YapDatabaseReadWriteTransaction *)transaction
{ {
OWSAssert(lazyRestoreFragment); OWSAssert(lazyRestoreFragment);
OWSAssert(transaction); OWSAssert(transaction);

Loading…
Cancel
Save