Documentation ¶
Overview ¶
Package job package
Index ¶
- type CancellationEvent
- type CancellationSubscriptionsOptions
- type ClaimJobResponse
- type LogEvent
- type LogEventSubscriptionOptions
- type LogStore
- 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) GetJobLogDescriptor(ctx context.Context, job *models.Job) (*models.JobLogDescriptor, 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) GetLogs(ctx context.Context, jobID string, startOffset int, limit int) ([]byte, error)
- func (_m *MockService) SaveLogs(ctx context.Context, jobID string, startOffset int, buffer []byte) error
- func (_m *MockService) SubscribeToCancellationEvent(ctx context.Context, options *CancellationSubscriptionsOptions) (<-chan *CancellationEvent, error)
- func (_m *MockService) SubscribeToJobLogEvents(ctx context.Context, job *models.Job, options *LogEventSubscriptionOptions) (<-chan *LogEvent, error)
- type Service
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 LogEventSubscriptionOptions ¶
type LogEventSubscriptionOptions struct {
LastSeenLogSize *int
}
LogEventSubscriptionOptions includes options for setting up a log event subscription
type LogStore ¶
type LogStore interface { SaveLogs(ctx context.Context, workspaceID string, runID string, logID string, startOffset int, buffer []byte) error GetLogs(ctx context.Context, workspaceID string, runID string, logID string, startOffset int, limit int) ([]byte, error) }
LogStore interface encapsulates the logic for saving and retrieving logs
func NewLogStore ¶
func NewLogStore(objectStore objectstore.ObjectStore, dbClient *db.Client) LogStore
NewLogStore creates an instance of the LogStore interface
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) GetJobLogDescriptor ¶
func (_m *MockService) GetJobLogDescriptor(ctx context.Context, job *models.Job) (*models.JobLogDescriptor, error)
GetJobLogDescriptor provides a mock function with given fields: ctx, job
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) GetLogs ¶
func (_m *MockService) GetLogs(ctx context.Context, jobID string, startOffset int, limit int) ([]byte, error)
GetLogs provides a mock function with given fields: ctx, jobID, startOffset, limit
func (*MockService) SaveLogs ¶
func (_m *MockService) SaveLogs(ctx context.Context, jobID string, startOffset int, buffer []byte) error
SaveLogs provides a mock function with given fields: ctx, jobID, startOffset, buffer
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) SubscribeToJobLogEvents ¶
func (_m *MockService) SubscribeToJobLogEvents(ctx context.Context, job *models.Job, options *LogEventSubscriptionOptions) (<-chan *LogEvent, error)
SubscribeToJobLogEvents provides a mock function with given fields: ctx, job, 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) GetLatestJobForRun(ctx context.Context, run *models.Run) (*models.Job, error) SubscribeToCancellationEvent(ctx context.Context, options *CancellationSubscriptionsOptions) (<-chan *CancellationEvent, error) SaveLogs(ctx context.Context, jobID string, startOffset int, buffer []byte) error GetLogs(ctx context.Context, jobID string, startOffset int, limit int) ([]byte, error) GetJobLogDescriptor(ctx context.Context, job *models.Job) (*models.JobLogDescriptor, error) SubscribeToJobLogEvents(ctx context.Context, job *models.Job, options *LogEventSubscriptionOptions) (<-chan *LogEvent, error) }
Service implements all job related functionality
func NewService ¶
func NewService( logger logger.Logger, dbClient *db.Client, idp *auth.IdentityProvider, eventManager *events.EventManager, runStateManager *state.RunStateManager, logStore LogStore, ) Service
NewService creates an instance of Service