Skip to content

Kotlin Multiplatform implemenation for work managment

Notifications You must be signed in to change notification settings

doTTTTT/lorraine

Repository files navigation

THIS IS A WORK IN PROGRESS

Subject to change.

Lorraine

Maven Central

Lorraine is a work management framework for tasks.

Get started

First add the dependency to your project:

Lastest vesion: https://mvnrepository.com/artifact/io.github.dottttt.lorraine/lorraine

[versions]
lorraine = "$lastestversion"

[libraries]
lorraine = { module = "io.github.dottttt.lorraine:lorraine", version.ref = "lorraine" }

Using it

Initialization

Initialize Lorraine with workers.

const val GET_WORKER = "GET_WORKER"

lorraine {
    work(GET_WORKER) { GetWorker() }
    ...
}

Create workers by extending WorkLorraine

class GetWorker : WorkLorraine() {

    override suspend fun doWork(inputData: Data?): LorraineResult {
        ...
        return LorraineResult.success() / LorraineResult.retry() / LorraineResult.failure()
    }
    
}

Launch your worker

Lorraine.enqueue(
    uniqueId = "UNIQUE_ID",
    type = ExistingLorrainePolicy.APPEND,
    request = lorraineRequest {
        identifier = GET_WORKER
        constraints { 
            requiredNetwork = true
        }
    }
)

Reporting Issues / Support

Report any issue on this GitHub repository.

Inspirations

Contributing

Feel free to open pull request