mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
* Move out node-pool manager and replace it with RunnerPool extension * adds extension points for runner pools in load-balanced mode * adds error to return values in RunnerPool and Runner interfaces * Implements runner pool contract with context-aware shutdown * fixes issue with range * fixes tests to use runner abstraction * adds empty test file as a workaround for build requiring go source files in top-level package * removes flappy timeout test * update docs to reflect runner pool setup * refactors system tests to use runner abstraction * removes poolmanager * moves runner interfaces from models to api/runnerpool package * Adds a second runner to pool docs example * explicitly check for request spillover to second runner in test * moves runner pool package name for system tests * renames runner pool pointer variable for consistency * pass model json to runner * automatically cast to http.ResponseWriter in load-balanced call case * allow overriding of server RunnerPool via a programmatic ServerOption * fixes return type of ResponseWriter in test * move Placer interface to runnerpool package * moves hash-based placer out of open source project * removes siphash from Gopkg.lock
44 lines
1.6 KiB
Go
44 lines
1.6 KiB
Go
package fnext
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/fnproject/fn/api/models"
|
|
)
|
|
|
|
type Extension interface {
|
|
Name() string
|
|
Setup(s ExtServer) error
|
|
}
|
|
|
|
// NOTE: ExtServer limits what the extension should do and prevents dependency loop
|
|
type ExtServer interface {
|
|
AddAppListener(listener AppListener)
|
|
AddCallListener(listener CallListener)
|
|
|
|
// AddAPIMiddleware add middleware
|
|
AddAPIMiddleware(m Middleware)
|
|
// AddAPIMiddlewareFunc add middlewarefunc
|
|
AddAPIMiddlewareFunc(m MiddlewareFunc)
|
|
// AddRootMiddleware add middleware add middleware for end user applications
|
|
AddRootMiddleware(m Middleware)
|
|
// AddRootMiddlewareFunc add middleware for end user applications
|
|
AddRootMiddlewareFunc(m MiddlewareFunc)
|
|
|
|
// AddEndpoint adds an endpoint to /v1/x
|
|
AddEndpoint(method, path string, handler ApiHandler)
|
|
// AddEndpoint adds an endpoint to /v1/x
|
|
AddEndpointFunc(method, path string, handler func(w http.ResponseWriter, r *http.Request))
|
|
// AddAppEndpoint adds an endpoints to /v1/apps/:app/x
|
|
AddAppEndpoint(method, path string, handler ApiAppHandler)
|
|
// AddAppEndpoint adds an endpoints to /v1/apps/:app/x
|
|
AddAppEndpointFunc(method, path string, handler func(w http.ResponseWriter, r *http.Request, app *models.App))
|
|
// AddRouteEndpoint adds an endpoints to /v1/apps/:app/routes/:route/x
|
|
AddRouteEndpoint(method, path string, handler ApiRouteHandler)
|
|
// AddRouteEndpoint adds an endpoints to /v1/apps/:app/routes/:route/x
|
|
AddRouteEndpointFunc(method, path string, handler func(w http.ResponseWriter, r *http.Request, app *models.App, route *models.Route))
|
|
|
|
// Datastore returns the Datastore Fn is using
|
|
Datastore() models.Datastore
|
|
}
|