Worker: move command_exe.go interface definitions
This commit is contained in:
parent
2a4db143e6
commit
9a5047a94d
@ -32,18 +32,6 @@ import (
|
||||
"gitlab.com/blender/flamenco-ng-poc/pkg/api"
|
||||
)
|
||||
|
||||
// Generate mock implementation of this interface.
|
||||
//go:generate go run github.com/golang/mock/mockgen -destination mocks/command_listener.gen.go -package mocks gitlab.com/blender/flamenco-ng-poc/internal/worker CommandListener
|
||||
|
||||
// CommandListener sends the result of commands (log, output files) to the Manager.
|
||||
type CommandListener interface {
|
||||
// LogProduced sends any logging to whatever service for storing logging.
|
||||
// logLines are concatenated.
|
||||
LogProduced(ctx context.Context, taskID string, logLines ...string) error
|
||||
// OutputProduced tells the Manager there has been some output (most commonly a rendered frame or video).
|
||||
OutputProduced(ctx context.Context, taskID string, outputLocation string) error
|
||||
}
|
||||
|
||||
type CommandExecutor struct {
|
||||
cli CommandLineRunner
|
||||
listener CommandListener
|
||||
@ -57,6 +45,18 @@ var _ CommandRunner = (*CommandExecutor)(nil)
|
||||
|
||||
type commandCallable func(ctx context.Context, logger zerolog.Logger, taskID string, cmd api.Command) error
|
||||
|
||||
// Generate mock implementation of this interface.
|
||||
//go:generate go run github.com/golang/mock/mockgen -destination mocks/command_listener.gen.go -package mocks gitlab.com/blender/flamenco-ng-poc/internal/worker CommandListener
|
||||
|
||||
// CommandListener sends the result of commands (log, output files) to the Manager.
|
||||
type CommandListener interface {
|
||||
// LogProduced sends any logging to whatever service for storing logging.
|
||||
// logLines are concatenated.
|
||||
LogProduced(ctx context.Context, taskID string, logLines ...string) error
|
||||
// OutputProduced tells the Manager there has been some output (most commonly a rendered frame or video).
|
||||
OutputProduced(ctx context.Context, taskID string, outputLocation string) error
|
||||
}
|
||||
|
||||
// TimeService is a service that operates on time.
|
||||
type TimeService interface {
|
||||
After(duration time.Duration) <-chan time.Time
|
||||
|
Loading…
x
Reference in New Issue
Block a user