mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
* adds extension points for runner pools in load-balanced mode * adds error to return values in RunnerPool and Runner interfaces
32 lines
730 B
Go
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
|
|
}
|