LocalDataSource

Room operations used by the Home repository for content and pending-sync metadata.

User-scoped lists exclude soft-deleted rows. Pending queries include rows with needsSync set or lastUpdated greater than lastSynced. The stored server timestamp supplies the pull cursor. Writes do not schedule sync; the repository requests it separately.

See also

Functions

Link copied to clipboard
abstract suspend fun deleteJetpackPermanently(id: String)

Permanently deletes a jetpack from the database.

Link copied to clipboard
abstract fun getJetpack(id: String): Flow<JetpackEntity>

Retrieves a specific jetpack by its ID.

Link copied to clipboard
abstract fun getJetpacks(userId: String): Flow<List<JetpackEntity>>

Observes a user's non-deleted jetpacks, newest edit first.

Link copied to clipboard
abstract suspend fun getSyncCursor(userId: String): Long

Returns the largest stored server write time, including soft-deleted rows. This timestamp alone does not establish a complete pull checkpoint.

Link copied to clipboard
abstract suspend fun getUnsyncedJetpacks(userId: String): List<JetpackEntity>

Retrieves a list of jetpacks for a specific user that need to be synced.

Link copied to clipboard
abstract suspend fun insertJetpack(jetpackEntity: JetpackEntity)

Inserts a new jetpack into the database.

Link copied to clipboard
abstract suspend fun markAsSynced(id: String, timestamp: Long = System.currentTimeMillis())

Clears pending flags by ID and sets lastSynced, without checking the uploaded version.

Link copied to clipboard
abstract suspend fun markJetpackAsDeleted(id: String)

Marks a jetpack as deleted.

Link copied to clipboard
abstract suspend fun updateJetpack(jetpackEntity: JetpackEntity)

Updates an existing jetpack in the database.

Link copied to clipboard
abstract suspend fun upsertJetpack(jetpackEntity: JetpackEntity)

Inserts or updates a jetpack in the database.

Link copied to clipboard
abstract suspend fun upsertJetpacks(remoteJetpacks: List<JetpackEntity>)

Upserts (insert or update) jetpacks from a remote source.