main.app.cash.backfila.embedded.JavaBackfila.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.
package app.cash.backfila.embedded
import app.cash.backfila.client.Backfill
import javax.inject.Inject
import okio.ByteString
/**
* Programmatic access to backfila runs for Java. This represents the customer's use of the Backfila
* UI in tests.
* Note that passing in Parameters objects for testing is not supported in Java. You must use the
* parameterData map instead.
*
* Kotlin customers should use [Backfila] directly.
*/
class JavaBackfila @Inject constructor(private val backfila: Backfila) {
// Dry Run Signatures
fun createDryRun(
backfill: Class,
): BackfillRun {
return backfila.createDryRun(backfill.kotlin, null, mapOf(), null, null)
}
@JvmOverloads
fun createDryRun(
backfill: Class,
parameterData: Map,
rangeStart: String? = null,
rangeEnd: String? = null,
): BackfillRun {
return backfila.createDryRun(backfill.kotlin, null, parameterData, rangeStart, rangeEnd)
}
// Wet Run Signatures
fun createWetRun(
backfill: Class,
): BackfillRun {
return backfila.createWetRun(backfill.kotlin, null, mapOf(), null, null)
}
@JvmOverloads
fun createWetRun(
backfill: Class,
parameterData: Map,
rangeStart: String? = null,
rangeEnd: String? = null,
): BackfillRun {
return backfila.createWetRun(backfill.kotlin, null, parameterData, rangeStart, rangeEnd)
}
// Helper methods
fun findExistingRun(
backfillType: Class,
backfillRunId: Long,
): BackfillRun {
return backfila.findExistingRun(backfillType.kotlin, backfillRunId)
}
fun findLatestRun(
backfillType: Class,
): BackfillRun {
return backfila.findLatestRun(backfillType.kotlin)
}
val configureServiceData = backfila.configureServiceData
}