Documentation ¶
Index ¶
- type IService
- type RequestPullJobs
- type ResponsePullJobs
- type Service
- func (svc *Service) CancelJob(jobUUID job.JobUUID) error
- func (svc *Service) ChangeVisibilityTimeoutJob(jobUUID job.JobUUID, visibilityTimeout uint) error
- func (svc *Service) CheckJobsRetention() error
- func (svc *Service) CloneJob(jobUUID job.JobUUID) (*job.Job, error)
- func (svc *Service) ComputeLockedResources(jobs job.JobMap) job.LockedResources
- func (svc *Service) ComputeMetrics() error
- func (svc *Service) CreateJob(payload []byte) (*job.Job, error)
- func (svc *Service) DeleteAllJobs() error
- func (svc *Service) DeleteJob(jobUUID job.JobUUID) error
- func (svc *Service) EnqueueJob(j *job.Job) error
- func (svc *Service) FailJob(jobUUID job.JobUUID) error
- func (svc *Service) Finalize() error
- func (svc *Service) FinalizeJobCreation(j *job.Job) (*job.Job, error)
- func (svc *Service) FindBestJobCandidates(req *RequestPullJobs) ([]*job.Job, error)
- func (svc *Service) GenerateNewJobUuid() (job.JobUUID, error)
- func (svc *Service) GetAllJobs() ([]*job.Job, error)
- func (svc *Service) GetJob(uuid job.JobUUID) (*job.Job, error)
- func (svc *Service) GetJobsCount() uint
- func (svc *Service) GetJobsUUIDs() job.JobUUIDList
- func (svc *Service) GetLockedResources() (job.LockedResources, error)
- func (svc *Service) GetLogger() *zap.Logger
- func (svc *Service) GetServiceEventChan() chan ServiceEvent
- func (svc *Service) Healthcheck() bool
- func (svc *Service) Init() error
- func (svc *Service) LoadJobs() error
- func (svc *Service) PullJobs(req *RequestPullJobs) (*ResponsePullJobs, error)
- func (svc *Service) PullSpecificJob(req *RequestPullJobs) (*ResponsePullJobs, error)
- func (svc *Service) Run() error
- func (svc *Service) SetJobAsSuccessful(jobUUID job.JobUUID) error
- func (svc *Service) StartJob(jobUUID job.JobUUID, req *RequestPullJobs) error
- func (svc *Service) Stop() error
- func (svc *Service) TryEnqueuePendingJobs()
- func (svc *Service) UnlockAllResources() error
- func (svc *Service) UnlockJobResources(j *job.Job) error
- func (svc *Service) Watchdog()
- type ServiceEvent
- type ServiceEventType
- type ServiceMetrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IService ¶
type IService interface { Init() error Stop() error Finalize() error GetJobsCount() uint GetJobsUUIDs() job.JobUUIDList LoadJobs() error GetJob(job.JobUUID) (*job.Job, error) GetAllJobs() ([]*job.Job, error) CreateJob(payload []byte) (*job.Job, error) PullJobs(*RequestPullJobs) (*ResponsePullJobs, error) StartJob(job.JobUUID, *RequestPullJobs) error CloneJob(job.JobUUID) (*job.Job, error) CancelJob(job.JobUUID) error SetJobAsSuccessful(job.JobUUID) error FailJob(job.JobUUID) error DeleteJob(job.JobUUID) error DeleteAllJobs() error GenerateNewJobUuid() (job.JobUUID, error) GetLockedResources() (job.LockedResources, error) UnlockAllResources() error ChangeVisibilityTimeoutJob(job.JobUUID, uint) error Healthcheck() bool ComputeMetrics() error TryEnqueuePendingJobs() Watchdog() GetServiceEventChan() chan ServiceEvent GetLogger() *zap.Logger }
type RequestPullJobs ¶
type RequestPullJobs struct { JobUUID *job.JobUUID // if nil pull any job, else pull the specific job Topic string // topic to pull the job from (if empty pull from any topic) NumJobs uint // number of jobs to pull (if 0 pull only one job) VisibilityTimeout uint // parameter to hide the job for a specific duration WaitTimeSeconds uint // parameter enables long-poll (if 0 return immediately if no job available) }
type ResponsePullJobs ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) ChangeVisibilityTimeoutJob ¶
func (*Service) CheckJobsRetention ¶
func (*Service) ComputeLockedResources ¶
func (svc *Service) ComputeLockedResources(jobs job.JobMap) job.LockedResources
func (*Service) ComputeMetrics ¶
func (*Service) DeleteAllJobs ¶
func (*Service) FinalizeJobCreation ¶
func (*Service) FindBestJobCandidates ¶
func (svc *Service) FindBestJobCandidates(req *RequestPullJobs) ([]*job.Job, error)
func (*Service) GetJobsCount ¶
func (*Service) GetJobsUUIDs ¶
func (svc *Service) GetJobsUUIDs() job.JobUUIDList
func (*Service) GetLockedResources ¶
func (svc *Service) GetLockedResources() (job.LockedResources, error)
func (*Service) GetServiceEventChan ¶
func (svc *Service) GetServiceEventChan() chan ServiceEvent
func (*Service) Healthcheck ¶
func (*Service) PullJobs ¶
func (svc *Service) PullJobs(req *RequestPullJobs) (*ResponsePullJobs, error)
func (*Service) PullSpecificJob ¶
func (svc *Service) PullSpecificJob(req *RequestPullJobs) (*ResponsePullJobs, error)
func (*Service) SetJobAsSuccessful ¶
func (*Service) StartJob ¶
func (svc *Service) StartJob(jobUUID job.JobUUID, req *RequestPullJobs) error
func (*Service) TryEnqueuePendingJobs ¶
func (svc *Service) TryEnqueuePendingJobs()
func (*Service) UnlockAllResources ¶
type ServiceEvent ¶
type ServiceEvent struct { Type ServiceEventType Metrics ServiceMetrics JobUUID job.JobUUID }
type ServiceEventType ¶
type ServiceEventType int
ServiceEventType is a int type that represents the type of event that can be sent by the service
const ( // ServiceEventJobCreated is an event that is sent when a job is created ServiceEventJobCreated ServiceEventType = iota // ServiceEventJobEnqueued is an event that is sent when a job is enqueued ServiceEventJobEnqueued // ServiceEventJobStarted is an event that is sent when a job is started ServiceEventJobStarted // ServiceEventJobSucceeded is an event that is sent when a job is succeeded ServiceEventJobSucceeded // ServiceEventJobCanceled is an event that is sent when a job is canceled ServiceEventJobCanceled // ServiceEventJobDeleted is an event that is sent when a job is deleted ServiceEventJobDeleted // ServiceEventJobTimeout is an event that is sent when a job is timeout ServiceEventJobTimeout // ServiceEventJobDeletedAll is an event that is sent when all jobs are deleted ServiceEventJobDeletedAll // ServiceEventJobUnlockedAllResources is an event that is sent when all resources are unlocked ServiceEventJobUnlockedAllResources // ServiceEventJobHealthcheck is an event that is sent when the healthcheck is called ServiceEventJobHealthcheck // ServiceEventJobMetrics is an event that is sent when the metrics are computed ServiceEventJobMetrics // ServiceEventJobWatchdog is an event that is sent when the watchdog is called ServiceEventJobWatchdog // ServiceEventShutdown is an event that is sent when the service is shutdown ServiceEventShutdown )
type ServiceMetrics ¶
type ServiceMetrics struct { ResourcesLockedCount uint // number of current locked resources JobsCount uint // number of current existing jobs JobsCounterCreated uint // counter of total created jobs JobsCounterPending uint // counter of total pending jobs JobsCounterQueued uint // counter of total queued jobs JobsCounterRunning uint // counter of total running jobs JobsCounterSucceeded uint // counter of total succeeded jobs JobsCounterFailed uint // counter of total failed jobs JobsCounterTimeout uint // counter of total timeout jobs JobsCounterDeleted uint // counter of total deleted jobs JobsCounterCanceled uint // counter of total canceled jobs JobsCounterFaillure uint // counter of total faillure jobs (this is not related to the status of the job) }
Click to show internal directories.
Click to hide internal directories.