Documentation ¶
Overview ¶
Package job package
Index ¶
- type CancellationEvent
- type CancellationSubscriptionsOptions
- type ClaimJobResponse
- type Event
- type GetJobsInput
- type LogEvent
- type LogStreamEventSubscriptionOptions
- type MockService
- func (_m *MockService) ClaimJob(ctx context.Context, runnerPath string) (*ClaimJobResponse, error)
- func (_m *MockService) GetJob(ctx context.Context, jobID string) (*models.Job, error)
- func (_m *MockService) GetJobs(ctx context.Context, input *GetJobsInput) (*db.JobsResult, error)
- func (_m *MockService) GetJobsByIDs(ctx context.Context, idList []string) ([]models.Job, error)
- func (_m *MockService) GetLatestJobForRun(ctx context.Context, run *models.Run) (*models.Job, error)
- func (_m *MockService) GetLogStreamsByJobIDs(ctx context.Context, idList []string) ([]models.LogStream, error)
- func (_m *MockService) ReadLogs(ctx context.Context, jobID string, startOffset int, limit int) ([]byte, error)
- func (_m *MockService) SubscribeToCancellationEvent(ctx context.Context, options *CancellationSubscriptionsOptions) (<-chan *CancellationEvent, error)
- func (_m *MockService) SubscribeToJobs(ctx context.Context, options *SubscribeToJobsInput) (<-chan *Event, error)
- func (_m *MockService) SubscribeToLogStreamEvents(ctx context.Context, options *LogStreamEventSubscriptionOptions) (<-chan *logstream.LogEvent, error)
- func (_m *MockService) WriteLogs(ctx context.Context, jobID string, startOffset int, logs []byte) (int, error)
- type Service
- type SubscribeToJobsInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CancellationEvent ¶
CancellationEvent represents a job cancellation event
type CancellationSubscriptionsOptions ¶
type CancellationSubscriptionsOptions struct {
JobID string
}
CancellationSubscriptionsOptions includes options for setting up a cancellation event subscription
type ClaimJobResponse ¶
ClaimJobResponse is returned when a runner claims a Job
type GetJobsInput ¶ added in v0.17.0
type GetJobsInput struct { // Sort specifies the field to sort on and direction Sort *db.JobSortableField // PaginationOptions supports cursor based pagination PaginationOptions *pagination.Options // Status is the job status to filter on Status *models.JobStatus // Type is the job type to filter on Type *models.JobType // WorkspaceID is the workspace ID to filter on WorkspaceID *string // RunnerID filters the jobs by the specified runner ID RunnerID *string }
GetJobsInput includes options for getting jobs
type LogStreamEventSubscriptionOptions ¶ added in v0.17.0
LogStreamEventSubscriptionOptions includes options for setting up a log event subscription
type MockService ¶
MockService is an autogenerated mock type for the Service type
func NewMockService ¶
func NewMockService(t mockConstructorTestingTNewMockService) *MockService
NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*MockService) ClaimJob ¶ added in v0.8.0
func (_m *MockService) ClaimJob(ctx context.Context, runnerPath string) (*ClaimJobResponse, error)
ClaimJob provides a mock function with given fields: ctx, runnerPath
func (*MockService) GetJobs ¶ added in v0.17.0
func (_m *MockService) GetJobs(ctx context.Context, input *GetJobsInput) (*db.JobsResult, error)
GetJobs provides a mock function with given fields: ctx, input
func (*MockService) GetJobsByIDs ¶
GetJobsByIDs provides a mock function with given fields: ctx, idList
func (*MockService) GetLatestJobForRun ¶
func (_m *MockService) GetLatestJobForRun(ctx context.Context, run *models.Run) (*models.Job, error)
GetLatestJobForRun provides a mock function with given fields: ctx, run
func (*MockService) GetLogStreamsByJobIDs ¶ added in v0.17.0
func (_m *MockService) GetLogStreamsByJobIDs(ctx context.Context, idList []string) ([]models.LogStream, error)
GetLogStreamsByJobIDs provides a mock function with given fields: ctx, idList
func (*MockService) ReadLogs ¶ added in v0.17.0
func (_m *MockService) ReadLogs(ctx context.Context, jobID string, startOffset int, limit int) ([]byte, error)
ReadLogs provides a mock function with given fields: ctx, jobID, startOffset, limit
func (*MockService) SubscribeToCancellationEvent ¶
func (_m *MockService) SubscribeToCancellationEvent(ctx context.Context, options *CancellationSubscriptionsOptions) (<-chan *CancellationEvent, error)
SubscribeToCancellationEvent provides a mock function with given fields: ctx, options
func (*MockService) SubscribeToJobs ¶ added in v0.17.0
func (_m *MockService) SubscribeToJobs(ctx context.Context, options *SubscribeToJobsInput) (<-chan *Event, error)
SubscribeToJobs provides a mock function with given fields: ctx, options
func (*MockService) SubscribeToLogStreamEvents ¶ added in v0.17.0
func (_m *MockService) SubscribeToLogStreamEvents(ctx context.Context, options *LogStreamEventSubscriptionOptions) (<-chan *logstream.LogEvent, error)
SubscribeToLogStreamEvents provides a mock function with given fields: ctx, options
type Service ¶
type Service interface { ClaimJob(ctx context.Context, runnerPath string) (*ClaimJobResponse, error) GetJob(ctx context.Context, jobID string) (*models.Job, error) GetJobsByIDs(ctx context.Context, idList []string) ([]models.Job, error) GetJobs(ctx context.Context, input *GetJobsInput) (*db.JobsResult, error) GetLatestJobForRun(ctx context.Context, run *models.Run) (*models.Job, error) SubscribeToCancellationEvent(ctx context.Context, options *CancellationSubscriptionsOptions) (<-chan *CancellationEvent, error) WriteLogs(ctx context.Context, jobID string, startOffset int, logs []byte) (int, error) ReadLogs(ctx context.Context, jobID string, startOffset int, limit int) ([]byte, error) SubscribeToLogStreamEvents(ctx context.Context, options *LogStreamEventSubscriptionOptions) (<-chan *logstream.LogEvent, error) GetLogStreamsByJobIDs(ctx context.Context, idList []string) ([]models.LogStream, error) SubscribeToJobs(ctx context.Context, options *SubscribeToJobsInput) (<-chan *Event, error) }
Service implements all job related functionality
func NewService ¶
func NewService( logger logger.Logger, dbClient *db.Client, idp *auth.IdentityProvider, logStreamManager logstream.Manager, eventManager *events.EventManager, runStateManager *state.RunStateManager, ) Service
NewService creates an instance of Service
type SubscribeToJobsInput ¶ added in v0.17.0
SubscribeToJobsInput is the input for subscribing to jobs