summaryrefslogtreecommitdiff
path: root/interfaces
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-12-21 10:27:10 +0300
committerValery Piashchynski <[email protected]>2020-12-21 10:27:10 +0300
commit2f71f79ac704ed95dad961677b6e602e38641b5d (patch)
tree7452bbedd1444079757a848ad07089bc6093561f /interfaces
parent3d4c75aadd9ffd0d46728f48f685de2e1bfc44bb (diff)
Remove unused contex from interfaces. Update pool allocator.
Diffstat (limited to 'interfaces')
-rwxr-xr-xinterfaces/factory/factory.go22
-rw-r--r--interfaces/pool/pool.go3
-rw-r--r--interfaces/worker/factory.go4
-rw-r--r--interfaces/worker/worker.go4
4 files changed, 6 insertions, 27 deletions
diff --git a/interfaces/factory/factory.go b/interfaces/factory/factory.go
deleted file mode 100755
index 51b73501..00000000
--- a/interfaces/factory/factory.go
+++ /dev/null
@@ -1,22 +0,0 @@
-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
-}
diff --git a/interfaces/pool/pool.go b/interfaces/pool/pool.go
index 72da9597..22552388 100644
--- a/interfaces/pool/pool.go
+++ b/interfaces/pool/pool.go
@@ -18,9 +18,10 @@ type Pool interface {
// GetConfig returns pool configuration.
GetConfig() interface{}
- // Exec
+ // Exec executes task with payload
Exec(rqs payload.Payload) (payload.Payload, error)
+ // ExecWithContext executes task with context which is used with timeout
ExecWithContext(ctx context.Context, rqs payload.Payload) (payload.Payload, error)
// Workers returns worker list associated with the pool.
diff --git a/interfaces/worker/factory.go b/interfaces/worker/factory.go
index 19e2bf5d..8db8ddcc 100644
--- a/interfaces/worker/factory.go
+++ b/interfaces/worker/factory.go
@@ -9,10 +9,10 @@ import (
type Factory interface {
// SpawnWorkerWithContext creates new WorkerProcess process based on given command with context.
// Process must not be started.
- SpawnWorkerWithContext(context.Context, *exec.Cmd) (BaseProcess, error)
+ SpawnWorkerWithTimeout(context.Context, *exec.Cmd) (BaseProcess, error)
// SpawnWorker creates new WorkerProcess process based on given command.
// Process must not be started.
SpawnWorker(*exec.Cmd) (BaseProcess, error)
// Close the factory and underlying connections.
- Close(ctx context.Context) error
+ Close() error
}
diff --git a/interfaces/worker/worker.go b/interfaces/worker/worker.go
index f830fdf2..7f2f8a53 100644
--- a/interfaces/worker/worker.go
+++ b/interfaces/worker/worker.go
@@ -40,7 +40,7 @@ type BaseProcess interface {
Wait() error
// Stop sends soft termination command to the WorkerProcess and waits for process completion.
- Stop(ctx context.Context) error
+ Stop() error
// Kill kills underlying process, make sure to call Wait() func to gather
// error log from the stderr. Does not waits for process completion!
@@ -59,5 +59,5 @@ type SyncWorker interface {
// Exec used to execute payload on the SyncWorker, there is no TIMEOUTS
Exec(rqs payload.Payload) (payload.Payload, error)
// ExecWithContext used to handle Exec with TTL
- ExecWithContext(ctx context.Context, p payload.Payload) (payload.Payload, error)
+ ExecWithTimeout(ctx context.Context, p payload.Payload) (payload.Payload, error)
}