From 9d5fe4f6a98b30fd73be8259f84fa595ac994a71 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Thu, 17 Dec 2020 02:34:44 +0300 Subject: huge refactor --- interfaces/factory/factory.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 interfaces/factory/factory.go (limited to 'interfaces/factory/factory.go') diff --git a/interfaces/factory/factory.go b/interfaces/factory/factory.go new file mode 100755 index 00000000..036ff4e7 --- /dev/null +++ b/interfaces/factory/factory.go @@ -0,0 +1,22 @@ +package worker + +import ( + "context" + "os/exec" + + "github.com/spiral/roadrunner/v2/pkg/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 +} -- cgit v1.2.3