Documentation
¶
Overview ¶
Package gopool is a generated GoMock package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job interface {
Do()
}
Job is an interface that specifies the function for a worker to execute.
type MockJob ¶
type MockJob struct {
// contains filtered or unexported fields
}
MockJob is a mock of Job interface.
func NewMockJob ¶
func NewMockJob(ctrl *gomock.Controller) *MockJob
NewMockJob creates a new mock instance.
func (*MockJob) EXPECT ¶
func (m *MockJob) EXPECT() *MockJobMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockJobMockRecorder ¶
type MockJobMockRecorder struct {
// contains filtered or unexported fields
}
MockJobMockRecorder is the mock recorder for MockJob.
func (*MockJobMockRecorder) Do ¶
func (mr *MockJobMockRecorder) Do() *gomock.Call
Do indicates an expected call of Do.
type MockWorkerPool ¶
type MockWorkerPool struct {
// contains filtered or unexported fields
}
MockWorkerPool is a mock of WorkerPool interface.
func NewMockWorkerPool ¶
func NewMockWorkerPool(ctrl *gomock.Controller) *MockWorkerPool
NewMockWorkerPool creates a new mock instance.
func (*MockWorkerPool) AddTask ¶
func (m *MockWorkerPool) AddTask(task Job)
AddTask mocks base method.
func (*MockWorkerPool) EXPECT ¶
func (m *MockWorkerPool) EXPECT() *MockWorkerPoolMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockWorkerPoolMockRecorder ¶
type MockWorkerPoolMockRecorder struct {
// contains filtered or unexported fields
}
MockWorkerPoolMockRecorder is the mock recorder for MockWorkerPool.
func (*MockWorkerPoolMockRecorder) AddTask ¶
func (mr *MockWorkerPoolMockRecorder) AddTask(task any) *gomock.Call
AddTask indicates an expected call of AddTask.
func (*MockWorkerPoolMockRecorder) Shutdown ¶
func (mr *MockWorkerPoolMockRecorder) Shutdown() *gomock.Call
Shutdown indicates an expected call of Shutdown.
type WorkerPool ¶
type WorkerPool interface {
AddTask(task Job)
Shutdown()
}
WorkerPool is an interface that specifies the functions to handle the pool of worker goroutines.
func NewWorkerPool ¶
func NewWorkerPool(maxWorker, capacity uint) WorkerPool
NewWorkerPool is a factory function to create and start a pool of worker goroutines.
The maxWorker parameter specifies the maximum number of workers that can execute tasks concurrently. The capacity parameter specifies the maximum number of tasks that can be put in a queue.