Documentation ¶
Index ¶
- type JobStatus
- type JobTableUpdater
- type JobTableUpdaterMock
- func (mock *JobTableUpdaterMock) AddMessageIdAndClearSubscriptionError(queue string, jobSet string, fromMessageId string) error
- func (mock *JobTableUpdaterMock) ClearSubscriptionErrorCalls() []struct{ ... }
- func (mock *JobTableUpdaterMock) GetSubscriptionError(queue string, jobSet string) (string, error)
- func (mock *JobTableUpdaterMock) GetSubscriptionErrorCalls() []struct{ ... }
- func (mock *JobTableUpdaterMock) IsJobSetSubscribed(queue string, jobSet string) (bool, string, error)
- func (mock *JobTableUpdaterMock) IsJobSetSubscribedCalls() []struct{ ... }
- func (mock *JobTableUpdaterMock) SetSubscriptionError(queue string, jobSet string, err string, fromMessageId string) error
- func (mock *JobTableUpdaterMock) SetSubscriptionErrorCalls() []struct{ ... }
- func (mock *JobTableUpdaterMock) SubscribeJobSet(queue string, jobSet string, fromMessageId string) error
- func (mock *JobTableUpdaterMock) SubscribeJobSetCalls() []struct{ ... }
- func (mock *JobTableUpdaterMock) UnsubscribeJobSet(queue string, jobSet string) (int64, error)
- func (mock *JobTableUpdaterMock) UpdateJobServiceDb(jobStatus *JobStatus) error
- func (mock *JobTableUpdaterMock) UpdateJobServiceDbCalls() []struct{ ... }
- func (mock *JobTableUpdaterMock) UpdateJobSetDb(queue, jobSet, fromMessageId string) error
- func (mock *JobTableUpdaterMock) UpdateJobSetDbCalls() []struct{ ... }
- type SQLJobService
- func (s *SQLJobService) AddMessageIdAndClearSubscriptionError(queue string, jobSet string, fromMessageId string) error
- func (s *SQLJobService) CheckToUnSubscribe(queue string, jobSet string, configTimeWithoutUpdates int64) (bool, error)
- func (s *SQLJobService) CleanupJobSetAndJobs(queue string, jobSet string) (int64, error)
- func (s *SQLJobService) CreateTable()
- func (s *SQLJobService) DeleteJobsInJobSet(queue string, jobSet string) (int64, error)
- func (s *SQLJobService) GetJobStatus(jobId string) (*js.JobServiceResponse, error)
- func (s *SQLJobService) GetSubscribedJobSets() ([]SubscribedTuple, error)
- func (s *SQLJobService) GetSubscriptionError(queue string, jobSet string) (string, error)
- func (s *SQLJobService) HealthCheck() (bool, error)
- func (s *SQLJobService) IsJobSetSubscribed(queue string, jobSet string) (bool, string, error)
- func (s *SQLJobService) SetSubscriptionError(queue string, jobSet string, connErr string, fromMessageId string) error
- func (s *SQLJobService) Setup()
- func (s *SQLJobService) SubscribeJobSet(queue string, jobSet string, fromMessageId string) error
- func (s *SQLJobService) UnsubscribeJobSet(queue, jobSet string) (int64, error)
- func (s *SQLJobService) UpdateJobServiceDb(jobTable *JobStatus) error
- func (s *SQLJobService) UpdateJobSetDb(queue string, jobSet string, fromMessageId string) error
- type SubscribeTable
- type SubscribedTuple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobStatus ¶
type JobStatus struct {
// contains filtered or unexported fields
}
JobStatus represents a job status
func NewJobStatus ¶
func NewJobStatus(queue string, jobSetId string, jobId string, jobResponse js.JobServiceResponse) *JobStatus
NewJobStatus combines params into struct JobStatus and adds a timestamp
type JobTableUpdater ¶
type JobTableUpdater interface { SubscribeJobSet(queue string, jobSet string, fromMessageId string) error IsJobSetSubscribed(queue string, jobSet string) (bool, string, error) UpdateJobServiceDb(jobTable *JobStatus) error UpdateJobSetDb(queue string, jobSet string, fromMessageId string) error SetSubscriptionError(queue string, jobSet string, err string, fromMessageId string) error GetSubscriptionError(queue string, jobSet string) (string, error) AddMessageIdAndClearSubscriptionError(queue string, jobSet string, messageId string) error UnsubscribeJobSet(queue string, jobSet string) (int64, error) }
type JobTableUpdaterMock ¶
type JobTableUpdaterMock struct { // ClearSubscriptionErrorFunc mocks the ClearSubscriptionError method. AddMessageIdAndClearSubscriptionErrorFunc func(queue string, jobSet string, fromMessageId string) error // GetSubscriptionErrorFunc mocks the GetSubscriptionError method. GetSubscriptionErrorFunc func(queue string, jobSet string) (string, error) // IsJobSetSubscribedFunc mocks the IsJobSetSubscribed method. IsJobSetSubscribedFunc func(queue string, jobSet string) (bool, string, error) // SetSubscriptionErrorFunc mocks the SetSubscriptionError method. SetSubscriptionErrorFunc func(queue string, jobSet string, err string, fromMessageId string) error // SubscribeJobSetFunc mocks the SubscribeJobSet method. SubscribeJobSetFunc func(queue string, jobSet string, fromMessageId string) error // UpdateJobServiceDbFunc mocks the UpdateJobServiceDb method. UpdateJobServiceDbFunc func(jobStatus *JobStatus) error // Mock for Unsubscribe job set UnsubscribeJobSetFunc func(queue, jobSet string) (int64, error) // Mock for UpdateJobSetDb UpdateJobSetDbFunc func(queue, jobSet, fromMessageId string) error // contains filtered or unexported fields }
JobTableUpdaterMock is a mock implementation of JobTableUpdater.
func TestSomethingThatUsesJobTableUpdater(t *testing.T) { // make and configure a mocked JobTableUpdater mockedJobTableUpdater := &JobTableUpdaterMock{ ClearSubscriptionErrorFunc: func(queue string, jobSet string) { panic("mock out the ClearSubscriptionError method") }, GetSubscriptionErrorFunc: func(queue string, jobSet string) string { panic("mock out the GetSubscriptionError method") }, IsJobSetSubscribedFunc: func(queue string, jobSet string) bool { panic("mock out the IsJobSetSubscribed method") }, SetSubscriptionErrorFunc: func(queue string, jobSet string, err string) { panic("mock out the SetSubscriptionError method") }, SubscribeJobSetFunc: func(queue string, jobSet string) { panic("mock out the SubscribeJobSet method") }, UpdateJobServiceDbFunc: func(jobStatus *JobStatus) error { panic("mock out the UpdateJobServiceDb method") }, } // use mockedJobTableUpdater in code that requires JobTableUpdater // and then make assertions. }
func (*JobTableUpdaterMock) AddMessageIdAndClearSubscriptionError ¶ added in v0.3.60
func (mock *JobTableUpdaterMock) AddMessageIdAndClearSubscriptionError(queue string, jobSet string, fromMessageId string) error
ClearSubscriptionError calls ClearSubscriptionErrorFunc.
func (*JobTableUpdaterMock) ClearSubscriptionErrorCalls ¶
func (mock *JobTableUpdaterMock) ClearSubscriptionErrorCalls() []struct { Queue string JobSet string FromMessageId string }
ClearSubscriptionErrorCalls gets all the calls that were made to ClearSubscriptionError. Check the length with:
len(mockedJobTableUpdater.ClearSubscriptionErrorCalls())
func (*JobTableUpdaterMock) GetSubscriptionError ¶
func (mock *JobTableUpdaterMock) GetSubscriptionError(queue string, jobSet string) (string, error)
GetSubscriptionError calls GetSubscriptionErrorFunc.
func (*JobTableUpdaterMock) GetSubscriptionErrorCalls ¶
func (mock *JobTableUpdaterMock) GetSubscriptionErrorCalls() []struct { Queue string JobSet string }
GetSubscriptionErrorCalls gets all the calls that were made to GetSubscriptionError. Check the length with:
len(mockedJobTableUpdater.GetSubscriptionErrorCalls())
func (*JobTableUpdaterMock) IsJobSetSubscribed ¶
func (mock *JobTableUpdaterMock) IsJobSetSubscribed(queue string, jobSet string) (bool, string, error)
IsJobSetSubscribed calls IsJobSetSubscribedFunc.
func (*JobTableUpdaterMock) IsJobSetSubscribedCalls ¶
func (mock *JobTableUpdaterMock) IsJobSetSubscribedCalls() []struct { Queue string JobSet string }
IsJobSetSubscribedCalls gets all the calls that were made to IsJobSetSubscribed. Check the length with:
len(mockedJobTableUpdater.IsJobSetSubscribedCalls())
func (*JobTableUpdaterMock) SetSubscriptionError ¶
func (mock *JobTableUpdaterMock) SetSubscriptionError(queue string, jobSet string, err string, fromMessageId string) error
SetSubscriptionError calls SetSubscriptionErrorFunc.
func (*JobTableUpdaterMock) SetSubscriptionErrorCalls ¶
func (mock *JobTableUpdaterMock) SetSubscriptionErrorCalls() []struct { Queue string JobSet string Err string FromMessageId string }
SetSubscriptionErrorCalls gets all the calls that were made to SetSubscriptionError. Check the length with:
len(mockedJobTableUpdater.SetSubscriptionErrorCalls())
func (*JobTableUpdaterMock) SubscribeJobSet ¶
func (mock *JobTableUpdaterMock) SubscribeJobSet(queue string, jobSet string, fromMessageId string) error
SubscribeJobSet calls SubscribeJobSetFunc.
func (*JobTableUpdaterMock) SubscribeJobSetCalls ¶
func (mock *JobTableUpdaterMock) SubscribeJobSetCalls() []struct { Queue string JobSet string FromMessageId string }
SubscribeJobSetCalls gets all the calls that were made to SubscribeJobSet. Check the length with:
len(mockedJobTableUpdater.SubscribeJobSetCalls())
func (*JobTableUpdaterMock) UnsubscribeJobSet ¶ added in v0.3.60
func (mock *JobTableUpdaterMock) UnsubscribeJobSet(queue string, jobSet string) (int64, error)
func (*JobTableUpdaterMock) UpdateJobServiceDb ¶
func (mock *JobTableUpdaterMock) UpdateJobServiceDb(jobStatus *JobStatus) error
UpdateJobServiceDb calls UpdateJobServiceDbFunc.
func (*JobTableUpdaterMock) UpdateJobServiceDbCalls ¶
func (mock *JobTableUpdaterMock) UpdateJobServiceDbCalls() []struct { JobStatus *JobStatus }
UpdateJobServiceDbCalls gets all the calls that were made to UpdateJobServiceDb. Check the length with:
len(mockedJobTableUpdater.UpdateJobServiceDbCalls())
func (*JobTableUpdaterMock) UpdateJobSetDb ¶ added in v0.3.60
func (mock *JobTableUpdaterMock) UpdateJobSetDb(queue, jobSet, fromMessageId string) error
UpdateJobServiceDb calls UpdateJobServiceDbFunc.
func (*JobTableUpdaterMock) UpdateJobSetDbCalls ¶ added in v0.3.60
func (mock *JobTableUpdaterMock) UpdateJobSetDbCalls() []struct { Queue string JobSet string FromMessageId string }
UpdateJobServiceDbCalls gets all the calls that were made to UpdateJobServiceDb. Check the length with:
len(mockedJobTableUpdater.UpdateJobServiceDbCalls())
type SQLJobService ¶
type SQLJobService struct {
// contains filtered or unexported fields
}
SQLJobService for persisting to DB.
func NewSQLJobService ¶
func NewSQLJobService(config *configuration.JobServiceConfiguration, db *sql.DB) *SQLJobService
func (*SQLJobService) AddMessageIdAndClearSubscriptionError ¶ added in v0.3.60
func (s *SQLJobService) AddMessageIdAndClearSubscriptionError(queue string, jobSet string, fromMessageId string) error
Clear subscription error if present
func (*SQLJobService) CheckToUnSubscribe ¶
func (s *SQLJobService) CheckToUnSubscribe(queue string, jobSet string, configTimeWithoutUpdates int64) (bool, error)
Checks JobSet table to make determine if we should unsubscribe from JobSet configTimeWithoutUpdates is a configurable value that is read from the config We allow unsubscribing if the jobset hasn't been updated in configTime TODO implement this
func (*SQLJobService) CleanupJobSetAndJobs ¶
func (s *SQLJobService) CleanupJobSetAndJobs(queue string, jobSet string) (int64, error)
UnSubscribe to JobSet and delete all the jobs in the database
func (*SQLJobService) CreateTable ¶
func (s *SQLJobService) CreateTable()
Create a Table from a hard-coded schema.
func (*SQLJobService) DeleteJobsInJobSet ¶
func (s *SQLJobService) DeleteJobsInJobSet(queue string, jobSet string) (int64, error)
Delete Jobs in the database
func (*SQLJobService) GetJobStatus ¶
func (s *SQLJobService) GetJobStatus(jobId string) (*js.JobServiceResponse, error)
Get the JobStatus given the jodId
func (*SQLJobService) GetSubscribedJobSets ¶
func (s *SQLJobService) GetSubscribedJobSets() ([]SubscribedTuple, error)
func (*SQLJobService) GetSubscriptionError ¶
func (s *SQLJobService) GetSubscriptionError(queue string, jobSet string) (string, error)
Get subscription error if present
func (*SQLJobService) HealthCheck ¶
func (s *SQLJobService) HealthCheck() (bool, error)
Simple Health Check to Verify if SqlLite is working.
func (*SQLJobService) IsJobSetSubscribed ¶
Check if JobSet is in our map.
func (*SQLJobService) SetSubscriptionError ¶
func (s *SQLJobService) SetSubscriptionError(queue string, jobSet string, connErr string, fromMessageId string) error
Set subscription error if present
func (*SQLJobService) Setup ¶
func (s *SQLJobService) Setup()
Call on a newly created SQLJobService object to setup the DB for use.
func (*SQLJobService) SubscribeJobSet ¶
func (s *SQLJobService) SubscribeJobSet(queue string, jobSet string, fromMessageId string) error
func (*SQLJobService) UnsubscribeJobSet ¶ added in v0.3.60
func (s *SQLJobService) UnsubscribeJobSet(queue, jobSet string) (int64, error)
func (*SQLJobService) UpdateJobServiceDb ¶
func (s *SQLJobService) UpdateJobServiceDb(jobTable *JobStatus) error
Update database with JobTable.
func (*SQLJobService) UpdateJobSetDb ¶ added in v0.3.60
func (s *SQLJobService) UpdateJobSetDb(queue string, jobSet string, fromMessageId string) error
type SubscribeTable ¶
type SubscribeTable struct {
// contains filtered or unexported fields
}
func NewSubscribeTable ¶
func NewSubscribeTable(queue string, jobSet string) *SubscribeTable