Plugins: Remove registry dependency from process manager (#73241)

simplify
This commit is contained in:
Will Browne
2023-08-16 10:46:00 +02:00
committed by GitHub
parent d935e6ff57
commit 75b0788377
16 changed files with 202 additions and 221 deletions

View File

@ -57,16 +57,16 @@ func (b *BackendClientInit) Initialize(ctx context.Context, p *plugins.Plugin) (
// BackendClientStarter implements an InitializeFunc for starting a backend plugin process.
type BackendClientStarter struct {
processManager process.Service
processManager process.Manager
log log.Logger
}
// BackendProcessStartStep returns a new InitializeFunc for starting a backend plugin process.
func BackendProcessStartStep(processManager process.Service) InitializeFunc {
func BackendProcessStartStep(processManager process.Manager) InitializeFunc {
return newBackendProcessStarter(processManager).Start
}
func newBackendProcessStarter(processManager process.Service) *BackendClientStarter {
func newBackendProcessStarter(processManager process.Manager) *BackendClientStarter {
return &BackendClientStarter{
processManager: processManager,
log: log.New("plugins.backend.start"),
@ -75,7 +75,7 @@ func newBackendProcessStarter(processManager process.Service) *BackendClientStar
// Start will start the backend plugin process.
func (b *BackendClientStarter) Start(ctx context.Context, p *plugins.Plugin) (*plugins.Plugin, error) {
if err := b.processManager.Start(ctx, p.ID); err != nil {
if err := b.processManager.Start(ctx, p); err != nil {
b.log.Error("Could not start plugin", "pluginId", p.ID, "error", err)
return nil, err
}