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:
@@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"runtime"
|
||||
@@ -15,6 +14,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/iron-io/functions/api/runner/task"
|
||||
"github.com/iron-io/runner/common"
|
||||
"github.com/iron-io/runner/drivers"
|
||||
driverscommon "github.com/iron-io/runner/drivers"
|
||||
@@ -22,19 +22,6 @@ import (
|
||||
"github.com/iron-io/runner/drivers/mock"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
ID string
|
||||
Image string
|
||||
Timeout time.Duration
|
||||
AppName string
|
||||
Path string
|
||||
Memory uint64
|
||||
Env map[string]string
|
||||
Stdin io.Reader
|
||||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
}
|
||||
|
||||
type Runner struct {
|
||||
driver drivers.Driver
|
||||
taskQueue chan *containerTask
|
||||
@@ -155,7 +142,7 @@ func (r *Runner) checkMemAndUse(req uint64) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (r *Runner) Run(ctx context.Context, cfg *Config) (drivers.RunResult, error) {
|
||||
func (r *Runner) Run(ctx context.Context, cfg *task.Config) (drivers.RunResult, error) {
|
||||
var err error
|
||||
|
||||
if cfg.Memory == 0 {
|
||||
@@ -224,7 +211,7 @@ func (r *Runner) Run(ctx context.Context, cfg *Config) (drivers.RunResult, error
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (r Runner) EnsureImageExists(ctx context.Context, cfg *Config) error {
|
||||
func (r Runner) EnsureImageExists(ctx context.Context, cfg *task.Config) error {
|
||||
ctask := &containerTask{
|
||||
cfg: cfg,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user