Package dev. inmo. krontab
Types
KronScheduler
Link copied to clipboard
interface KronScheduler
Content copied to clipboard
This interface was created for abstraction of next operation.
KronSchedulerTz
Link copied to clipboard
This interface extending KronScheduler to use DateTimeTz with taking into account offset of incoming time for next operation.
KronSchedulerWork
Link copied to clipboard
abstract class KronSchedulerWork(context: Context, workerParams: WorkerParameters) : CoroutineWorker
Content copied to clipboard
KrontabTemplate
Link copied to clipboard
KrontabTemplateSchedulerWork
Link copied to clipboard
abstract class KrontabTemplateSchedulerWork(context: Context, workerParams: WorkerParameters) : KronSchedulerWork
Content copied to clipboard
KrontabTemplateWrapper
Link copied to clipboard
data class KrontabTemplateWrapper(template: KrontabTemplate) : KronScheduler
Content copied to clipboard
This class contains template and can be simply serialized/deserialized.
Functions
buildSchedule
Link copied to clipboard
fun buildSchedule(incoming: KrontabTemplate, defaultOffset: Minutes): KronSchedulerTz
Content copied to clipboard
Shortcut for createSimpleScheduler
createSimpleScheduler
Link copied to clipboard
Parse incoming string and adapt according to next format: "* * * * *" where order of things:
seconds
minutes
hours
dayOfMonth
month
(optional) year
(optional) (can be placed anywhere after month) (must be marked with
o
at the end, for example: 60o == +01:00) offset(optional) (can be placed anywhere after month) dayOfWeek
{number}[,{number},...]
or *
and {number} here is one of{int}-{int}
{int}/{int}
*/{int}
{int}
F
L
w
at the end, and starts with 0 which means Sunday.fun createSimpleScheduler(incoming: KrontabTemplate, defaultOffset: Minutes): KronSchedulerTz
Content copied to clipboard
doInfinity
Link copied to clipboard
inline suspend fun KronScheduler.doInfinity(noinline block: suspend () -> Unit)
Content copied to clipboard
Will execute block without any checking of result
inline suspend fun doInfinity(scheduleConfig: String, noinline block: suspend () -> Unit)
Content copied to clipboard
doWhile
Link copied to clipboard
inline suspend fun KronScheduler.doWhile(noinline block: suspend () -> Boolean)
Content copied to clipboard
Will execute block while it will return true as a result of its calculation
enqueueKronSchedulerWork
Link copied to clipboard
inline suspend fun <T : KronSchedulerWork> Context.enqueueKronSchedulerWork(workName: String, initialScheduler: KronScheduler, existingWorkPolicy: ExistingWorkPolicy = ExistingWorkPolicy.REPLACE, noinline setUpRequest: suspend OneTimeWorkRequest.Builder.() -> Unit = {}): Operation?
Content copied to clipboard
inline suspend fun <T : KronSchedulerWork> Context.enqueueKronSchedulerWork(workName: String, delayMillis: Long, existingWorkPolicy: ExistingWorkPolicy = ExistingWorkPolicy.REPLACE, noinline setUpRequest: suspend OneTimeWorkRequest.Builder.() -> Unit = {}): Operation
Content copied to clipboard
suspend fun <T : KronSchedulerWork> Context.enqueueKronSchedulerWork(workName: String, initialScheduler: KronScheduler, workClass: Class<T>, existingWorkPolicy: ExistingWorkPolicy = ExistingWorkPolicy.REPLACE, setUpRequest: suspend OneTimeWorkRequest.Builder.() -> Unit = {}): Operation?
Content copied to clipboard
suspend fun <T : KronSchedulerWork> Context.enqueueKronSchedulerWork(workName: String, delayMillis: Long, workClass: Class<T>, existingWorkPolicy: ExistingWorkPolicy = ExistingWorkPolicy.REPLACE, setUpRequest: suspend OneTimeWorkRequest.Builder.() -> Unit = {}): Operation
Content copied to clipboard
enqueueKrontabTemplateSchedulerWork
Link copied to clipboard
inline suspend fun <T : KrontabTemplateSchedulerWork> Context.enqueueKrontabTemplateSchedulerWork(workName: String, krontabTemplate: KrontabTemplate, existingWorkPolicy: ExistingWorkPolicy = ExistingWorkPolicy.REPLACE, noinline setUpRequest: suspend OneTimeWorkRequest.Builder.(data: Data) -> Unit = {}): Operation?
Content copied to clipboard
Will enqueueKronSchedulerWork with KronScheduler from krontabTemplate and call setUpRequest on setting up OneTimeWorkRequest.Builder with Data which will be used to OneTimeWorkRequest.Builder.setInputData after setUpRequest completed
merge
Link copied to clipboard
inline fun merge(vararg kronDateTimeSchedulers: KronScheduler): CollectionKronScheduler
Content copied to clipboard
next
Link copied to clipboard
nextOrNow
Link copied to clipboard
nextOrNowWithOffset
Link copied to clipboard
nextOrRelative
Link copied to clipboard
suspend fun KronScheduler.nextOrRelative(relatively: DateTime = DateTime.now()): DateTime
Content copied to clipboard
suspend fun KronSchedulerTz.nextOrRelative(relatively: DateTimeTz): DateTimeTz
Content copied to clipboard
nextTimeZoned
Link copied to clipboard
toKronScheduler
Link copied to clipboard
fun KrontabTemplate.toKronScheduler(defaultOffset: Minutes): KronSchedulerTz
Content copied to clipboard
Shortcut for buildSchedule
toSchedule
Link copied to clipboard
wrapAsKronScheduler
Link copied to clipboard
Properties
AnyTimeScheduler
Link copied to clipboard
EveryDayOfMonthScheduler
Link copied to clipboard
EveryHourScheduler
Link copied to clipboard
EveryMinuteScheduler
Link copied to clipboard
EveryMonthScheduler
Link copied to clipboard
EverySecondScheduler
Link copied to clipboard
EveryYearScheduler
Link copied to clipboard
krontabTemplateWorkField
Link copied to clipboard