Documentation ¶
Index ¶
- Constants
- Variables
- func GetJobStatus(id string) string
- func GetStatus() string
- func JobLock(id string)
- func JobUnlock(id string)
- func RegisterChannelJob(newJob Job, stopChan chan interface{}) (string, error)
- func RegisterChannelJobWithName(newJob Job, stopChan chan interface{}, name string) (string, error)
- func RegisterDetachedChannelJob(newJob Job, stopChan chan interface{}) (string, error)
- func RegisterDetachedChannelJobWithName(newJob Job, stopChan chan interface{}, name string) (string, error)
- func RegisterDetachedIntervalJob(newJob Job, interval time.Duration) (string, error)
- func RegisterDetachedIntervalJobWithName(newJob Job, interval time.Duration, name string) (string, error)
- func RegisterIntervalJob(newJob Job, interval time.Duration) (string, error)
- func RegisterIntervalJobWithName(newJob Job, interval time.Duration, name string) (string, error)
- func RegisterRetryJob(newJob Job, retries int) (string, error)
- func RegisterRetryJobWithName(newJob Job, retries int, name string) (string, error)
- func RegisterScheduledJob(newJob Job, schedule string) (string, error)
- func RegisterScheduledJobWithName(newJob Job, schedule, name string) (string, error)
- func RegisterSingleRunJob(newJob Job) (string, error)
- func RegisterSingleRunJobWithName(newJob Job, name string) (string, error)
- func UnregisterJob(jobID string)
- func UpdateDurations(retryInterval time.Duration, executionTimeout time.Duration)
- type Job
- type JobExecution
- type JobStatus
- type Pool
- func (p *Pool) GetJob(id string) JobExecution
- func (p *Pool) GetJobStatus(id string) string
- func (p *Pool) GetStatus() string
- func (p *Pool) JobLock(id string)
- func (p *Pool) JobUnlock(id string)
- func (p *Pool) RegisterChannelJob(newJob Job, stopChan chan interface{}) (string, error)
- func (p *Pool) RegisterChannelJobWithName(newJob Job, stopChan chan interface{}, name string) (string, error)
- func (p *Pool) RegisterDetachedChannelJob(newJob Job, stopChan chan interface{}) (string, error)
- func (p *Pool) RegisterDetachedChannelJobWithName(newJob Job, stopChan chan interface{}, name string) (string, error)
- func (p *Pool) RegisterDetachedIntervalJob(newJob Job, interval time.Duration) (string, error)
- func (p *Pool) RegisterDetachedIntervalJobWithName(newJob Job, interval time.Duration, name string) (string, error)
- func (p *Pool) RegisterIntervalJob(newJob Job, interval time.Duration) (string, error)
- func (p *Pool) RegisterIntervalJobWithName(newJob Job, interval time.Duration, name string) (string, error)
- func (p *Pool) RegisterRetryJob(newJob Job, retries int) (string, error)
- func (p *Pool) RegisterRetryJobWithName(newJob Job, retries int, name string) (string, error)
- func (p *Pool) RegisterScheduledJob(newJob Job, schedule string) (string, error)
- func (p *Pool) RegisterScheduledJobWithName(newJob Job, schedule, name string) (string, error)
- func (p *Pool) RegisterSingleRunJob(newJob Job) (string, error)
- func (p *Pool) RegisterSingleRunJobWithName(newJob Job, name string) (string, error)
- func (p *Pool) SetStatus(status PoolStatus)
- func (p *Pool) UnregisterJob(jobID string)
- type PoolStatus
Constants ¶
const ( JobTypeSingleRun = "single run" JobTypeRetry = "retry" JobTypeInterval = "interval" JobTypeChannel = "channel" JobTypeDetachedChannel = "detached channel" JobTypeDetachedInterval = "detached interval" JobTypeScheduled = "scheduled" )
Job type strings
Variables ¶
var ( ErrRegisteringJob = errors.Newf(1600, "%v job registration failed") ErrExecutingJob = errors.Newf(1601, "Error in %v job %v execution") ErrExecutingRetryJob = errors.Newf(1602, "Error in %v job %v execution, %v more retries") )
Errors hit when validating Amplify Central connectivity
Functions ¶
func GetJobStatus ¶
GetJobStatus - Returns the Status of the Job based on the id in the globalPool
func RegisterChannelJob ¶
RegisterChannelJob - Runs a job with a specific interval between each run in the globalPool
func RegisterChannelJobWithName ¶
RegisterChannelJobWithName - Runs a job with a specific interval between each run in the globalPool
func RegisterDetachedChannelJob ¶
RegisterDetachedChannelJob - Runs a job with a stop channel, detached from other jobs in the globalPool
func RegisterDetachedChannelJobWithName ¶
func RegisterDetachedChannelJobWithName(newJob Job, stopChan chan interface{}, name string) (string, error)
RegisterDetachedChannelJobWithName - Runs a named job with a stop channel, detached from other jobs in the globalPool
func RegisterDetachedIntervalJob ¶
RegisterDetachedIntervalJob - Runs a job with a specific interval between each run in the globalPool, detached from other jobs to always run
func RegisterDetachedIntervalJobWithName ¶
func RegisterDetachedIntervalJobWithName(newJob Job, interval time.Duration, name string) (string, error)
RegisterDetachedIntervalJobWithName - Runs a job with a specific interval between each run in the globalPool, detached from other jobs to always run
func RegisterIntervalJob ¶
RegisterIntervalJob - Runs a job with a specific interval between each run in the globalPool
func RegisterIntervalJobWithName ¶
RegisterIntervalJobWithName - Runs a job with a specific interval between each run in the globalPool
func RegisterRetryJob ¶
RegisterRetryJob - Runs a job with a WithName
func RegisterRetryJobWithName ¶
RegisterRetryJobWithName - Runs a job with a limited number of retries in the globalPool
func RegisterScheduledJob ¶
RegisterScheduledJob - Runs a job on a specific schedule in the globalPool
func RegisterScheduledJobWithName ¶
RegisterScheduledJobWithName - Runs a job on a specific schedule in the globalPool
func RegisterSingleRunJob ¶
RegisterSingleRunJob - Runs a single run job in the globalPool
func RegisterSingleRunJobWithName ¶
RegisterSingleRunJobWithName - Runs a single run job in the globalPool
func UnregisterJob ¶
func UnregisterJob(jobID string)
UnregisterJob - Removes the specified job in the globalPool
Types ¶
type JobExecution ¶
type JobExecution interface { GetStatus() JobStatus GetID() string GetName() string Ready() bool GetJob() JobExecution Lock() Unlock() // contains filtered or unexported methods }
JobExecution - the wrapper interface for every type of job
controls the calling the methods defined in the Job interface
func GetJob ¶
func GetJob(id string) JobExecution
GetJob - Returns the Job based on the id from the globalPool
type JobStatus ¶
type JobStatus int
JobStatus - integer to represent the status of the job
const ( //JobStatusInitializing - Initializing JobStatusInitializing JobStatus = iota //JobStatusRunning - Running JobStatusRunning //JobStatusRetrying - Retrying JobStatusRetrying //JobStatusStopped - Stopped JobStatusStopped //JobStatusFailed - Failed JobStatusFailed //JobStatusFinished - Finished JobStatusFinished )
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool - represents a pool of jobs that are related in such a way that when one is not running none of them should be
func (*Pool) GetJob ¶
func (p *Pool) GetJob(id string) JobExecution
GetJob - Returns the Job based on the id
func (*Pool) GetJobStatus ¶
GetJobStatus - Returns the Status of the Job based on the id
func (*Pool) RegisterChannelJob ¶
RegisterChannelJob - Runs a job with a specific interval between each run
func (*Pool) RegisterChannelJobWithName ¶
func (p *Pool) RegisterChannelJobWithName(newJob Job, stopChan chan interface{}, name string) (string, error)
RegisterChannelJobWithName - Runs a job with a specific interval between each run
func (*Pool) RegisterDetachedChannelJob ¶
RegisterDetachedChannelJob - Runs a job with a stop channel, detached from other jobs
func (*Pool) RegisterDetachedChannelJobWithName ¶
func (p *Pool) RegisterDetachedChannelJobWithName(newJob Job, stopChan chan interface{}, name string) (string, error)
RegisterDetachedChannelJobWithName - Runs a named job with a stop channel, detached from other jobs
func (*Pool) RegisterDetachedIntervalJob ¶
RegisterDetachedIntervalJob - Runs a job with a specific interval between each run, detached from other jobs
func (*Pool) RegisterDetachedIntervalJobWithName ¶
func (p *Pool) RegisterDetachedIntervalJobWithName(newJob Job, interval time.Duration, name string) (string, error)
RegisterDetachedIntervalJobWithName - Runs a job with a specific interval between each run, detached from other jobs
func (*Pool) RegisterIntervalJob ¶
RegisterIntervalJob - Runs a job with a specific interval between each run
func (*Pool) RegisterIntervalJobWithName ¶
func (p *Pool) RegisterIntervalJobWithName(newJob Job, interval time.Duration, name string) (string, error)
RegisterIntervalJobWithName - Runs a job with a specific interval between each run
func (*Pool) RegisterRetryJob ¶
RegisterRetryJob - Runs a job with a limited number of retries
func (*Pool) RegisterRetryJobWithName ¶
RegisterRetryJobWithName - Runs a job with a limited number of retries
func (*Pool) RegisterScheduledJob ¶
RegisterScheduledJob - Runs a job on a specific schedule
func (*Pool) RegisterScheduledJobWithName ¶
RegisterScheduledJobWithName - Runs a job on a specific schedule
func (*Pool) RegisterSingleRunJob ¶
RegisterSingleRunJob - Runs a single run job
func (*Pool) RegisterSingleRunJobWithName ¶
RegisterSingleRunJobWithName - Runs a single run job
func (*Pool) SetStatus ¶
func (p *Pool) SetStatus(status PoolStatus)
SetStatus - Sets the status of the pool of jobs
func (*Pool) UnregisterJob ¶
UnregisterJob - Removes the specified job
type PoolStatus ¶
type PoolStatus int
PoolStatus - integer to represent the status of the jobs in the pool
const ( //PoolStatusInitializing - Initializing PoolStatusInitializing PoolStatus = iota //PoolStatusRunning - Running PoolStatusRunning //PoolStatusStopped - Stopped PoolStatusStopped )
func (PoolStatus) String ¶
func (s PoolStatus) String() string