Files
fn-serverless/api/models/runner_pool.go
Gerardo Viedma 6bc1220d8b Adds extension points for runner pools in load-balanced mode (Patch 1/2) (#851)
* adds extension points for runner pools in load-balanced mode

* adds error to return values in RunnerPool and Runner interfaces
2018-03-15 10:28:56 +00:00

32 lines
730 B
Go

package models
import (
"context"
"io"
"net/http"
"time"
)
// RunnerPool is the abstraction for getting an ordered list of runners to try for a call
type RunnerPool interface {
Runners(call RunnerCall) ([]Runner, error)
Shutdown() error
}
// Runner is the interface to invoke the execution of a function call on a specific runner
type Runner interface {
TryExec(ctx context.Context, call RunnerCall) (bool, error)
Close() error
Address() string
}
// RunnerCall provides access to the necessary details of request in order for it to be
// processed by a RunnerPool
type RunnerCall interface {
SlotDeadline() time.Time
Request() *http.Request
ResponseWriter() io.Writer
StdErr() io.ReadWriteCloser
Model() *Call
}