mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
functions: hot containers (#332)
* functions: modify datastore to accomodate hot containers support * functions: protocol between functions and hot containers * functions: add hot containers clockwork * fn: add hot containers support
This commit is contained in:
@@ -25,19 +25,22 @@ var (
|
||||
type Routes []*Route
|
||||
|
||||
type Route struct {
|
||||
AppName string `json:"app_name,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
Image string `json:"image,omitempty"`
|
||||
Memory uint64 `json:"memory,omitempty"`
|
||||
Headers http.Header `json:"headers,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Config `json:"config"`
|
||||
AppName string `json:"app_name,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
Image string `json:"image,omitempty"`
|
||||
Memory uint64 `json:"memory,omitempty"`
|
||||
Headers http.Header `json:"headers,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Format string `json:"format,omitempty"`
|
||||
MaxConcurrency int `json:"max_concurrency,omitempty"`
|
||||
Config `json:"config"`
|
||||
}
|
||||
|
||||
var (
|
||||
ErrRoutesValidationFoundDynamicURL = errors.New("Dynamic URL is not allowed")
|
||||
ErrRoutesValidationInvalidPath = errors.New("Invalid Path format")
|
||||
ErrRoutesValidationInvalidType = errors.New("Invalid route Type")
|
||||
ErrRoutesValidationInvalidFormat = errors.New("Invalid route Format")
|
||||
ErrRoutesValidationMissingAppName = errors.New("Missing route AppName")
|
||||
ErrRoutesValidationMissingImage = errors.New("Missing route Image")
|
||||
ErrRoutesValidationMissingName = errors.New("Missing route Name")
|
||||
@@ -82,6 +85,14 @@ func (r *Route) Validate() error {
|
||||
res = append(res, ErrRoutesValidationInvalidType)
|
||||
}
|
||||
|
||||
if r.Format != FormatDefault && r.Format != FormatHTTP {
|
||||
res = append(res, ErrRoutesValidationInvalidFormat)
|
||||
}
|
||||
|
||||
if r.MaxConcurrency == 0 && r.Format == FormatHTTP {
|
||||
r.MaxConcurrency = 1
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return apiErrors.CompositeValidationError(res...)
|
||||
}
|
||||
|
||||
@@ -21,6 +21,13 @@ const (
|
||||
TypeAsync = "async"
|
||||
)
|
||||
|
||||
const (
|
||||
// FormatDefault ...
|
||||
FormatDefault = ""
|
||||
// FormatHTTP ...
|
||||
FormatHTTP = "http"
|
||||
)
|
||||
|
||||
/*Task task
|
||||
|
||||
swagger:model Task
|
||||
|
||||
Reference in New Issue
Block a user