Documentation
¶
Index ¶
- type EventType
- type ObservableJob
- type ObservableJobCallback
- type Observer
- func (o *Observer) GetJobByName(jobName string) ObservableJob
- func (o *Observer) GetJobsByRepository(repository string) []ObservableJob
- func (o *Observer) GetUpdateChannel() chan ObservableJob
- func (o *Observer) IsAnyJobRunning(repository string) bool
- func (o *Observer) IsConcurrentJobsLimitReached(jobType v1alpha1.JobType, limit int) bool
- func (o *Observer) IsExclusiveJobRunning(repository string) bool
- func (o *Observer) RegisterCallback(name string, callback ObservableJobCallback)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ObservableJob ¶
type ObservableJob struct { Job *batchv1.Job JobType v1alpha1.JobType Event EventType Exclusive bool Repository string // contains filtered or unexported fields }
ObservableJob defines a batchv1.job that is being observed by the Observer.
type ObservableJobCallback ¶
type ObservableJobCallback func(ObservableJob)
ObservableJobCallback is invoked on certain events of the ObservableJob. The related ObservableJob is passed as argument. Check the ObservableJob.Event property if you need to know the exact event on which your ObservableJobCallback was invoked.
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
Observer handles the internal state of the observed batchv1.job objects.
func (*Observer) GetJobByName ¶
func (o *Observer) GetJobByName(jobName string) ObservableJob
GetJobByName will return the requested job if it exists. JobName needs to be a string in the form of `jobname/namespace`
func (*Observer) GetJobsByRepository ¶
func (o *Observer) GetJobsByRepository(repository string) []ObservableJob
GetJobsByRepository will return a list of all the jobs currently being observed in a given repository.
func (*Observer) GetUpdateChannel ¶
func (o *Observer) GetUpdateChannel() chan ObservableJob
GetUpdateChannel returns a chan ObservableJob. This channel allows for adding or updating jobs that are observed.
func (*Observer) IsAnyJobRunning ¶
IsAnyJobRunning will return true if there's any job running for the given repository.
func (*Observer) IsConcurrentJobsLimitReached ¶
IsConcurrentJobsLimitReached checks if the limit of concurrent jobs by type (backup, check, etc) has been reached
func (*Observer) IsExclusiveJobRunning ¶
IsExclusiveJobRunning will return true if there's currently an exclusive job running on the repository.
func (*Observer) RegisterCallback ¶
func (o *Observer) RegisterCallback(name string, callback ObservableJobCallback)
RegisterCallback will register a function to the given observed job. The callbacks will be executed if the job is successful, failed or deleted.