fn project hot functions 说明
所谓 hot functions 实际上就是长时间运行的functions ,简单理解类似后台任务
fnproject 使用 类似 http的处理方式
package main
import (
"bufio"
"bytes"
"fmt"
"io/ioutil"
"net/http"
"os"
"strconv"
)
func main() {
for {
res := http.Response{
Proto: "HTTP/1.1",
ProtoMajor: 1,
ProtoMinor: 1,
StatusCode: 200,
Status: "OK",
}
r := bufio.NewReader(os.Stdin)
req, err := http.ReadRequest(r)
var buf bytes.Buffer
if err != nil {
res.StatusCode = 500
res.Status = http.StatusText(res.StatusCode)
fmt.Fprintln(&buf, err)
} else {
l, _ := strconv.Atoi(req.Header.Get("Content-Length"))
p := make([]byte, l)
r.Read(p)
fmt.Fprintf(&buf, "Hello %s\n", p)
for k, vs := range req.Header {
fmt.Fprintf(&buf, "ENV: %s %#v\n", k, vs)
}
}
res.Body = ioutil.NopCloser(&buf)
res.ContentLength = int64(buf.Len())
res.Write(os.Stdout)
}
}
format (mandatory) either "default" or "http". If "http", then it is a hot function.
idle_timeout (optional) - idle timeout (in seconds) before function termination, default 30 seconds.
https://github.com/fnproject/fn/tree/master/examples/tutorial/hotfunctions
https://github.com/fnproject/fn/blob/master/docs/hot-functions.md
fn project hot functions 说明的更多相关文章
- fn project AWS Lambda 格式 functions
Creating Lambda Functions Creating Lambda functions is not much different than using regular funct ...
- fn project 扩展
目前支持的扩展方式 Listeners - listen to API events such as a route getting updated and react accordingly. ...
- fn project 生产环境使用
此为官方的参考说明 Running Fn in Production The QuickStart guide is intended to quickly get started and kic ...
- fn project 对象模型
Applications At the root of everything are applications. In fn, an application is essentially a grou ...
- fn project Function files 说明
主要是文件 func.yaml func.json 详细说明如下: An example of a function file: name: fnproject/hello version: 0.0. ...
- fn project k8s 集成
具体部署还是比较简单的,以下为官方参考,只是有一个service type 为 loadBlancer 实际使用需要修改为NodePort Prerequisite 1: working Kuber ...
- fn project 私有镜像发布
1. 说明 fnproject 默认的docker registry 是 dockerhub 对于企业应用还是不太方便的 还好系统系统了配置参数方便我们进行配置,与开源harbor 进行集成 2. 使 ...
- fn project 数据库配置
Databases We currently support the following databases and they are passed in via the DB_URL environ ...
- fn project faas 框架试用
1. 预备环境 docker 17.05 docker hub account (测试可选) 2. 安装 curl -LSs https://raw.githubusercontent.com/fnp ...
随机推荐
- Linux下挂载windows的共享文件夹
环境说明: 由于领导要求:现需要将某Linux服务器下的一个文件移动到某windows服务器下(服务器均在机房托管,要远程操作) 由于操作为一次性,则决定在windows下建立一个共享文件夹,linu ...
- C++ vector 多次删除第一个元素
转载声明: 代码都是来源于一下连接,做了一点点修改,为了记忆方便,故贴在这里,原文链接:http://blog.csdn.net/doctor_feng/article/details/1188078 ...
- PermutationSequence,求第k个全排列
问题描述:给定一个数组,数组里面元素不重复,求第k个全排列. 算法分析:这道题就是用到取商取模运算. public String getPermutation(int n, int k) { // i ...
- Java中的赋值运算符
赋值运算符是指为变量或常量指定数值的符号.如可以使用 “=” 将右边的表达式结果赋给左边的操作数. Java 支持的常用赋值运算符,如下表所示: public class HelloWorld{ pu ...
- Visual对象——WPF
System.Object System.Windows.Threading.DispatcherObject System.Windows.Depende ...
- Ajax-02 iframe实现伪“Ajax”
需求: 用户输入URL,使用iframe将目标URL的内容加载到页面指定位置(局部刷新) <!DOCTYPE html> <html lang="en"> ...
- java开发工具idea,在install时候报错The packaging for this project did not assign a file to the build artifact
intellij中install报错:The packaging for this project did not assign a file to the build artifact 原因是run ...
- UVA 1626 区间dp、打印路径
uva 紫书例题,这个区间dp最容易错的应该是(S)这种匹配情况,如果不是题目中给了提示我就忽略了,只想着左右分割忘记了这种特殊的例子. dp[i][j]=MIN{dp[i+1][j-1] | if( ...
- 51nod 1119 组合数,逆元
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1119 1119 机器人走方格 V2 基准时间限制:1 秒 空间限制:13 ...
- 【sparkSQL】创建DataFrame及保存
首先我们要创建SparkSession val spark = SparkSession.builder() .appName("test") .master("loca ...