summaryrefslogtreecommitdiff
path: root/interfaces/factory/factory.go
blob: 51b73501becaf2010127bc52bca3f055209f6c9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package worker

import (
	"context"
	"os/exec"

	"github.com/spiral/roadrunner/v2/interfaces/worker"
)

// Factory is responsible of wrapping given command into tasks WorkerProcess.
type Factory interface {
	// SpawnWorkerWithContext creates new WorkerProcess process based on given command with contex.
	// Process must not be started.
	SpawnWorkerWithContext(context.Context, *exec.Cmd) (worker.BaseProcess, error)

	// SpawnWorker creates new WorkerProcess process based on given command.
	// Process must not be started.
	SpawnWorker(*exec.Cmd) (worker.BaseProcess, error)

	// Close the factory and underlying connections.
	Close(ctx context.Context) error
}