Perform backup deletion in a durable job.

This commit is contained in:
Alex Hart
2025-05-28 13:07:09 -03:00
committed by GitHub
parent 8900721064
commit 6a40f4a4f4
17 changed files with 603 additions and 91 deletions

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
import kotlinx.coroutines.flow.Flow
import okio.withLock
import org.signal.core.util.logging.Log
import org.thoughtcrime.securesms.backup.DeletionState
import org.thoughtcrime.securesms.backup.RestoreState
import org.thoughtcrime.securesms.backup.v2.BackupFrequency
import org.thoughtcrime.securesms.backup.v2.MessageBackupTier
@@ -71,6 +72,7 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
private const val KEY_USER_MANUALLY_SKIPPED_MEDIA_RESTORE = "backup.user.manually.skipped.media.restore"
private const val KEY_BACKUP_EXPIRED_AND_DOWNGRADED = "backup.expired.and.downgraded"
private const val KEY_BACKUP_DELETION_STATE = "backup.deletion.state"
private const val KEY_MEDIA_ROOT_BACKUP_KEY = "backup.mediaRootBackupKey"
@@ -86,6 +88,10 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
var usedBackupMediaSpace: Long by longValue(KEY_BACKUP_USED_MEDIA_SPACE, 0L)
var lastBackupProtoSize: Long by longValue(KEY_BACKUP_LAST_PROTO_SIZE, 0L)
private val deletionStateValue = enumValue(KEY_BACKUP_DELETION_STATE, DeletionState.NONE, DeletionState.serializer)
var deletionState by deletionStateValue
val deletionStateFlow: Flow<DeletionState> = deletionStateValue.toFlow()
var restoreState: RestoreState by enumValue(KEY_RESTORE_STATE, RestoreState.NONE, RestoreState.serializer)
var optimizeStorage: Boolean by booleanValue(KEY_OPTIMIZE_STORAGE, false)
var backupWithCellular: Boolean by booleanValue(KEY_BACKUP_OVER_CELLULAR, false)