main.app.cash.backfila.embedded.BackfillRun.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of backfila-embedded Show documentation
Show all versions of backfila-embedded Show documentation
Backfila is a service that manages backfill state, calling into other services to do batched work.
The newest version!
package app.cash.backfila.embedded
import app.cash.backfila.client.Backfill
import app.cash.backfila.embedded.internal.BatchSnapshot
import app.cash.backfila.embedded.internal.PartitionCursor
import app.cash.backfila.protos.clientservice.GetNextBatchRangeResponse
import app.cash.backfila.protos.clientservice.PrepareBackfillResponse
import okio.ByteString
/**
* Get an instance of this from [Backfila].
*/
interface BackfillRun {
val backfill: B
val dryRun: Boolean
val parameters: Map
val rangeStart: String?
val rangeEnd: String?
val backfillRunId: String
var batchSize: Long
var scanSize: Long
var computeCountLimit: Long
val prepareBackfillResponse: PrepareBackfillResponse
val precomputeMatchingCount: Long
val precomputeScannedCount: Long
val partitionProgressSnapshot: Map
val batchesToRunSnapshot: List
/** Prepares, scans and runs the whole backfill. */
fun execute() {
precomputeRemaining()
scanRemaining()
runAllScanned()
check(complete()) { "$this failed to run everything. Probably a bug." }
}
fun precomputeScan(): GetNextBatchRangeResponse
fun precomputeRemaining()
fun finishedPrecomputing(): Boolean
/** Does a single scan for batches on the partition provided. */
fun partitionScan(partitionName: String): GetNextBatchRangeResponse
/** Does a single scan for batches on any partition. */
fun singleScan(): GetNextBatchRangeResponse
/** Scans all the remaining batches and places them in the queue to run. */
fun scanRemaining()
fun finishedScanning(): Boolean
/** Throws an error if there is no batch to run. */
fun runBatch()
/** Runs all the batches that are scanned and ready to run. */
fun runAllScanned()
fun complete(): Boolean
}