functions

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

///////////////////////////////////////////////////////////////////// Copyright (c) 2017 VMware, Inc. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 /////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////// Copyright (c) 2017 VMware, Inc. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 /////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////// Copyright (c) 2017 VMware, Inc. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 /////////////////////////////////////////////////////////////////////

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context map[string]interface{}

func (Context) Logs

func (ctx Context) Logs() []string

func (Context) SetLogs

func (ctx Context) SetLogs(reader io.Reader)

type Exec

type Exec struct {
	// Code is the function code, either as readable text or base64 encoded (for .zip and .jar archives)
	Code string
	// Main is the function's entry point (aka main function), by default "main"
	Main string
	// Image is the function's docker image
	Image string
	// Language is the function's runtime language
	Language string
}

type FaaSDriver

type FaaSDriver interface {
	// Create creates (or updates, if is already exists) the function in the FaaS implementation.
	// name is the name of the function.
	// exec defines the function implementation.
	Create(f *Function, exec *Exec) error

	// Delete deletes the function in the FaaS implementation.
	// name is the name of the function.
	Delete(f *Function) error

	// GetRunnable returns a callable representation of a function.
	// name is the name of the function.
	GetRunnable(e *FunctionExecution) Runnable
}

type FnRun

type FnRun struct {
	entitystore.BaseEntity
	FunctionName string      `json:"functionName"`
	FunctionID   string      `json:"functionID"`
	Blocking     bool        `json:"blocking"`
	Input        interface{} `json:"input,omitempty"`
	Output       interface{} `json:"output,omitempty"`
	Secrets      []string    `json:"secrets,omitempty"`
	Logs         []string    `json:"logs,omitempty"`
	FinishedTime time.Time   `json:"finishedTime,omitempty"`

	WaitChan chan struct{} `json:"-"`
}

FnRun struct represents single function run

func (*FnRun) Done

func (r *FnRun) Done()

func (*FnRun) Wait

func (r *FnRun) Wait()

type Function

type Function struct {
	entitystore.BaseEntity
	Code      string   `json:"code"`
	Main      string   `json:"main"`
	ImageName string   `json:"image"`
	Schema    *Schema  `json:"schema,omitempty"`
	Secrets   []string `json:"secrets,omitempty"`
}

Function struct represents function entity that is stored in entity store

type FunctionError

type FunctionError interface {
	AsFunctionErrorObject() interface{}
}

type FunctionExecution

type FunctionExecution struct {
	Context Context

	Name string
	ID   string

	Schemas *Schemas
	Secrets []string
	Cookie  string
}

type Middleware

type Middleware func(f Runnable) Runnable

type Runnable

type Runnable func(ctx Context, in interface{}) (interface{}, error)

type Runner

type Runner interface {
	Run(fn *FunctionExecution, in interface{}) (interface{}, error)
}

type Schema

type Schema struct {
	In  *spec.Schema `json:"in,omitempty"`
	Out *spec.Schema `json:"out,omitempty"`
}

Schema struct stores input and output validation schemas

type Schemas

type Schemas struct {
	// SchemaIn is the function input validation schema data structure. Can be nil.
	SchemaIn interface{}
	// SchemaOut is the function output validation schema data structure. Can be nil.
	SchemaOut interface{}
}

type SecretInjector

type SecretInjector interface {
	GetMiddleware(secrets []string, cookie string) Middleware
}

type UserError

type UserError interface {
	AsUserErrorObject() interface{}
}

type Validator

type Validator interface {
	GetMiddleware(schemas *Schemas) Middleware
}

Directories

Path Synopsis
Code generated by mockery v1.0.0
Code generated by mockery v1.0.0
///////////////////////////////////////////////////////////////////// Copyright (c) 2017 VMware, Inc.
///////////////////////////////////////////////////////////////////// Copyright (c) 2017 VMware, Inc.
///////////////////////////////////////////////////////////////////// Copyright (c) 2017 VMware, Inc.
///////////////////////////////////////////////////////////////////// Copyright (c) 2017 VMware, Inc.
///////////////////////////////////////////////////////////////////// Copyright (c) 2017 VMware, Inc.
///////////////////////////////////////////////////////////////////// Copyright (c) 2017 VMware, Inc.
///////////////////////////////////////////////////////////////////// Copyright (c) 2017 VMware, Inc.
///////////////////////////////////////////////////////////////////// Copyright (c) 2017 VMware, Inc.
///////////////////////////////////////////////////////////////////// Copyright (c) 2017 VMware, Inc.
///////////////////////////////////////////////////////////////////// Copyright (c) 2017 VMware, Inc.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL