All Downloads are FREE. Search and download functionalities are using the official Maven repository.

main.app.cash.backfila.client.stat.parameters.ParametersDatasourceBackfill.kt Maven / Gradle / Ivy

Go to download

Backfila is a service that manages backfill state, calling into other services to do batched work.

The newest version!
package app.cash.backfila.client.stat.parameters

import app.cash.backfila.client.PrepareBackfillConfig
import app.cash.backfila.client.stat.StaticDatasourceBackfillBase

/**
 * This backfill type is a sub variant of the [StaticDatasourceBackfillBase].
 *
 * It uses a parameter populated in the Backfila UI as the datasource for the backfill.If you have too
 * much data to fit in a parameter consider using a different client such as the S3 client.
 */
abstract class ParametersDatasourceBackfill> : StaticDatasourceBackfillBase() {
  override fun getStaticDatasource(config: PrepareBackfillConfig

): List = config.parameters.getBackfillData() } interface DatasourceParameters { /** * This produces the full list of data for the backfill. Make sure the element order is consistent. */ fun getBackfillData(): List } /** * Simple comma parameter datasource that produces a list of strings from a comma separated parameter. */ data class CommaParameterDatasource( val commaDatasource: String, ) : DatasourceParameters { override fun getBackfillData() = commaDatasource.split(',') } /** * Simple newline parameter datasource that produces a list of strings from a newline separated parameter. */ data class NewlineParameterDatasource( val newlineDatasource: String, ) : DatasourceParameters { override fun getBackfillData() = newlineDatasource.split('\n') }