com.avito.android.runner.devices.internal.kubernetes.KubernetesReservationClientFactory.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of impl Show documentation
Show all versions of impl Show documentation
Collection of infrastructure libraries and gradle plugins of Avito Android project
package com.avito.android.runner.devices.internal.kubernetes
import com.avito.android.runner.devices.internal.EmulatorsLogsReporter
import com.avito.k8s.KubernetesApi
import com.avito.logger.LoggerFactory
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.sync.Mutex
@ExperimentalCoroutinesApi
internal class KubernetesReservationClientFactory(
private val kubernetesApi: KubernetesApi,
private val reservationDeploymentFactory: ReservationDeploymentFactory,
private val emulatorsLogsReporter: EmulatorsLogsReporter,
private val deviceProvider: RemoteDeviceProvider,
private val listener: KubernetesReservationListener,
private val loggerFactory: LoggerFactory,
private val podsQueryIntervalMs: Long,
private val dispatcher: CoroutineDispatcher
) {
fun create(): KubernetesReservationClient {
val lock = Mutex()
return KubernetesReservationClient(
claimer(lock),
releaser(),
listener,
kubernetesApi,
dispatcher,
lock,
loggerFactory
)
}
private fun claimer(lock: Mutex): KubernetesReservationClaimer =
KubernetesReservationClaimer(
reservationDeploymentFactory,
kubernetesApi,
DeploymentPodsListener(lock, kubernetesApi, podsQueryIntervalMs, loggerFactory),
deviceProvider,
emulatorsLogsReporter,
listener,
lock,
loggerFactory
)
private fun releaser(): KubernetesReservationReleaser =
KubernetesReservationReleaser(
kubernetesApi, deviceProvider, emulatorsLogsReporter, loggerFactory
)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy