github.com/blend/go-sdk@v1.20220411.3/cron/job_interfaces.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package cron 9 10 import ( 11 "context" 12 ) 13 14 // Job is an interface types can satisfy to be loaded into the JobManager. 15 type Job interface { 16 Name() string 17 Execute(context.Context) error 18 } 19 20 // ConfigProvider is a type that returns a job config. 21 type ConfigProvider interface { 22 Config() JobConfig 23 } 24 25 // BackgroundProvider is a type that returns a base context based on a parent. 26 type BackgroundProvider interface { 27 Background(context.Context) context.Context 28 } 29 30 // ScheduleProvider is a type that provides a schedule for the job. 31 // If a job does not implement this method, it is treated as 32 // "OnDemand" or a job that must be triggered explicitly. 33 type ScheduleProvider interface { 34 Schedule() Schedule 35 } 36 37 // LifecycleProvider is a job that provides lifecycle hooks. 38 type LifecycleProvider interface { 39 Lifecycle() JobLifecycle 40 }