Skip to content

Commit df10340

Browse files
committed
chore: backup status docs & comments
1 parent e699c54 commit df10340

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

app/src/main/java/to/bitkit/models/BackupCategory.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ enum class BackupCategory(
5050
}
5151

5252
/**
53-
* @property running In progress
54-
* @property synced Timestamp in ms of last time this backup was synced
55-
* @property required Timestamp in ms of last time this backup was required
53+
* @property running Backup is currently in progress
54+
* @property synced Timestamp in millis of last time this backup succeeded
55+
* @property required Timestamp in millis of last time the data changed
5656
*/
5757
@Serializable
5858
data class BackupItemStatus(

app/src/main/java/to/bitkit/repositories/BackupRepo.kt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ import java.util.concurrent.ConcurrentHashMap
5050
import javax.inject.Inject
5151
import javax.inject.Singleton
5252

53+
/**
54+
* Manages backup & restore of wallet metadata to a remote VSS server.
55+
*
56+
* **Backup State Machine:**
57+
* ```
58+
* Idle State: running=false, synced≥required
59+
* ↓ (data changes → markBackupRequired())
60+
* Pending State: running=false, synced<required
61+
* ↓ (scheduleBackup())
62+
* Running State: running=true, synced<required
63+
* ↓ (triggerBackup() succeeds)
64+
* Idle State: running=false, synced≥required
65+
* ```
66+
*/
5367
@Suppress("LongParameterList")
5468
@Singleton
5569
class BackupRepo @Inject constructor(
@@ -72,7 +86,7 @@ class BackupRepo @Inject constructor(
7286
private val dataListenerJobs = mutableListOf<Job>()
7387
private var periodicCheckJob: Job? = null
7488

75-
private val runningBackups = ConcurrentHashMap.newKeySet<BackupCategory>()
89+
private val runningBackups = ConcurrentHashMap.newKeySet<BackupCategory>() // Tracks active jobs since app start
7690

7791
private var isObserving = false
7892
private var lastNotificationTime = 0L

0 commit comments

Comments
 (0)