From b81e9c2a2049634c91dcc4ddbed89566a625f778 Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Mon, 22 Jul 2024 15:06:49 +0800 Subject: [PATCH] Continue renaming --- .../background/backfiller/mocks_test.go | 78 +++++++++---------- .../internal/background/expirer/mocks_test.go | 78 +++++++++---------- .../background/processor/mocks_test.go | 78 +++++++++---------- .../uploads/internal/store/indexes.go | 18 ++--- .../uploads/internal/store/indexes_test.go | 8 +- .../uploads/internal/store/observability.go | 28 +++---- .../codeintel/uploads/internal/store/store.go | 2 +- internal/codeintel/uploads/mocks_test.go | 78 +++++++++---------- internal/codeintel/uploads/service.go | 4 +- internal/codeintel/uploads/shared/types.go | 2 +- .../uploads/transport/graphql/iface.go | 2 +- .../uploads/transport/graphql/mocks_test.go | 78 +++++++++---------- .../graphql/root_resolver_index_mutations.go | 2 +- 13 files changed, 228 insertions(+), 228 deletions(-) diff --git a/internal/codeintel/uploads/internal/background/backfiller/mocks_test.go b/internal/codeintel/uploads/internal/background/backfiller/mocks_test.go index 86a219a41f6..dd24341310c 100644 --- a/internal/codeintel/uploads/internal/background/backfiller/mocks_test.go +++ b/internal/codeintel/uploads/internal/background/backfiller/mocks_test.go @@ -205,10 +205,10 @@ type MockStore struct { // SetRerunAutoIndexJobByIDFunc is an instance of a mock function object // controlling the behavior of the method SetRerunAutoIndexJobByID. SetRerunAutoIndexJobByIDFunc *StoreSetRerunAutoIndexJobByIDFunc - // SetRerunAutoIndexJobsByIDsFunc is an instance of a mock function + // SetRerunAutoIndexJobsFunc is an instance of a mock function // object controlling the behavior of the method - // SetRerunAutoIndexJobsByIDs. - SetRerunAutoIndexJobsByIDsFunc *StoreSetRerunAutoIndexJobsByIDsFunc + // SetRerunAutoIndexJobs. + SetRerunAutoIndexJobsFunc *StoreSetRerunAutoIndexJobsFunc // SoftDeleteExpiredUploadsFunc is an instance of a mock function object // controlling the behavior of the method SoftDeleteExpiredUploads. SoftDeleteExpiredUploadsFunc *StoreSoftDeleteExpiredUploadsFunc @@ -513,8 +513,8 @@ func NewMockStore() *MockStore { return }, }, - SetRerunAutoIndexJobsByIDsFunc: &StoreSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) (r0 error) { + SetRerunAutoIndexJobsFunc: &StoreSetRerunAutoIndexJobsFunc{ + defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsOptions) (r0 error) { return }, }, @@ -840,9 +840,9 @@ func NewStrictMockStore() *MockStore { panic("unexpected invocation of MockStore.SetRerunAutoIndexJobByID") }, }, - SetRerunAutoIndexJobsByIDsFunc: &StoreSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { - panic("unexpected invocation of MockStore.SetRerunAutoIndexJobsByIDs") + SetRerunAutoIndexJobsFunc: &StoreSetRerunAutoIndexJobsFunc{ + defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { + panic("unexpected invocation of MockStore.SetRerunAutoIndexJobs") }, }, SoftDeleteExpiredUploadsFunc: &StoreSoftDeleteExpiredUploadsFunc{ @@ -1061,8 +1061,8 @@ func NewMockStoreFrom(i store.Store) *MockStore { SetRerunAutoIndexJobByIDFunc: &StoreSetRerunAutoIndexJobByIDFunc{ defaultHook: i.SetRerunAutoIndexJobByID, }, - SetRerunAutoIndexJobsByIDsFunc: &StoreSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: i.SetRerunAutoIndexJobsByIDs, + SetRerunAutoIndexJobsFunc: &StoreSetRerunAutoIndexJobsFunc{ + defaultHook: i.SetRerunAutoIndexJobs, }, SoftDeleteExpiredUploadsFunc: &StoreSoftDeleteExpiredUploadsFunc{ defaultHook: i.SoftDeleteExpiredUploads, @@ -7012,37 +7012,37 @@ func (c StoreSetRerunAutoIndexJobByIDFuncCall) Results() []interface{} { return []interface{}{c.Result0} } -// StoreSetRerunAutoIndexJobsByIDsFunc describes the behavior when the -// SetRerunAutoIndexJobsByIDs method of the parent MockStore instance is +// StoreSetRerunAutoIndexJobsFunc describes the behavior when the +// SetRerunAutoIndexJobs method of the parent MockStore instance is // invoked. -type StoreSetRerunAutoIndexJobsByIDsFunc struct { - defaultHook func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error - hooks []func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error - history []StoreSetRerunAutoIndexJobsByIDsFuncCall +type StoreSetRerunAutoIndexJobsFunc struct { + defaultHook func(context.Context, shared.SetRerunAutoIndexJobsOptions) error + hooks []func(context.Context, shared.SetRerunAutoIndexJobsOptions) error + history []StoreSetRerunAutoIndexJobsFuncCall mutex sync.Mutex } -// SetRerunAutoIndexJobsByIDs delegates to the next hook function in the +// SetRerunAutoIndexJobs delegates to the next hook function in the // queue and stores the parameter and result values of this invocation. -func (m *MockStore) SetRerunAutoIndexJobsByIDs(v0 context.Context, v1 shared.SetRerunAutoIndexJobsByIDsOptions) error { - r0 := m.SetRerunAutoIndexJobsByIDsFunc.nextHook()(v0, v1) - m.SetRerunAutoIndexJobsByIDsFunc.appendCall(StoreSetRerunAutoIndexJobsByIDsFuncCall{v0, v1, r0}) +func (m *MockStore) SetRerunAutoIndexJobs(v0 context.Context, v1 shared.SetRerunAutoIndexJobsOptions) error { + r0 := m.SetRerunAutoIndexJobsFunc.nextHook()(v0, v1) + m.SetRerunAutoIndexJobsFunc.appendCall(StoreSetRerunAutoIndexJobsFuncCall{v0, v1, r0}) return r0 } // SetDefaultHook sets function that is called when the -// SetRerunAutoIndexJobsByIDs method of the parent MockStore instance is +// SetRerunAutoIndexJobs method of the parent MockStore instance is // invoked and the hook queue is empty. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) SetDefaultHook(hook func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error) { +func (f *StoreSetRerunAutoIndexJobsFunc) SetDefaultHook(hook func(context.Context, shared.SetRerunAutoIndexJobsOptions) error) { f.defaultHook = hook } // PushHook adds a function to the end of hook queue. Each invocation of the -// SetRerunAutoIndexJobsByIDs method of the parent MockStore instance +// SetRerunAutoIndexJobs method of the parent MockStore instance // invokes the hook at the front of the queue and discards it. After the // queue is empty, the default hook function is invoked for any future // action. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) PushHook(hook func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error) { +func (f *StoreSetRerunAutoIndexJobsFunc) PushHook(hook func(context.Context, shared.SetRerunAutoIndexJobsOptions) error) { f.mutex.Lock() f.hooks = append(f.hooks, hook) f.mutex.Unlock() @@ -7050,20 +7050,20 @@ func (f *StoreSetRerunAutoIndexJobsByIDsFunc) PushHook(hook func(context.Context // SetDefaultReturn calls SetDefaultHook with a function that returns the // given values. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) SetDefaultReturn(r0 error) { - f.SetDefaultHook(func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *StoreSetRerunAutoIndexJobsFunc) SetDefaultReturn(r0 error) { + f.SetDefaultHook(func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { return r0 }) } // PushReturn calls PushHook with a function that returns the given values. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) PushReturn(r0 error) { - f.PushHook(func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *StoreSetRerunAutoIndexJobsFunc) PushReturn(r0 error) { + f.PushHook(func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { return r0 }) } -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) nextHook() func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *StoreSetRerunAutoIndexJobsFunc) nextHook() func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { f.mutex.Lock() defer f.mutex.Unlock() @@ -7076,33 +7076,33 @@ func (f *StoreSetRerunAutoIndexJobsByIDsFunc) nextHook() func(context.Context, s return hook } -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) appendCall(r0 StoreSetRerunAutoIndexJobsByIDsFuncCall) { +func (f *StoreSetRerunAutoIndexJobsFunc) appendCall(r0 StoreSetRerunAutoIndexJobsFuncCall) { f.mutex.Lock() f.history = append(f.history, r0) f.mutex.Unlock() } -// History returns a sequence of StoreSetRerunAutoIndexJobsByIDsFuncCall +// History returns a sequence of StoreSetRerunAutoIndexJobsFuncCall // objects describing the invocations of this function. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) History() []StoreSetRerunAutoIndexJobsByIDsFuncCall { +func (f *StoreSetRerunAutoIndexJobsFunc) History() []StoreSetRerunAutoIndexJobsFuncCall { f.mutex.Lock() - history := make([]StoreSetRerunAutoIndexJobsByIDsFuncCall, len(f.history)) + history := make([]StoreSetRerunAutoIndexJobsFuncCall, len(f.history)) copy(history, f.history) f.mutex.Unlock() return history } -// StoreSetRerunAutoIndexJobsByIDsFuncCall is an object that describes an -// invocation of method SetRerunAutoIndexJobsByIDs on an instance of +// StoreSetRerunAutoIndexJobsFuncCall is an object that describes an +// invocation of method SetRerunAutoIndexJobs on an instance of // MockStore. -type StoreSetRerunAutoIndexJobsByIDsFuncCall struct { +type StoreSetRerunAutoIndexJobsFuncCall struct { // Arg0 is the value of the 1st argument passed to this method // invocation. Arg0 context.Context // Arg1 is the value of the 2nd argument passed to this method // invocation. - Arg1 shared.SetRerunAutoIndexJobsByIDsOptions + Arg1 shared.SetRerunAutoIndexJobsOptions // Result0 is the value of the 1st result returned from this method // invocation. Result0 error @@ -7110,13 +7110,13 @@ type StoreSetRerunAutoIndexJobsByIDsFuncCall struct { // Args returns an interface slice containing the arguments of this // invocation. -func (c StoreSetRerunAutoIndexJobsByIDsFuncCall) Args() []interface{} { +func (c StoreSetRerunAutoIndexJobsFuncCall) Args() []interface{} { return []interface{}{c.Arg0, c.Arg1} } // Results returns an interface slice containing the results of this // invocation. -func (c StoreSetRerunAutoIndexJobsByIDsFuncCall) Results() []interface{} { +func (c StoreSetRerunAutoIndexJobsFuncCall) Results() []interface{} { return []interface{}{c.Result0} } diff --git a/internal/codeintel/uploads/internal/background/expirer/mocks_test.go b/internal/codeintel/uploads/internal/background/expirer/mocks_test.go index 8747ea6b6c0..1513877b537 100644 --- a/internal/codeintel/uploads/internal/background/expirer/mocks_test.go +++ b/internal/codeintel/uploads/internal/background/expirer/mocks_test.go @@ -548,10 +548,10 @@ type MockStore struct { // SetRerunAutoIndexJobByIDFunc is an instance of a mock function object // controlling the behavior of the method SetRerunAutoIndexJobByID. SetRerunAutoIndexJobByIDFunc *StoreSetRerunAutoIndexJobByIDFunc - // SetRerunAutoIndexJobsByIDsFunc is an instance of a mock function + // SetRerunAutoIndexJobsFunc is an instance of a mock function // object controlling the behavior of the method - // SetRerunAutoIndexJobsByIDs. - SetRerunAutoIndexJobsByIDsFunc *StoreSetRerunAutoIndexJobsByIDsFunc + // SetRerunAutoIndexJobs. + SetRerunAutoIndexJobsFunc *StoreSetRerunAutoIndexJobsFunc // SoftDeleteExpiredUploadsFunc is an instance of a mock function object // controlling the behavior of the method SoftDeleteExpiredUploads. SoftDeleteExpiredUploadsFunc *StoreSoftDeleteExpiredUploadsFunc @@ -856,8 +856,8 @@ func NewMockStore() *MockStore { return }, }, - SetRerunAutoIndexJobsByIDsFunc: &StoreSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: func(context.Context, shared1.SetRerunAutoIndexJobsByIDsOptions) (r0 error) { + SetRerunAutoIndexJobsFunc: &StoreSetRerunAutoIndexJobsFunc{ + defaultHook: func(context.Context, shared1.SetRerunAutoIndexJobsOptions) (r0 error) { return }, }, @@ -1183,9 +1183,9 @@ func NewStrictMockStore() *MockStore { panic("unexpected invocation of MockStore.SetRerunAutoIndexJobByID") }, }, - SetRerunAutoIndexJobsByIDsFunc: &StoreSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: func(context.Context, shared1.SetRerunAutoIndexJobsByIDsOptions) error { - panic("unexpected invocation of MockStore.SetRerunAutoIndexJobsByIDs") + SetRerunAutoIndexJobsFunc: &StoreSetRerunAutoIndexJobsFunc{ + defaultHook: func(context.Context, shared1.SetRerunAutoIndexJobsOptions) error { + panic("unexpected invocation of MockStore.SetRerunAutoIndexJobs") }, }, SoftDeleteExpiredUploadsFunc: &StoreSoftDeleteExpiredUploadsFunc{ @@ -1404,8 +1404,8 @@ func NewMockStoreFrom(i store.Store) *MockStore { SetRerunAutoIndexJobByIDFunc: &StoreSetRerunAutoIndexJobByIDFunc{ defaultHook: i.SetRerunAutoIndexJobByID, }, - SetRerunAutoIndexJobsByIDsFunc: &StoreSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: i.SetRerunAutoIndexJobsByIDs, + SetRerunAutoIndexJobsFunc: &StoreSetRerunAutoIndexJobsFunc{ + defaultHook: i.SetRerunAutoIndexJobs, }, SoftDeleteExpiredUploadsFunc: &StoreSoftDeleteExpiredUploadsFunc{ defaultHook: i.SoftDeleteExpiredUploads, @@ -7355,37 +7355,37 @@ func (c StoreSetRerunAutoIndexJobByIDFuncCall) Results() []interface{} { return []interface{}{c.Result0} } -// StoreSetRerunAutoIndexJobsByIDsFunc describes the behavior when the -// SetRerunAutoIndexJobsByIDs method of the parent MockStore instance is +// StoreSetRerunAutoIndexJobsFunc describes the behavior when the +// SetRerunAutoIndexJobs method of the parent MockStore instance is // invoked. -type StoreSetRerunAutoIndexJobsByIDsFunc struct { - defaultHook func(context.Context, shared1.SetRerunAutoIndexJobsByIDsOptions) error - hooks []func(context.Context, shared1.SetRerunAutoIndexJobsByIDsOptions) error - history []StoreSetRerunAutoIndexJobsByIDsFuncCall +type StoreSetRerunAutoIndexJobsFunc struct { + defaultHook func(context.Context, shared1.SetRerunAutoIndexJobsOptions) error + hooks []func(context.Context, shared1.SetRerunAutoIndexJobsOptions) error + history []StoreSetRerunAutoIndexJobsFuncCall mutex sync.Mutex } -// SetRerunAutoIndexJobsByIDs delegates to the next hook function in the +// SetRerunAutoIndexJobs delegates to the next hook function in the // queue and stores the parameter and result values of this invocation. -func (m *MockStore) SetRerunAutoIndexJobsByIDs(v0 context.Context, v1 shared1.SetRerunAutoIndexJobsByIDsOptions) error { - r0 := m.SetRerunAutoIndexJobsByIDsFunc.nextHook()(v0, v1) - m.SetRerunAutoIndexJobsByIDsFunc.appendCall(StoreSetRerunAutoIndexJobsByIDsFuncCall{v0, v1, r0}) +func (m *MockStore) SetRerunAutoIndexJobs(v0 context.Context, v1 shared1.SetRerunAutoIndexJobsOptions) error { + r0 := m.SetRerunAutoIndexJobsFunc.nextHook()(v0, v1) + m.SetRerunAutoIndexJobsFunc.appendCall(StoreSetRerunAutoIndexJobsFuncCall{v0, v1, r0}) return r0 } // SetDefaultHook sets function that is called when the -// SetRerunAutoIndexJobsByIDs method of the parent MockStore instance is +// SetRerunAutoIndexJobs method of the parent MockStore instance is // invoked and the hook queue is empty. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) SetDefaultHook(hook func(context.Context, shared1.SetRerunAutoIndexJobsByIDsOptions) error) { +func (f *StoreSetRerunAutoIndexJobsFunc) SetDefaultHook(hook func(context.Context, shared1.SetRerunAutoIndexJobsOptions) error) { f.defaultHook = hook } // PushHook adds a function to the end of hook queue. Each invocation of the -// SetRerunAutoIndexJobsByIDs method of the parent MockStore instance +// SetRerunAutoIndexJobs method of the parent MockStore instance // invokes the hook at the front of the queue and discards it. After the // queue is empty, the default hook function is invoked for any future // action. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) PushHook(hook func(context.Context, shared1.SetRerunAutoIndexJobsByIDsOptions) error) { +func (f *StoreSetRerunAutoIndexJobsFunc) PushHook(hook func(context.Context, shared1.SetRerunAutoIndexJobsOptions) error) { f.mutex.Lock() f.hooks = append(f.hooks, hook) f.mutex.Unlock() @@ -7393,20 +7393,20 @@ func (f *StoreSetRerunAutoIndexJobsByIDsFunc) PushHook(hook func(context.Context // SetDefaultReturn calls SetDefaultHook with a function that returns the // given values. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) SetDefaultReturn(r0 error) { - f.SetDefaultHook(func(context.Context, shared1.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *StoreSetRerunAutoIndexJobsFunc) SetDefaultReturn(r0 error) { + f.SetDefaultHook(func(context.Context, shared1.SetRerunAutoIndexJobsOptions) error { return r0 }) } // PushReturn calls PushHook with a function that returns the given values. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) PushReturn(r0 error) { - f.PushHook(func(context.Context, shared1.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *StoreSetRerunAutoIndexJobsFunc) PushReturn(r0 error) { + f.PushHook(func(context.Context, shared1.SetRerunAutoIndexJobsOptions) error { return r0 }) } -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) nextHook() func(context.Context, shared1.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *StoreSetRerunAutoIndexJobsFunc) nextHook() func(context.Context, shared1.SetRerunAutoIndexJobsOptions) error { f.mutex.Lock() defer f.mutex.Unlock() @@ -7419,33 +7419,33 @@ func (f *StoreSetRerunAutoIndexJobsByIDsFunc) nextHook() func(context.Context, s return hook } -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) appendCall(r0 StoreSetRerunAutoIndexJobsByIDsFuncCall) { +func (f *StoreSetRerunAutoIndexJobsFunc) appendCall(r0 StoreSetRerunAutoIndexJobsFuncCall) { f.mutex.Lock() f.history = append(f.history, r0) f.mutex.Unlock() } -// History returns a sequence of StoreSetRerunAutoIndexJobsByIDsFuncCall +// History returns a sequence of StoreSetRerunAutoIndexJobsFuncCall // objects describing the invocations of this function. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) History() []StoreSetRerunAutoIndexJobsByIDsFuncCall { +func (f *StoreSetRerunAutoIndexJobsFunc) History() []StoreSetRerunAutoIndexJobsFuncCall { f.mutex.Lock() - history := make([]StoreSetRerunAutoIndexJobsByIDsFuncCall, len(f.history)) + history := make([]StoreSetRerunAutoIndexJobsFuncCall, len(f.history)) copy(history, f.history) f.mutex.Unlock() return history } -// StoreSetRerunAutoIndexJobsByIDsFuncCall is an object that describes an -// invocation of method SetRerunAutoIndexJobsByIDs on an instance of +// StoreSetRerunAutoIndexJobsFuncCall is an object that describes an +// invocation of method SetRerunAutoIndexJobs on an instance of // MockStore. -type StoreSetRerunAutoIndexJobsByIDsFuncCall struct { +type StoreSetRerunAutoIndexJobsFuncCall struct { // Arg0 is the value of the 1st argument passed to this method // invocation. Arg0 context.Context // Arg1 is the value of the 2nd argument passed to this method // invocation. - Arg1 shared1.SetRerunAutoIndexJobsByIDsOptions + Arg1 shared1.SetRerunAutoIndexJobsOptions // Result0 is the value of the 1st result returned from this method // invocation. Result0 error @@ -7453,13 +7453,13 @@ type StoreSetRerunAutoIndexJobsByIDsFuncCall struct { // Args returns an interface slice containing the arguments of this // invocation. -func (c StoreSetRerunAutoIndexJobsByIDsFuncCall) Args() []interface{} { +func (c StoreSetRerunAutoIndexJobsFuncCall) Args() []interface{} { return []interface{}{c.Arg0, c.Arg1} } // Results returns an interface slice containing the results of this // invocation. -func (c StoreSetRerunAutoIndexJobsByIDsFuncCall) Results() []interface{} { +func (c StoreSetRerunAutoIndexJobsFuncCall) Results() []interface{} { return []interface{}{c.Result0} } diff --git a/internal/codeintel/uploads/internal/background/processor/mocks_test.go b/internal/codeintel/uploads/internal/background/processor/mocks_test.go index 41977095501..ae59df862e1 100644 --- a/internal/codeintel/uploads/internal/background/processor/mocks_test.go +++ b/internal/codeintel/uploads/internal/background/processor/mocks_test.go @@ -362,10 +362,10 @@ type MockStore struct { // SetRerunAutoIndexJobByIDFunc is an instance of a mock function object // controlling the behavior of the method SetRerunAutoIndexJobByID. SetRerunAutoIndexJobByIDFunc *StoreSetRerunAutoIndexJobByIDFunc - // SetRerunAutoIndexJobsByIDsFunc is an instance of a mock function + // SetRerunAutoIndexJobsFunc is an instance of a mock function // object controlling the behavior of the method - // SetRerunAutoIndexJobsByIDs. - SetRerunAutoIndexJobsByIDsFunc *StoreSetRerunAutoIndexJobsByIDsFunc + // SetRerunAutoIndexJobs. + SetRerunAutoIndexJobsFunc *StoreSetRerunAutoIndexJobsFunc // SoftDeleteExpiredUploadsFunc is an instance of a mock function object // controlling the behavior of the method SoftDeleteExpiredUploads. SoftDeleteExpiredUploadsFunc *StoreSoftDeleteExpiredUploadsFunc @@ -670,8 +670,8 @@ func NewMockStore() *MockStore { return }, }, - SetRerunAutoIndexJobsByIDsFunc: &StoreSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) (r0 error) { + SetRerunAutoIndexJobsFunc: &StoreSetRerunAutoIndexJobsFunc{ + defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsOptions) (r0 error) { return }, }, @@ -997,9 +997,9 @@ func NewStrictMockStore() *MockStore { panic("unexpected invocation of MockStore.SetRerunAutoIndexJobByID") }, }, - SetRerunAutoIndexJobsByIDsFunc: &StoreSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { - panic("unexpected invocation of MockStore.SetRerunAutoIndexJobsByIDs") + SetRerunAutoIndexJobsFunc: &StoreSetRerunAutoIndexJobsFunc{ + defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { + panic("unexpected invocation of MockStore.SetRerunAutoIndexJobs") }, }, SoftDeleteExpiredUploadsFunc: &StoreSoftDeleteExpiredUploadsFunc{ @@ -1218,8 +1218,8 @@ func NewMockStoreFrom(i store.Store) *MockStore { SetRerunAutoIndexJobByIDFunc: &StoreSetRerunAutoIndexJobByIDFunc{ defaultHook: i.SetRerunAutoIndexJobByID, }, - SetRerunAutoIndexJobsByIDsFunc: &StoreSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: i.SetRerunAutoIndexJobsByIDs, + SetRerunAutoIndexJobsFunc: &StoreSetRerunAutoIndexJobsFunc{ + defaultHook: i.SetRerunAutoIndexJobs, }, SoftDeleteExpiredUploadsFunc: &StoreSoftDeleteExpiredUploadsFunc{ defaultHook: i.SoftDeleteExpiredUploads, @@ -7169,37 +7169,37 @@ func (c StoreSetRerunAutoIndexJobByIDFuncCall) Results() []interface{} { return []interface{}{c.Result0} } -// StoreSetRerunAutoIndexJobsByIDsFunc describes the behavior when the -// SetRerunAutoIndexJobsByIDs method of the parent MockStore instance is +// StoreSetRerunAutoIndexJobsFunc describes the behavior when the +// SetRerunAutoIndexJobs method of the parent MockStore instance is // invoked. -type StoreSetRerunAutoIndexJobsByIDsFunc struct { - defaultHook func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error - hooks []func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error - history []StoreSetRerunAutoIndexJobsByIDsFuncCall +type StoreSetRerunAutoIndexJobsFunc struct { + defaultHook func(context.Context, shared.SetRerunAutoIndexJobsOptions) error + hooks []func(context.Context, shared.SetRerunAutoIndexJobsOptions) error + history []StoreSetRerunAutoIndexJobsFuncCall mutex sync.Mutex } -// SetRerunAutoIndexJobsByIDs delegates to the next hook function in the +// SetRerunAutoIndexJobs delegates to the next hook function in the // queue and stores the parameter and result values of this invocation. -func (m *MockStore) SetRerunAutoIndexJobsByIDs(v0 context.Context, v1 shared.SetRerunAutoIndexJobsByIDsOptions) error { - r0 := m.SetRerunAutoIndexJobsByIDsFunc.nextHook()(v0, v1) - m.SetRerunAutoIndexJobsByIDsFunc.appendCall(StoreSetRerunAutoIndexJobsByIDsFuncCall{v0, v1, r0}) +func (m *MockStore) SetRerunAutoIndexJobs(v0 context.Context, v1 shared.SetRerunAutoIndexJobsOptions) error { + r0 := m.SetRerunAutoIndexJobsFunc.nextHook()(v0, v1) + m.SetRerunAutoIndexJobsFunc.appendCall(StoreSetRerunAutoIndexJobsFuncCall{v0, v1, r0}) return r0 } // SetDefaultHook sets function that is called when the -// SetRerunAutoIndexJobsByIDs method of the parent MockStore instance is +// SetRerunAutoIndexJobs method of the parent MockStore instance is // invoked and the hook queue is empty. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) SetDefaultHook(hook func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error) { +func (f *StoreSetRerunAutoIndexJobsFunc) SetDefaultHook(hook func(context.Context, shared.SetRerunAutoIndexJobsOptions) error) { f.defaultHook = hook } // PushHook adds a function to the end of hook queue. Each invocation of the -// SetRerunAutoIndexJobsByIDs method of the parent MockStore instance +// SetRerunAutoIndexJobs method of the parent MockStore instance // invokes the hook at the front of the queue and discards it. After the // queue is empty, the default hook function is invoked for any future // action. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) PushHook(hook func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error) { +func (f *StoreSetRerunAutoIndexJobsFunc) PushHook(hook func(context.Context, shared.SetRerunAutoIndexJobsOptions) error) { f.mutex.Lock() f.hooks = append(f.hooks, hook) f.mutex.Unlock() @@ -7207,20 +7207,20 @@ func (f *StoreSetRerunAutoIndexJobsByIDsFunc) PushHook(hook func(context.Context // SetDefaultReturn calls SetDefaultHook with a function that returns the // given values. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) SetDefaultReturn(r0 error) { - f.SetDefaultHook(func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *StoreSetRerunAutoIndexJobsFunc) SetDefaultReturn(r0 error) { + f.SetDefaultHook(func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { return r0 }) } // PushReturn calls PushHook with a function that returns the given values. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) PushReturn(r0 error) { - f.PushHook(func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *StoreSetRerunAutoIndexJobsFunc) PushReturn(r0 error) { + f.PushHook(func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { return r0 }) } -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) nextHook() func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *StoreSetRerunAutoIndexJobsFunc) nextHook() func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { f.mutex.Lock() defer f.mutex.Unlock() @@ -7233,33 +7233,33 @@ func (f *StoreSetRerunAutoIndexJobsByIDsFunc) nextHook() func(context.Context, s return hook } -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) appendCall(r0 StoreSetRerunAutoIndexJobsByIDsFuncCall) { +func (f *StoreSetRerunAutoIndexJobsFunc) appendCall(r0 StoreSetRerunAutoIndexJobsFuncCall) { f.mutex.Lock() f.history = append(f.history, r0) f.mutex.Unlock() } -// History returns a sequence of StoreSetRerunAutoIndexJobsByIDsFuncCall +// History returns a sequence of StoreSetRerunAutoIndexJobsFuncCall // objects describing the invocations of this function. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) History() []StoreSetRerunAutoIndexJobsByIDsFuncCall { +func (f *StoreSetRerunAutoIndexJobsFunc) History() []StoreSetRerunAutoIndexJobsFuncCall { f.mutex.Lock() - history := make([]StoreSetRerunAutoIndexJobsByIDsFuncCall, len(f.history)) + history := make([]StoreSetRerunAutoIndexJobsFuncCall, len(f.history)) copy(history, f.history) f.mutex.Unlock() return history } -// StoreSetRerunAutoIndexJobsByIDsFuncCall is an object that describes an -// invocation of method SetRerunAutoIndexJobsByIDs on an instance of +// StoreSetRerunAutoIndexJobsFuncCall is an object that describes an +// invocation of method SetRerunAutoIndexJobs on an instance of // MockStore. -type StoreSetRerunAutoIndexJobsByIDsFuncCall struct { +type StoreSetRerunAutoIndexJobsFuncCall struct { // Arg0 is the value of the 1st argument passed to this method // invocation. Arg0 context.Context // Arg1 is the value of the 2nd argument passed to this method // invocation. - Arg1 shared.SetRerunAutoIndexJobsByIDsOptions + Arg1 shared.SetRerunAutoIndexJobsOptions // Result0 is the value of the 1st result returned from this method // invocation. Result0 error @@ -7267,13 +7267,13 @@ type StoreSetRerunAutoIndexJobsByIDsFuncCall struct { // Args returns an interface slice containing the arguments of this // invocation. -func (c StoreSetRerunAutoIndexJobsByIDsFuncCall) Args() []interface{} { +func (c StoreSetRerunAutoIndexJobsFuncCall) Args() []interface{} { return []interface{}{c.Arg0, c.Arg1} } // Results returns an interface slice containing the results of this // invocation. -func (c StoreSetRerunAutoIndexJobsByIDsFuncCall) Results() []interface{} { +func (c StoreSetRerunAutoIndexJobsFuncCall) Results() []interface{} { return []interface{}{c.Result0} } diff --git a/internal/codeintel/uploads/internal/store/indexes.go b/internal/codeintel/uploads/internal/store/indexes.go index 6ac2a23795f..0cf92a0f489 100644 --- a/internal/codeintel/uploads/internal/store/indexes.go +++ b/internal/codeintel/uploads/internal/store/indexes.go @@ -18,7 +18,7 @@ import ( // GetIndexes returns a list of indexes and the total count of records matching the given conditions. func (s *store) GetAutoIndexJobs(ctx context.Context, opts shared.GetIndexesOptions) (_ []shared.AutoIndexJob, _ int, err error) { - ctx, trace, endObservation := s.operations.getIndexes.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ + ctx, trace, endObservation := s.operations.getAutoIndexJobs.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ attribute.Int("repositoryID", opts.RepositoryID), attribute.String("state", opts.State), attribute.String("term", opts.Term), @@ -185,7 +185,7 @@ func scanJob(s dbutil.Scanner) (index shared.AutoIndexJob, err error) { // GetAutoIndexJobByID returns an index by its identifier and boolean flag indicating its existence. func (s *store) GetAutoIndexJobByID(ctx context.Context, id int) (_ shared.AutoIndexJob, _ bool, err error) { - ctx, _, endObservation := s.operations.getIndexByID.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ + ctx, _, endObservation := s.operations.getAutoIndexJobByID.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ attribute.Int("id", id), }}) defer endObservation(1, observation.Args{}) @@ -234,7 +234,7 @@ WHERE repo.deleted_at IS NULL AND u.id = %s AND %s // GetAutoIndexJobsByIDs returns an index for each of the given identifiers. Not all given ids will necessarily // have a corresponding element in the returned list. func (s *store) GetAutoIndexJobsByIDs(ctx context.Context, ids ...int) (_ []shared.AutoIndexJob, err error) { - ctx, _, endObservation := s.operations.getIndexesByIDs.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ + ctx, _, endObservation := s.operations.getAutoIndexJobsByIDs.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ attribute.IntSlice("ids", ids), }}) defer endObservation(1, observation.Args{}) @@ -292,7 +292,7 @@ ORDER BY u.id // DeleteAutoIndexJobByID deletes an index by its identifier. func (s *store) DeleteAutoIndexJobByID(ctx context.Context, id int) (_ bool, err error) { - ctx, _, endObservation := s.operations.deleteIndexByID.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ + ctx, _, endObservation := s.operations.deleteAutoIndexJobByID.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ attribute.Int("id", id), }}) defer endObservation(1, observation.Args{}) @@ -307,7 +307,7 @@ DELETE FROM lsif_indexes WHERE id = %s RETURNING repository_id // DeleteAutoIndexJobs deletes indexes matching the given filter criteria. func (s *store) DeleteAutoIndexJobs(ctx context.Context, opts shared.DeleteAutoIndexJobsOptions) (err error) { - ctx, _, endObservation := s.operations.deleteIndexes.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ + ctx, _, endObservation := s.operations.deleteAutoIndexJobs.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ attribute.Int("repositoryID", opts.RepositoryID), attribute.StringSlice("states", opts.States), attribute.String("term", opts.Term), @@ -359,7 +359,7 @@ WHERE u.repository_id = repo.id AND %s // SetRerunAutoIndexJobByID reindexes an index by its identifier. func (s *store) SetRerunAutoIndexJobByID(ctx context.Context, id int) (err error) { - ctx, _, endObservation := s.operations.reindexIndexByID.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ + ctx, _, endObservation := s.operations.setRerunAutoIndexJobByID.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ attribute.Int("id", id), }}) defer endObservation(1, observation.Args{}) @@ -373,9 +373,9 @@ SET should_reindex = true WHERE id = %s ` -// SetRerunAutoIndexJobsByIDs reindexes indexes matching the given filter criteria. -func (s *store) SetRerunAutoIndexJobsByIDs(ctx context.Context, opts shared.SetRerunAutoIndexJobsByIDsOptions) (err error) { - ctx, _, endObservation := s.operations.reindexIndexes.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ +// SetRerunAutoIndexJobs reindexes indexes matching the given filter criteria. +func (s *store) SetRerunAutoIndexJobs(ctx context.Context, opts shared.SetRerunAutoIndexJobsOptions) (err error) { + ctx, _, endObservation := s.operations.setRerunAutoIndexJobs.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{ attribute.Int("repositoryID", opts.RepositoryID), attribute.StringSlice("states", opts.States), attribute.String("term", opts.Term), diff --git a/internal/codeintel/uploads/internal/store/indexes_test.go b/internal/codeintel/uploads/internal/store/indexes_test.go index 4a34a4c24cc..59828e50455 100644 --- a/internal/codeintel/uploads/internal/store/indexes_test.go +++ b/internal/codeintel/uploads/internal/store/indexes_test.go @@ -460,7 +460,7 @@ func TestSetRerunAutoIndexJobByID(t *testing.T) { } } -func TestSetRerunAutoIndexJobsByIDs(t *testing.T) { +func TestSetRerunAutoIndexJobs(t *testing.T) { logger := logtest.Scoped(t) db := database.NewDB(logger, dbtest.NewDB(t)) store := New(observation.TestContextTB(t), db) @@ -468,7 +468,7 @@ func TestSetRerunAutoIndexJobsByIDs(t *testing.T) { insertAutoIndexJobs(t, db, uploadsshared.AutoIndexJob{ID: 1, State: "completed"}) insertAutoIndexJobs(t, db, uploadsshared.AutoIndexJob{ID: 2, State: "errored"}) - if err := store.SetRerunAutoIndexJobsByIDs(context.Background(), shared.SetRerunAutoIndexJobsByIDsOptions{ + if err := store.SetRerunAutoIndexJobs(context.Background(), shared.SetRerunAutoIndexJobsOptions{ States: []string{"errored"}, Term: "", RepositoryID: 0, @@ -486,7 +486,7 @@ func TestSetRerunAutoIndexJobsByIDs(t *testing.T) { } } -func TestSetRerunAutoIndexJobsByIDsWithIndexerKey(t *testing.T) { +func TestSetRerunAutoIndexJobsWithIndexerKey(t *testing.T) { logger := logtest.Scoped(t) db := database.NewDB(logger, dbtest.NewDB(t)) store := New(observation.TestContextTB(t), db) @@ -496,7 +496,7 @@ func TestSetRerunAutoIndexJobsByIDsWithIndexerKey(t *testing.T) { insertAutoIndexJobs(t, db, uploadsshared.AutoIndexJob{ID: 3, Indexer: "sourcegraph/scip-typescript"}) insertAutoIndexJobs(t, db, uploadsshared.AutoIndexJob{ID: 4, Indexer: "sourcegraph/scip-typescript"}) - if err := store.SetRerunAutoIndexJobsByIDs(context.Background(), shared.SetRerunAutoIndexJobsByIDsOptions{ + if err := store.SetRerunAutoIndexJobs(context.Background(), shared.SetRerunAutoIndexJobsOptions{ IndexerNames: []string{"scip-go"}, Term: "", RepositoryID: 0, diff --git a/internal/codeintel/uploads/internal/store/observability.go b/internal/codeintel/uploads/internal/store/observability.go index f8bb0664d0c..fff6da96902 100644 --- a/internal/codeintel/uploads/internal/store/observability.go +++ b/internal/codeintel/uploads/internal/store/observability.go @@ -85,13 +85,13 @@ type operations struct { reindexUploadByID *observation.Operation deleteIndexesWithoutRepository *observation.Operation - getIndexes *observation.Operation - getIndexByID *observation.Operation - getIndexesByIDs *observation.Operation - deleteIndexByID *observation.Operation - deleteIndexes *observation.Operation - reindexIndexByID *observation.Operation - reindexIndexes *observation.Operation + getAutoIndexJobs *observation.Operation + getAutoIndexJobByID *observation.Operation + getAutoIndexJobsByIDs *observation.Operation + deleteAutoIndexJobByID *observation.Operation + deleteAutoIndexJobs *observation.Operation + setRerunAutoIndexJobByID *observation.Operation + setRerunAutoIndexJobs *observation.Operation processStaleSourcedCommits *observation.Operation expireFailedRecords *observation.Operation } @@ -192,13 +192,13 @@ func newOperations(observationCtx *observation.Context) *operations { reindexUploadByID: op("ReindexUploadByID"), deleteIndexesWithoutRepository: op("DeleteAutoIndexJobsWithoutRepository"), - getIndexes: op("GetAutoIndexJobs"), - getIndexByID: op("GetAutoIndexJobByID"), - getIndexesByIDs: op("GetAutoIndexJobsByIDs"), - deleteIndexByID: op("DeleteAutoIndexJobByID"), - deleteIndexes: op("DeleteAutoIndexJobs"), - reindexIndexByID: op("SetRerunAutoIndexJobByID"), - reindexIndexes: op("SetRerunAutoIndexJobsByIDs"), + getAutoIndexJobs: op("GetAutoIndexJobs"), + getAutoIndexJobByID: op("GetAutoIndexJobByID"), + getAutoIndexJobsByIDs: op("GetAutoIndexJobsByIDs"), + deleteAutoIndexJobByID: op("DeleteAutoIndexJobByID"), + deleteAutoIndexJobs: op("DeleteAutoIndexJobs"), + setRerunAutoIndexJobByID: op("SetRerunAutoIndexJobByID"), + setRerunAutoIndexJobs: op("SetRerunAutoIndexJobs"), processStaleSourcedCommits: op("ProcessStaleSourcedCommits"), expireFailedRecords: op("ExpireFailedRecords"), repositoryIDsWithErrors: op("RepositoryIDsWithErrors"), diff --git a/internal/codeintel/uploads/internal/store/store.go b/internal/codeintel/uploads/internal/store/store.go index b52d39e27f3..af895cea26d 100644 --- a/internal/codeintel/uploads/internal/store/store.go +++ b/internal/codeintel/uploads/internal/store/store.go @@ -44,7 +44,7 @@ type Store interface { DeleteAutoIndexJobByID(ctx context.Context, id int) (bool, error) DeleteAutoIndexJobs(ctx context.Context, opts shared.DeleteAutoIndexJobsOptions) error SetRerunAutoIndexJobByID(ctx context.Context, id int) error - SetRerunAutoIndexJobsByIDs(ctx context.Context, opts shared.SetRerunAutoIndexJobsByIDsOptions) error + SetRerunAutoIndexJobs(ctx context.Context, opts shared.SetRerunAutoIndexJobsOptions) error // Upload record insertion + processing InsertUpload(ctx context.Context, upload shared.Upload) (int, error) diff --git a/internal/codeintel/uploads/mocks_test.go b/internal/codeintel/uploads/mocks_test.go index abbb9407da8..0b518e3b127 100644 --- a/internal/codeintel/uploads/mocks_test.go +++ b/internal/codeintel/uploads/mocks_test.go @@ -211,10 +211,10 @@ type MockStore struct { // SetRerunAutoIndexJobByIDFunc is an instance of a mock function object // controlling the behavior of the method SetRerunAutoIndexJobByID. SetRerunAutoIndexJobByIDFunc *StoreSetRerunAutoIndexJobByIDFunc - // SetRerunAutoIndexJobsByIDsFunc is an instance of a mock function + // SetRerunAutoIndexJobsFunc is an instance of a mock function // object controlling the behavior of the method - // SetRerunAutoIndexJobsByIDs. - SetRerunAutoIndexJobsByIDsFunc *StoreSetRerunAutoIndexJobsByIDsFunc + // SetRerunAutoIndexJobs. + SetRerunAutoIndexJobsFunc *StoreSetRerunAutoIndexJobsFunc // SoftDeleteExpiredUploadsFunc is an instance of a mock function object // controlling the behavior of the method SoftDeleteExpiredUploads. SoftDeleteExpiredUploadsFunc *StoreSoftDeleteExpiredUploadsFunc @@ -519,8 +519,8 @@ func NewMockStore() *MockStore { return }, }, - SetRerunAutoIndexJobsByIDsFunc: &StoreSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) (r0 error) { + SetRerunAutoIndexJobsFunc: &StoreSetRerunAutoIndexJobsFunc{ + defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsOptions) (r0 error) { return }, }, @@ -846,9 +846,9 @@ func NewStrictMockStore() *MockStore { panic("unexpected invocation of MockStore.SetRerunAutoIndexJobByID") }, }, - SetRerunAutoIndexJobsByIDsFunc: &StoreSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { - panic("unexpected invocation of MockStore.SetRerunAutoIndexJobsByIDs") + SetRerunAutoIndexJobsFunc: &StoreSetRerunAutoIndexJobsFunc{ + defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { + panic("unexpected invocation of MockStore.SetRerunAutoIndexJobs") }, }, SoftDeleteExpiredUploadsFunc: &StoreSoftDeleteExpiredUploadsFunc{ @@ -1067,8 +1067,8 @@ func NewMockStoreFrom(i store.Store) *MockStore { SetRerunAutoIndexJobByIDFunc: &StoreSetRerunAutoIndexJobByIDFunc{ defaultHook: i.SetRerunAutoIndexJobByID, }, - SetRerunAutoIndexJobsByIDsFunc: &StoreSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: i.SetRerunAutoIndexJobsByIDs, + SetRerunAutoIndexJobsFunc: &StoreSetRerunAutoIndexJobsFunc{ + defaultHook: i.SetRerunAutoIndexJobs, }, SoftDeleteExpiredUploadsFunc: &StoreSoftDeleteExpiredUploadsFunc{ defaultHook: i.SoftDeleteExpiredUploads, @@ -7018,37 +7018,37 @@ func (c StoreSetRerunAutoIndexJobByIDFuncCall) Results() []interface{} { return []interface{}{c.Result0} } -// StoreSetRerunAutoIndexJobsByIDsFunc describes the behavior when the -// SetRerunAutoIndexJobsByIDs method of the parent MockStore instance is +// StoreSetRerunAutoIndexJobsFunc describes the behavior when the +// SetRerunAutoIndexJobs method of the parent MockStore instance is // invoked. -type StoreSetRerunAutoIndexJobsByIDsFunc struct { - defaultHook func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error - hooks []func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error - history []StoreSetRerunAutoIndexJobsByIDsFuncCall +type StoreSetRerunAutoIndexJobsFunc struct { + defaultHook func(context.Context, shared.SetRerunAutoIndexJobsOptions) error + hooks []func(context.Context, shared.SetRerunAutoIndexJobsOptions) error + history []StoreSetRerunAutoIndexJobsFuncCall mutex sync.Mutex } -// SetRerunAutoIndexJobsByIDs delegates to the next hook function in the +// SetRerunAutoIndexJobs delegates to the next hook function in the // queue and stores the parameter and result values of this invocation. -func (m *MockStore) SetRerunAutoIndexJobsByIDs(v0 context.Context, v1 shared.SetRerunAutoIndexJobsByIDsOptions) error { - r0 := m.SetRerunAutoIndexJobsByIDsFunc.nextHook()(v0, v1) - m.SetRerunAutoIndexJobsByIDsFunc.appendCall(StoreSetRerunAutoIndexJobsByIDsFuncCall{v0, v1, r0}) +func (m *MockStore) SetRerunAutoIndexJobs(v0 context.Context, v1 shared.SetRerunAutoIndexJobsOptions) error { + r0 := m.SetRerunAutoIndexJobsFunc.nextHook()(v0, v1) + m.SetRerunAutoIndexJobsFunc.appendCall(StoreSetRerunAutoIndexJobsFuncCall{v0, v1, r0}) return r0 } // SetDefaultHook sets function that is called when the -// SetRerunAutoIndexJobsByIDs method of the parent MockStore instance is +// SetRerunAutoIndexJobs method of the parent MockStore instance is // invoked and the hook queue is empty. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) SetDefaultHook(hook func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error) { +func (f *StoreSetRerunAutoIndexJobsFunc) SetDefaultHook(hook func(context.Context, shared.SetRerunAutoIndexJobsOptions) error) { f.defaultHook = hook } // PushHook adds a function to the end of hook queue. Each invocation of the -// SetRerunAutoIndexJobsByIDs method of the parent MockStore instance +// SetRerunAutoIndexJobs method of the parent MockStore instance // invokes the hook at the front of the queue and discards it. After the // queue is empty, the default hook function is invoked for any future // action. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) PushHook(hook func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error) { +func (f *StoreSetRerunAutoIndexJobsFunc) PushHook(hook func(context.Context, shared.SetRerunAutoIndexJobsOptions) error) { f.mutex.Lock() f.hooks = append(f.hooks, hook) f.mutex.Unlock() @@ -7056,20 +7056,20 @@ func (f *StoreSetRerunAutoIndexJobsByIDsFunc) PushHook(hook func(context.Context // SetDefaultReturn calls SetDefaultHook with a function that returns the // given values. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) SetDefaultReturn(r0 error) { - f.SetDefaultHook(func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *StoreSetRerunAutoIndexJobsFunc) SetDefaultReturn(r0 error) { + f.SetDefaultHook(func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { return r0 }) } // PushReturn calls PushHook with a function that returns the given values. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) PushReturn(r0 error) { - f.PushHook(func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *StoreSetRerunAutoIndexJobsFunc) PushReturn(r0 error) { + f.PushHook(func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { return r0 }) } -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) nextHook() func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *StoreSetRerunAutoIndexJobsFunc) nextHook() func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { f.mutex.Lock() defer f.mutex.Unlock() @@ -7082,33 +7082,33 @@ func (f *StoreSetRerunAutoIndexJobsByIDsFunc) nextHook() func(context.Context, s return hook } -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) appendCall(r0 StoreSetRerunAutoIndexJobsByIDsFuncCall) { +func (f *StoreSetRerunAutoIndexJobsFunc) appendCall(r0 StoreSetRerunAutoIndexJobsFuncCall) { f.mutex.Lock() f.history = append(f.history, r0) f.mutex.Unlock() } -// History returns a sequence of StoreSetRerunAutoIndexJobsByIDsFuncCall +// History returns a sequence of StoreSetRerunAutoIndexJobsFuncCall // objects describing the invocations of this function. -func (f *StoreSetRerunAutoIndexJobsByIDsFunc) History() []StoreSetRerunAutoIndexJobsByIDsFuncCall { +func (f *StoreSetRerunAutoIndexJobsFunc) History() []StoreSetRerunAutoIndexJobsFuncCall { f.mutex.Lock() - history := make([]StoreSetRerunAutoIndexJobsByIDsFuncCall, len(f.history)) + history := make([]StoreSetRerunAutoIndexJobsFuncCall, len(f.history)) copy(history, f.history) f.mutex.Unlock() return history } -// StoreSetRerunAutoIndexJobsByIDsFuncCall is an object that describes an -// invocation of method SetRerunAutoIndexJobsByIDs on an instance of +// StoreSetRerunAutoIndexJobsFuncCall is an object that describes an +// invocation of method SetRerunAutoIndexJobs on an instance of // MockStore. -type StoreSetRerunAutoIndexJobsByIDsFuncCall struct { +type StoreSetRerunAutoIndexJobsFuncCall struct { // Arg0 is the value of the 1st argument passed to this method // invocation. Arg0 context.Context // Arg1 is the value of the 2nd argument passed to this method // invocation. - Arg1 shared.SetRerunAutoIndexJobsByIDsOptions + Arg1 shared.SetRerunAutoIndexJobsOptions // Result0 is the value of the 1st result returned from this method // invocation. Result0 error @@ -7116,13 +7116,13 @@ type StoreSetRerunAutoIndexJobsByIDsFuncCall struct { // Args returns an interface slice containing the arguments of this // invocation. -func (c StoreSetRerunAutoIndexJobsByIDsFuncCall) Args() []interface{} { +func (c StoreSetRerunAutoIndexJobsFuncCall) Args() []interface{} { return []interface{}{c.Arg0, c.Arg1} } // Results returns an interface slice containing the results of this // invocation. -func (c StoreSetRerunAutoIndexJobsByIDsFuncCall) Results() []interface{} { +func (c StoreSetRerunAutoIndexJobsFuncCall) Results() []interface{} { return []interface{}{c.Result0} } diff --git a/internal/codeintel/uploads/service.go b/internal/codeintel/uploads/service.go index bafb59bf927..ed809b1cd1c 100644 --- a/internal/codeintel/uploads/service.go +++ b/internal/codeintel/uploads/service.go @@ -224,8 +224,8 @@ func (s *Service) SetRerunAutoIndexJobByID(ctx context.Context, id int) error { return s.store.SetRerunAutoIndexJobByID(ctx, id) } -func (s *Service) SetRerunAutoIndexJobsByIDs(ctx context.Context, opts shared.SetRerunAutoIndexJobsByIDsOptions) error { - return s.store.SetRerunAutoIndexJobsByIDs(ctx, opts) +func (s *Service) SetRerunAutoIndexJobs(ctx context.Context, opts shared.SetRerunAutoIndexJobsOptions) error { + return s.store.SetRerunAutoIndexJobs(ctx, opts) } func (s *Service) GetRecentIndexesSummary(ctx context.Context, repositoryID int) ([]uploadsshared.IndexesWithRepositoryNamespace, error) { diff --git a/internal/codeintel/uploads/shared/types.go b/internal/codeintel/uploads/shared/types.go index 44710e81f2d..79ceb7e918f 100644 --- a/internal/codeintel/uploads/shared/types.go +++ b/internal/codeintel/uploads/shared/types.go @@ -319,7 +319,7 @@ type DeleteAutoIndexJobsOptions struct { WithoutUpload bool } -type SetRerunAutoIndexJobsByIDsOptions struct { +type SetRerunAutoIndexJobsOptions struct { States []string IndexerNames []string Term string diff --git a/internal/codeintel/uploads/transport/graphql/iface.go b/internal/codeintel/uploads/transport/graphql/iface.go index 2d66acef84c..f1e169b4094 100644 --- a/internal/codeintel/uploads/transport/graphql/iface.go +++ b/internal/codeintel/uploads/transport/graphql/iface.go @@ -21,7 +21,7 @@ type UploadsService interface { DeleteAutoIndexJobByID(ctx context.Context, id int) (_ bool, err error) DeleteAutoIndexJobs(ctx context.Context, opts uploadshared.DeleteAutoIndexJobsOptions) (err error) SetRerunAutoIndexJobByID(ctx context.Context, id int) (err error) - SetRerunAutoIndexJobsByIDs(ctx context.Context, opts uploadshared.SetRerunAutoIndexJobsByIDsOptions) (err error) + SetRerunAutoIndexJobs(ctx context.Context, opts uploadshared.SetRerunAutoIndexJobsOptions) (err error) GetIndexers(ctx context.Context, opts uploadshared.GetIndexersOptions) ([]string, error) GetUploadByID(ctx context.Context, id int) (_ shared.Upload, _ bool, err error) DeleteUploadByID(ctx context.Context, id int) (_ bool, err error) diff --git a/internal/codeintel/uploads/transport/graphql/mocks_test.go b/internal/codeintel/uploads/transport/graphql/mocks_test.go index 0cb6a0dce40..055752ebfa4 100644 --- a/internal/codeintel/uploads/transport/graphql/mocks_test.go +++ b/internal/codeintel/uploads/transport/graphql/mocks_test.go @@ -75,9 +75,9 @@ type MockUploadsService struct { // SetRerunAutoIndexJobByIDFunc is an instance of a mock function object // controlling the behavior of the method SetRerunAutoIndexJobByID. SetRerunAutoIndexJobByIDFunc *UploadsServiceSetRerunAutoIndexJobByIDFunc - // SetRerunAutoIndexJobsByIDsFunc is an instance of a mock function object - // controlling the behavior of the method SetRerunAutoIndexJobsByIDs. - SetRerunAutoIndexJobsByIDsFunc *UploadsServiceSetRerunAutoIndexJobsByIDsFunc + // SetRerunAutoIndexJobsFunc is an instance of a mock function object + // controlling the behavior of the method SetRerunAutoIndexJobs. + SetRerunAutoIndexJobsFunc *UploadsServiceSetRerunAutoIndexJobsFunc // ReindexUploadByIDFunc is an instance of a mock function object // controlling the behavior of the method ReindexUploadByID. ReindexUploadByIDFunc *UploadsServiceReindexUploadByIDFunc @@ -183,8 +183,8 @@ func NewMockUploadsService() *MockUploadsService { return }, }, - SetRerunAutoIndexJobsByIDsFunc: &UploadsServiceSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) (r0 error) { + SetRerunAutoIndexJobsFunc: &UploadsServiceSetRerunAutoIndexJobsFunc{ + defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsOptions) (r0 error) { return }, }, @@ -300,9 +300,9 @@ func NewStrictMockUploadsService() *MockUploadsService { panic("unexpected invocation of MockUploadsService.SetRerunAutoIndexJobByID") }, }, - SetRerunAutoIndexJobsByIDsFunc: &UploadsServiceSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { - panic("unexpected invocation of MockUploadsService.SetRerunAutoIndexJobsByIDs") + SetRerunAutoIndexJobsFunc: &UploadsServiceSetRerunAutoIndexJobsFunc{ + defaultHook: func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { + panic("unexpected invocation of MockUploadsService.SetRerunAutoIndexJobs") }, }, ReindexUploadByIDFunc: &UploadsServiceReindexUploadByIDFunc{ @@ -382,8 +382,8 @@ func NewMockUploadsServiceFrom(i UploadsService) *MockUploadsService { SetRerunAutoIndexJobByIDFunc: &UploadsServiceSetRerunAutoIndexJobByIDFunc{ defaultHook: i.SetRerunAutoIndexJobByID, }, - SetRerunAutoIndexJobsByIDsFunc: &UploadsServiceSetRerunAutoIndexJobsByIDsFunc{ - defaultHook: i.SetRerunAutoIndexJobsByIDs, + SetRerunAutoIndexJobsFunc: &UploadsServiceSetRerunAutoIndexJobsFunc{ + defaultHook: i.SetRerunAutoIndexJobs, }, ReindexUploadByIDFunc: &UploadsServiceReindexUploadByIDFunc{ defaultHook: i.ReindexUploadByID, @@ -2397,36 +2397,36 @@ func (c UploadsServiceSetRerunAutoIndexJobByIDFuncCall) Results() []interface{} return []interface{}{c.Result0} } -// UploadsServiceSetRerunAutoIndexJobsByIDsFunc describes the behavior when the -// SetRerunAutoIndexJobsByIDs method of the parent MockUploadsService instance is +// UploadsServiceSetRerunAutoIndexJobsFunc describes the behavior when the +// SetRerunAutoIndexJobs method of the parent MockUploadsService instance is // invoked. -type UploadsServiceSetRerunAutoIndexJobsByIDsFunc struct { - defaultHook func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error - hooks []func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error - history []UploadsServiceSetRerunAutoIndexJobsByIDsFuncCall +type UploadsServiceSetRerunAutoIndexJobsFunc struct { + defaultHook func(context.Context, shared.SetRerunAutoIndexJobsOptions) error + hooks []func(context.Context, shared.SetRerunAutoIndexJobsOptions) error + history []UploadsServiceSetRerunAutoIndexJobsFuncCall mutex sync.Mutex } -// SetRerunAutoIndexJobsByIDs delegates to the next hook function in the queue and +// SetRerunAutoIndexJobs delegates to the next hook function in the queue and // stores the parameter and result values of this invocation. -func (m *MockUploadsService) SetRerunAutoIndexJobsByIDs(v0 context.Context, v1 shared.SetRerunAutoIndexJobsByIDsOptions) error { - r0 := m.SetRerunAutoIndexJobsByIDsFunc.nextHook()(v0, v1) - m.SetRerunAutoIndexJobsByIDsFunc.appendCall(UploadsServiceSetRerunAutoIndexJobsByIDsFuncCall{v0, v1, r0}) +func (m *MockUploadsService) SetRerunAutoIndexJobs(v0 context.Context, v1 shared.SetRerunAutoIndexJobsOptions) error { + r0 := m.SetRerunAutoIndexJobsFunc.nextHook()(v0, v1) + m.SetRerunAutoIndexJobsFunc.appendCall(UploadsServiceSetRerunAutoIndexJobsFuncCall{v0, v1, r0}) return r0 } -// SetDefaultHook sets function that is called when the SetRerunAutoIndexJobsByIDs +// SetDefaultHook sets function that is called when the SetRerunAutoIndexJobs // method of the parent MockUploadsService instance is invoked and the hook // queue is empty. -func (f *UploadsServiceSetRerunAutoIndexJobsByIDsFunc) SetDefaultHook(hook func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error) { +func (f *UploadsServiceSetRerunAutoIndexJobsFunc) SetDefaultHook(hook func(context.Context, shared.SetRerunAutoIndexJobsOptions) error) { f.defaultHook = hook } // PushHook adds a function to the end of hook queue. Each invocation of the -// SetRerunAutoIndexJobsByIDs method of the parent MockUploadsService instance invokes +// SetRerunAutoIndexJobs method of the parent MockUploadsService instance invokes // the hook at the front of the queue and discards it. After the queue is // empty, the default hook function is invoked for any future action. -func (f *UploadsServiceSetRerunAutoIndexJobsByIDsFunc) PushHook(hook func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error) { +func (f *UploadsServiceSetRerunAutoIndexJobsFunc) PushHook(hook func(context.Context, shared.SetRerunAutoIndexJobsOptions) error) { f.mutex.Lock() f.hooks = append(f.hooks, hook) f.mutex.Unlock() @@ -2434,20 +2434,20 @@ func (f *UploadsServiceSetRerunAutoIndexJobsByIDsFunc) PushHook(hook func(contex // SetDefaultReturn calls SetDefaultHook with a function that returns the // given values. -func (f *UploadsServiceSetRerunAutoIndexJobsByIDsFunc) SetDefaultReturn(r0 error) { - f.SetDefaultHook(func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *UploadsServiceSetRerunAutoIndexJobsFunc) SetDefaultReturn(r0 error) { + f.SetDefaultHook(func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { return r0 }) } // PushReturn calls PushHook with a function that returns the given values. -func (f *UploadsServiceSetRerunAutoIndexJobsByIDsFunc) PushReturn(r0 error) { - f.PushHook(func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *UploadsServiceSetRerunAutoIndexJobsFunc) PushReturn(r0 error) { + f.PushHook(func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { return r0 }) } -func (f *UploadsServiceSetRerunAutoIndexJobsByIDsFunc) nextHook() func(context.Context, shared.SetRerunAutoIndexJobsByIDsOptions) error { +func (f *UploadsServiceSetRerunAutoIndexJobsFunc) nextHook() func(context.Context, shared.SetRerunAutoIndexJobsOptions) error { f.mutex.Lock() defer f.mutex.Unlock() @@ -2460,32 +2460,32 @@ func (f *UploadsServiceSetRerunAutoIndexJobsByIDsFunc) nextHook() func(context.C return hook } -func (f *UploadsServiceSetRerunAutoIndexJobsByIDsFunc) appendCall(r0 UploadsServiceSetRerunAutoIndexJobsByIDsFuncCall) { +func (f *UploadsServiceSetRerunAutoIndexJobsFunc) appendCall(r0 UploadsServiceSetRerunAutoIndexJobsFuncCall) { f.mutex.Lock() f.history = append(f.history, r0) f.mutex.Unlock() } -// History returns a sequence of UploadsServiceSetRerunAutoIndexJobsByIDsFuncCall +// History returns a sequence of UploadsServiceSetRerunAutoIndexJobsFuncCall // objects describing the invocations of this function. -func (f *UploadsServiceSetRerunAutoIndexJobsByIDsFunc) History() []UploadsServiceSetRerunAutoIndexJobsByIDsFuncCall { +func (f *UploadsServiceSetRerunAutoIndexJobsFunc) History() []UploadsServiceSetRerunAutoIndexJobsFuncCall { f.mutex.Lock() - history := make([]UploadsServiceSetRerunAutoIndexJobsByIDsFuncCall, len(f.history)) + history := make([]UploadsServiceSetRerunAutoIndexJobsFuncCall, len(f.history)) copy(history, f.history) f.mutex.Unlock() return history } -// UploadsServiceSetRerunAutoIndexJobsByIDsFuncCall is an object that describes an -// invocation of method SetRerunAutoIndexJobsByIDs on an instance of MockUploadsService. -type UploadsServiceSetRerunAutoIndexJobsByIDsFuncCall struct { +// UploadsServiceSetRerunAutoIndexJobsFuncCall is an object that describes an +// invocation of method SetRerunAutoIndexJobs on an instance of MockUploadsService. +type UploadsServiceSetRerunAutoIndexJobsFuncCall struct { // Arg0 is the value of the 1st argument passed to this method // invocation. Arg0 context.Context // Arg1 is the value of the 2nd argument passed to this method // invocation. - Arg1 shared.SetRerunAutoIndexJobsByIDsOptions + Arg1 shared.SetRerunAutoIndexJobsOptions // Result0 is the value of the 1st result returned from this method // invocation. Result0 error @@ -2493,13 +2493,13 @@ type UploadsServiceSetRerunAutoIndexJobsByIDsFuncCall struct { // Args returns an interface slice containing the arguments of this // invocation. -func (c UploadsServiceSetRerunAutoIndexJobsByIDsFuncCall) Args() []interface{} { +func (c UploadsServiceSetRerunAutoIndexJobsFuncCall) Args() []interface{} { return []interface{}{c.Arg0, c.Arg1} } // Results returns an interface slice containing the results of this // invocation. -func (c UploadsServiceSetRerunAutoIndexJobsByIDsFuncCall) Results() []interface{} { +func (c UploadsServiceSetRerunAutoIndexJobsFuncCall) Results() []interface{} { return []interface{}{c.Result0} } diff --git a/internal/codeintel/uploads/transport/graphql/root_resolver_index_mutations.go b/internal/codeintel/uploads/transport/graphql/root_resolver_index_mutations.go index befd14e3c19..e1f8b02a26b 100644 --- a/internal/codeintel/uploads/transport/graphql/root_resolver_index_mutations.go +++ b/internal/codeintel/uploads/transport/graphql/root_resolver_index_mutations.go @@ -179,7 +179,7 @@ func (r *rootResolver) ReindexPreciseIndexes(ctx context.Context, args *resolver } } if !skipIndexes { - if err := r.uploadSvc.SetRerunAutoIndexJobsByIDs(ctx, uploadsshared.SetRerunAutoIndexJobsByIDsOptions{ + if err := r.uploadSvc.SetRerunAutoIndexJobs(ctx, uploadsshared.SetRerunAutoIndexJobsOptions{ States: indexStates, IndexerNames: indexerNames, Term: term,