Package-level declarations

Everything an application touches: the jabbit { } builder, job types and requests, workers and their results, and the Jabbit instance that schedules and reports on them.

Everything an application touches: the jabbit { } builder, job types and requests, workers and their results, and the Jabbit instance that schedules and reports on them.

Everything an application touches: the jabbit { } builder, job types and requests, workers and their results, and the Jabbit instance that schedules and reports on them.

Everything an application touches: the jabbit { } builder, job types and requests, workers and their results, and the Jabbit instance that schedules and reports on them.

Everything an application touches: the jabbit { } builder, job types and requests, workers and their results, and the Jabbit instance that schedules and reports on them.

Types

Link copied to clipboard

Android side of the jabbit { } builder.

Link copied to clipboard

How the delay before a retry grows after a job returns JobResult.Retry or is interrupted.

Link copied to clipboard

Browser side of the jabbit { } builder. Mirrors JabbitBrowserOptions.

Link copied to clipboard
data class Constraints(val requiredNetworkType: NetworkType = NetworkType.NOT_REQUIRED, val requiresCharging: Boolean = false, val requiresBatteryNotLow: Boolean = false, val requiresStorageNotLow: Boolean = false, val requiresDeviceIdle: Boolean = false)

Device conditions that must hold before a job is allowed to run.

Link copied to clipboard

Scope of the constraints builder function.

Link copied to clipboard

The desktop Jabbit, which owns the resources it needs and can hand them back.

Link copied to clipboard

Desktop side of the jabbit { } builder. Mirrors JabbitDesktopOptions.

Link copied to clipboard

How Jabbit.enqueueUnique resolves a collision with an unfinished job of the same unique name.

Link copied to clipboard

How Jabbit.enqueueUniquePeriodic resolves a collision with an unfinished periodic job of the same unique name.

Link copied to clipboard

JabbitStorage backed by a file on disk. This is the default on the desktop.

Link copied to clipboard
class IndexedDbJabbitStorage(databaseName: String = DEFAULT_DATABASE, storeName: String = DEFAULT_STORE, key: String = DEFAULT_KEY) : JabbitStorage

JabbitStorage backed by IndexedDB. This is the default on the web.

Link copied to clipboard
class IosScope

iOS side of the jabbit { } builder. Mirrors JabbitIosOptions.

Link copied to clipboard
interface Jabbit

Schedules background jobs and reports on them.

Link copied to clipboard

The single androidx.work.ListenableWorker every Jabbit job is scheduled as.

Link copied to clipboard
annotation class JabbitDsl

Marks the receivers of the jabbit { } builder so that nested blocks cannot see each other.

Link copied to clipboard
interface JabbitListener

Watches what happens to jobs, for logging, analytics and crash reporting.

Link copied to clipboard
fun interface JabbitLogger

Sink for the diagnostic output of the scheduler.

Link copied to clipboard

Receiver of the jabbit { } builder.

Link copied to clipboard
interface JabbitStorage

Persistence used by the platforms where Jabbit owns the job queue itself, currently iOS and the browser.

Link copied to clipboard

Raised when the browser refuses to read or write the job queue.

Link copied to clipboard
fun interface JabbitWorker<I, O>

A unit of background work, typed by the payload it takes and the payload it returns.

Link copied to clipboard

Everything a running job knows about itself.

Link copied to clipboard
value class JobId(val value: String)

Stable identifier of a single enqueued job.

Link copied to clipboard
data class JobInfo

Snapshot of an enqueued job.

Link copied to clipboard
@Serializable
data class JobProgress(val fraction: Float? = null, val message: String? = null)

What a running job reports about how far along it is.

Link copied to clipboard
sealed class JobRequest

A unit of background work handed to Jabbit.enqueue.

Link copied to clipboard
sealed class JobResult<out O>

Outcome a worker reports at the end of JabbitWorker.doWork.

Link copied to clipboard

Lifecycle state of an enqueued job.

Link copied to clipboard
class JobType<I, O>

Describes one kind of job: the name it is persisted under, and the payloads it accepts and produces.

Link copied to clipboard
class LocalStorageJabbitStorage(key: String = "tech.ryadom.jabbit.jobs") : JabbitStorage

JabbitStorage backed by localStorage.

Link copied to clipboard

Network condition a job requires before it may run.

Link copied to clipboard

A job that runs once.

Link copied to clipboard

A job that repeats until it is cancelled or fails.

Link copied to clipboard
fun interface ProgressReporter

Receiver of JobExecution.setProgress calls.

Link copied to clipboard
class UserDefaultsJabbitStorage(defaults: NSUserDefaults = NSUserDefaults.standardUserDefaults, key: String = DEFAULT_KEY) : JabbitStorage

JabbitStorage backed by NSUserDefaults.

Functions

Link copied to clipboard

Builds Constraints with a DSL.

Link copied to clipboard
fun jabbit(configure: JabbitScope.() -> Unit): Jabbit

Creates a Jabbit for whichever platform the code is running on, from a single description that lives in common code.

Link copied to clipboard
inline fun <I, O> jobType(name: String): JobType<I, O>

Declares a JobType named name, taking I and producing O.

Link copied to clipboard
fun <O> oneTimeJob(type: JobType<Unit, O>, configure: OneTimeJobRequest.Builder.() -> Unit = {}): OneTimeJobRequest

Builds a OneTimeJobRequest for a job that needs no input.

fun <I, O> oneTimeJob(type: JobType<I, O>, input: I, configure: OneTimeJobRequest.Builder.() -> Unit = {}): OneTimeJobRequest

Builds a OneTimeJobRequest running type with input.

Link copied to clipboard
fun <O> JobInfo.output(type: JobType<*, O>): O?

Reads what the job produced, or null when it has not succeeded yet.

Link copied to clipboard
fun <O> periodicJob(type: JobType<Unit, O>, repeatInterval: Duration, configure: PeriodicJobRequest.Builder.() -> Unit = {}): PeriodicJobRequest

Builds a PeriodicJobRequest for a job that needs no input.

fun <I, O> periodicJob(type: JobType<I, O>, input: I, repeatInterval: Duration, configure: PeriodicJobRequest.Builder.() -> Unit = {}): PeriodicJobRequest

Builds a PeriodicJobRequest running type with input every repeatInterval.

Link copied to clipboard
fun <O> periodicJobMillis(type: JobType<Unit, O>, repeatIntervalMillis: Long, configure: PeriodicJobRequest.Builder.() -> Unit = {}): PeriodicJobRequest

Builds a PeriodicJobRequest for a job that needs no input, repeating every repeatIntervalMillis milliseconds.

fun <I, O> periodicJobMillis(type: JobType<I, O>, input: I, repeatIntervalMillis: Long, configure: PeriodicJobRequest.Builder.() -> Unit = {}): PeriodicJobRequest

Builds a PeriodicJobRequest repeating every repeatIntervalMillis milliseconds, for callers without kotlin.time.Duration.

Link copied to clipboard

Asks the browser to keep this origin's storage, and reports whether it now will.

Link copied to clipboard
fun startJabbitServiceWorker(configure: JabbitScope.() -> Unit)

Runs pending jobs inside a service worker, so they continue after the last page is closed.