-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
111 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package mock | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Layr-Labs/eigenda/common" | ||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
type MockWorkerpool struct { | ||
mock.Mock | ||
} | ||
|
||
var _ common.WorkerPool = (*MockWorkerpool)(nil) | ||
|
||
func (mock *MockWorkerpool) Size() int { | ||
args := mock.Called() | ||
result := args.Get(0) | ||
return result.(int) | ||
} | ||
|
||
func (mock *MockWorkerpool) Stop() { | ||
mock.Called() | ||
} | ||
|
||
func (mock *MockWorkerpool) StopWait() { | ||
mock.Called() | ||
} | ||
|
||
func (mock *MockWorkerpool) Stopped() bool { | ||
args := mock.Called() | ||
result := args.Get(0) | ||
return result.(bool) | ||
} | ||
|
||
func (mock *MockWorkerpool) Submit(task func()) { | ||
mock.Called(task) | ||
} | ||
|
||
func (mock *MockWorkerpool) SubmitWait(task func()) { | ||
mock.Called(task) | ||
} | ||
|
||
func (mock *MockWorkerpool) WaitingQueueSize() int { | ||
args := mock.Called() | ||
result := args.Get(0) | ||
return result.(int) | ||
} | ||
|
||
func (mock *MockWorkerpool) Pause(ctx context.Context) { | ||
mock.Called(ctx) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package common | ||
|
||
import "context" | ||
|
||
type WorkerPool interface { | ||
Size() int | ||
Stop() | ||
StopWait() | ||
Stopped() bool | ||
Submit(task func()) | ||
SubmitWait(task func()) | ||
WaitingQueueSize() int | ||
Pause(ctx context.Context) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters