summaryrefslogtreecommitdiff
path: root/pkg/worker
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-02-08 23:21:54 +0300
committerValery Piashchynski <[email protected]>2021-02-08 23:21:54 +0300
commitda64d9fbab7d73e203e7dbbb9503f4d422feaab0 (patch)
tree3dc3d5dd4a8c4de7d4b57baf2eeb1089f831bc1c /pkg/worker
parent3e92e3df723ca1c4f152d8526eebfd7184e6fcec (diff)
BaseProcess interface as a return type in the worker_watcher,pool and
worker interface
Diffstat (limited to 'pkg/worker')
-rwxr-xr-xpkg/worker/sync_worker.go17
-rwxr-xr-xpkg/worker/worker.go3
2 files changed, 2 insertions, 18 deletions
diff --git a/pkg/worker/sync_worker.go b/pkg/worker/sync_worker.go
index 304c40d6..82a5462a 100755
--- a/pkg/worker/sync_worker.go
+++ b/pkg/worker/sync_worker.go
@@ -13,32 +13,19 @@ import (
)
// Allocator is responsible for worker allocation in the pool
-type Allocator func() (*SyncWorkerImpl, error)
+type Allocator func() (SyncWorker, error)
type SyncWorkerImpl struct {
process *Process
}
// From creates SyncWorker from BaseProcess
-func From(process *Process) *SyncWorkerImpl {
+func From(process *Process) SyncWorker {
return &SyncWorkerImpl{
process: process,
}
}
-// FromSync creates BaseProcess from SyncWorkerImpl
-func FromSync(w *SyncWorkerImpl) BaseProcess {
- return &Process{
- created: w.process.created,
- events: w.process.events,
- state: w.process.state,
- cmd: w.process.cmd,
- pid: w.process.pid,
- endState: w.process.endState,
- relay: w.process.relay,
- }
-}
-
// Exec payload without TTL timeout.
func (tw *SyncWorkerImpl) Exec(p payload.Payload) (payload.Payload, error) {
const op = errors.Op("sync_worker_exec")
diff --git a/pkg/worker/worker.go b/pkg/worker/worker.go
index c315cb2d..0f7ab755 100755
--- a/pkg/worker/worker.go
+++ b/pkg/worker/worker.go
@@ -40,9 +40,6 @@ type Process struct {
// can be nil while process is not started.
pid int
- // contains information about resulted process state.
- endState *os.ProcessState
-
// communication bus with underlying process.
relay relay.Relay
}