summaryrefslogtreecommitdiff
path: root/transport/interface.go
diff options
context:
space:
mode:
Diffstat (limited to 'transport/interface.go')
-rw-r--r--transport/interface.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/transport/interface.go b/transport/interface.go
new file mode 100644
index 00000000..e20f2b0b
--- /dev/null
+++ b/transport/interface.go
@@ -0,0 +1,21 @@
+package transport
+
+import (
+ "context"
+ "os/exec"
+
+ "github.com/spiral/roadrunner/v2/events"
+ "github.com/spiral/roadrunner/v2/worker"
+)
+
+// Factory is responsible for wrapping given command into tasks WorkerProcess.
+type Factory interface {
+ // SpawnWorkerWithTimeout creates new WorkerProcess process based on given command with context.
+ // Process must not be started.
+ SpawnWorkerWithTimeout(context.Context, *exec.Cmd, ...events.Listener) (*worker.Process, error)
+ // SpawnWorker creates new WorkerProcess process based on given command.
+ // Process must not be started.
+ SpawnWorker(*exec.Cmd, ...events.Listener) (*worker.Process, error)
+ // Close the factory and underlying connections.
+ Close() error
+}