Versions in this module Expand all Collapse all v0 v0.8.8 Feb 7, 2023 Changes in this version + type DBCleaning interface + DeleteDuplicateJobs func() error + DeleteIsDone func() error + type LockFreeJobCacheOption func(cache *LockFreeJobCache) + func WithDBCleaning(cleaning DBCleaning) LockFreeJobCacheOption v0.8.7 Apr 19, 2021 v0.8.6 Apr 19, 2021 v0.8.5 Apr 16, 2021 Changes in this version + const LocalJob + const RemoteJob + var ErrCmdIsEmpty = errors.New("Job Command is empty.") + var ErrInvalidDelimiters = errors.New("Job has invalid templating delimiters.") + var ErrInvalidJob = errors.New("Invalid Local Job. Job's must contain a Name and a Command field") + var ErrInvalidJobType = errors.New("Invalid Job type. Types supported: 0 for local and 1 for remote") + var ErrInvalidRemoteJob = errors.New("Invalid Remote Job. Job's must contain a Name and a url field") + var ErrJobDisabled = errors.New("Job cannot run, as it is disabled") + var ErrJobDoesntExist = errors.New("The job you requested does not exist") + var ErrJobTypeInvalid = errors.New("Job Type is not valid.") + var RFC3339WithoutTimezone = "2006-01-02T15:04:05" + func DeleteAll(cache JobCache) error + type Clock struct + func (clk *Clock) SetClock(in clock.Clock) + func (clk *Clock) Time() clock.Clock + func (clk *Clock) TimeSet() (result bool) + type Clocker interface + Time func() clock.Clock + TimeSet func() bool + type ErrJobNotFound string + func (id ErrJobNotFound) Error() string + type Job struct + Command string + DependentJobs []string + Disabled bool + Epsilon string + Id string + IsDone bool + JobType jobType + Metadata Metadata + Name string + NextRunAt time.Time + OnFailureJob string + Owner string + ParentJobs []string + RemoteProperties RemoteProperties + ResumeAtNextScheduledTime bool + Retries uint + Schedule string + Stats []*JobStat + TemplateDelimiters string + func GetMockFailingJob() *Job + func GetMockJob() *Job + func GetMockJobWithGenericSchedule(now time.Time) *Job + func GetMockJobWithSchedule(repeat int, scheduleTime time.Time, delay string) *Job + func GetMockRecurringJobWithSchedule(scheduleTime time.Time, delay string) *Job + func GetMockRemoteJob(props RemoteProperties) *Job + func NewFromBytes(b []byte) (*Job, error) + func (j *Job) Delete(cache JobCache) error + func (j *Job) DeleteFromDependentJobs(cache JobCache) error + func (j *Job) DeleteFromParentJobs(cache JobCache) error + func (j *Job) Disable(cache JobCache) error + func (j *Job) Enable(cache JobCache) error + func (j *Job) GetWaitDuration() time.Duration + func (j *Job) Init(cache JobCache) error + func (j *Job) InitDelayDuration(checkTime bool) error + func (j *Job) MarshalJSON() ([]byte, error) + func (j *Job) Run(cache JobCache) + func (j *Job) RunCmd() (string, error) + func (j *Job) RunOnFailureJob(cache JobCache) + func (j *Job) SetClock(clk clock.Clock) + func (j *Job) ShouldStartWaiting() bool + func (j *Job) StartWaiting(cache JobCache, justRan bool) + func (j *Job) StopTimer() + func (j Job) Bytes() ([]byte, error) + type JobCache interface + Delete func(id string) error + Disable func(j *Job) error + Enable func(j *Job) error + Get func(id string) (*Job, error) + GetAll func() *JobsMap + Persist func() error + Set func(j *Job) error + type JobDB interface + Close func() error + Delete func(id string) error + Get func(id string) (*Job, error) + GetAll func() ([]*Job, error) + Save func(job *Job) error + type JobRunner struct + func (j *JobRunner) LocalRun() (string, error) + func (j *JobRunner) RemoteRun() (string, error) + func (j *JobRunner) Run(cache JobCache) (*JobStat, Metadata, error) + type JobStat struct + ExecutionDuration time.Duration + JobId string + NumberOfRetries uint + RanAt time.Time + Success bool + func GetMockJobStats(oldDate time.Time, count int) []*JobStat + func NewJobStat(id string) *JobStat + type JobsMap struct + Jobs map[string]*Job + Lock sync.RWMutex + func NewJobsMap() *JobsMap + type KalaStats struct + ActiveJobs int + CreatedAt time.Time + DisabledJobs int + ErrorCount uint + Jobs int + LastAttemptedRun time.Time + NextRunAt time.Time + SuccessCount uint + func NewKalaStats(cache JobCache) *KalaStats + type LockFreeJobCache struct + PersistOnWrite bool + func NewLockFreeJobCache(jobDB JobDB) *LockFreeJobCache + func NewMockCache() *LockFreeJobCache + func (c *LockFreeJobCache) Delete(id string) error + func (c *LockFreeJobCache) Disable(j *Job) error + func (c *LockFreeJobCache) Enable(j *Job) error + func (c *LockFreeJobCache) Get(id string) (*Job, error) + func (c *LockFreeJobCache) GetAll() *JobsMap + func (c *LockFreeJobCache) Persist() error + func (c *LockFreeJobCache) PersistEvery(persistWaitTime time.Duration) + func (c *LockFreeJobCache) Retain() error + func (c *LockFreeJobCache) RetainEvery(retentionWaitTime time.Duration) + func (c *LockFreeJobCache) Set(j *Job) error + func (c *LockFreeJobCache) Start(persistWaitTime time.Duration, jobstatTtl time.Duration) + type MemoryDB struct + func NewMemoryDB() *MemoryDB + func (m *MemoryDB) Close() error + func (m *MemoryDB) Delete(id string) error + func (m *MemoryDB) Get(id string) (*Job, error) + func (m *MemoryDB) GetAll() (ret []*Job, _ error) + func (m *MemoryDB) Save(j *Job) error + type MemoryJobCache struct + PersistOnWrite bool + func NewMemoryJobCache(jobDB JobDB) *MemoryJobCache + func (c *MemoryJobCache) Delete(id string) error + func (c *MemoryJobCache) Disable(j *Job) error + func (c *MemoryJobCache) Enable(j *Job) error + func (c *MemoryJobCache) Get(id string) (*Job, error) + func (c *MemoryJobCache) GetAll() *JobsMap + func (c *MemoryJobCache) Persist() error + func (c *MemoryJobCache) PersistEvery(persistWaitTime time.Duration) + func (c *MemoryJobCache) Set(j *Job) error + func (c *MemoryJobCache) Start(persistWaitTime time.Duration) + type Metadata struct + ErrorCount uint + LastAttemptedRun time.Time + LastError time.Time + LastSuccess time.Time + NumberOfFinishedRuns uint + SuccessCount uint + type MockDB struct + func (m *MockDB) Close() error + func (m *MockDB) Delete(id string) error + func (m *MockDB) Get(id string) (*Job, error) + func (m *MockDB) GetAll() ([]*Job, error) + func (m *MockDB) Save(job *Job) error + type MockDBGetAll struct + func (d *MockDBGetAll) GetAll() ([]*Job, error) + type RJob Job + type RemoteProperties struct + Body string + ExpectedResponseCodes []int + Headers http.Header + Method string + Timeout int + Url string