Documentation ¶
Overview ¶
Package job defines utilities for managing jobs.
Index ¶
- type IAsynchronousJob
- type IJobManager
- type Manager
- func (m *Manager) FetchJobMessagesFirstPage(ctx context.Context, job IAsynchronousJob) (page pagination.IStaticPageStream, err error)
- func (m *Manager) HasJobCompleted(ctx context.Context, job IAsynchronousJob) (completed bool, err error)
- func (m *Manager) WaitForJobCompletion(ctx context.Context, job IAsynchronousJob) (err error)
- type MockAsynchronousJob
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IAsynchronousJob ¶
type IAsynchronousJob interface { resource.IResource // GetDone returns whether a job has terminated. GetDone() bool // GetError returns whether a system error occurred. GetError() bool // GetFailure returns whether the job has failed. GetFailure() bool // GetSuccess returns whether the job has been successful. GetSuccess() bool // GetStatus returns the state the job is in. This is for information only and should not be relied upon as likely to change. Use flags for implementing a state machine. GetStatus() string }
IAsynchronousJob defines a typical asynchronous job.
func NewMockFailedAsynchronousJob ¶
func NewMockFailedAsynchronousJob() (IAsynchronousJob, error)
func NewMockSuccessfulAsynchronousJob ¶
func NewMockSuccessfulAsynchronousJob() (IAsynchronousJob, error)
func NewMockUndoneAsynchronousJob ¶
func NewMockUndoneAsynchronousJob() (IAsynchronousJob, error)
type IJobManager ¶
type IJobManager interface { // HasJobCompleted calls the services to determine whether the job has completed. HasJobCompleted(ctx context.Context, job IAsynchronousJob) (completed bool, err error) // WaitForJobCompletion waits for a job to complete. WaitForJobCompletion(ctx context.Context, job IAsynchronousJob) (err error) }
IJobManager defines a manager of asynchronous jobs
func NewJobManager ¶
func NewJobManager(logger *messages.MessageLoggerFactory, backOffPeriod time.Duration, fetchJobStatusFunc func(ctx context.Context, jobName string) (IAsynchronousJob, *http.Response, error), fetchJobFirstMessagePageFunc func(ctx context.Context, jobName string) (pagination.IStaticPageStream, *http.Response, error), fetchNextJobMessagesPageFunc func(context.Context, pagination.IStaticPage) (pagination.IStaticPage, error), fetchFutureJobMessagesPageFunc func(context.Context, pagination.IStaticPageStream) (pagination.IStaticPageStream, error)) (IJobManager, error)
NewJobManager creates a new job manager.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) FetchJobMessagesFirstPage ¶ added in v1.3.3
func (m *Manager) FetchJobMessagesFirstPage(ctx context.Context, job IAsynchronousJob) (page pagination.IStaticPageStream, err error)
func (*Manager) HasJobCompleted ¶
func (*Manager) WaitForJobCompletion ¶
func (m *Manager) WaitForJobCompletion(ctx context.Context, job IAsynchronousJob) (err error)
type MockAsynchronousJob ¶
func (*MockAsynchronousJob) FetchType ¶
func (m *MockAsynchronousJob) FetchType() string
func (*MockAsynchronousJob) GetDone ¶
func (m *MockAsynchronousJob) GetDone() bool
func (*MockAsynchronousJob) GetError ¶
func (m *MockAsynchronousJob) GetError() bool
func (*MockAsynchronousJob) GetFailure ¶
func (m *MockAsynchronousJob) GetFailure() bool
func (*MockAsynchronousJob) GetStatus ¶
func (m *MockAsynchronousJob) GetStatus() string
func (*MockAsynchronousJob) GetSuccess ¶
func (m *MockAsynchronousJob) GetSuccess() bool
Click to show internal directories.
Click to hide internal directories.