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 ...
随机推荐
- 《Maven实战》第6章 仓库
6.1什么是Maven仓库? Maven仓库:存储所有Maven项目共享的构件的统一位置. Maven仓库的作用:Maven项目仅需声明依赖坐标,即可在需要的时候自动根据坐标找到仓库中的构件. 6.2 ...
- tomcat深入学习—权限篇
如果想给一个应用程序配置权限,可能需要的代码量很多,但你知道吗,仅通过配置tomcat,就能有同样的效果(为一个web应用添加了权限) 效果:打开http://localhost:8080/searc ...
- Mysql 分组聚合实现 over partition by 功能
mysql中没有类似oracle和postgreSQL的 OVER(PARTITION BY)功能. 那么如何在MYSQL中搞定分组聚合的查询呢 先说结论: 利用 group_concat + sub ...
- Linux Wget 命令
Linux wget是一个下载文件的工具,它用在命令行下.对于Linux用户是必不可少的工具,尤其对于网络管理员,经常要下载一些软件或从远程服务器恢复备份到本地服务器.如果我们使用虚拟主机,处理这样的 ...
- 探秘DPDK Virtio的不同路径
什么是Vhost/Virtio Vhost/Virtio是一种半虚拟化的设备抽象接口规范, 在Qemu和KVM中的得到了广泛的应用,在客户机操作系统中实现的前端驱动程序一般直接叫Virtio, 在宿主 ...
- 使用ssm整合是创建Maven项目报错Failure to transfer com.thoughtworks.xstream:xstream:pom:1.3.1
Description Resource Path Location TypeFailure to transfer com.thoughtworks.xstream:xstream:pom:1.3. ...
- 不合法的请求字符,不能包含\uxxxx格式的字符
不合法的请求字符,不能包含\uxxxx格式的字符 ,不支持数组转json_encode()格式, 需要直接将数组,拼合成 json格式 ** * 微信api不支持中文转义的json结构 * @para ...
- WPF Invoke和BeginInvoke
在WPF中Invoke和BeginInvoke和Winform中的是差不多的,只是一个用Control的一个用Dispatcher的. 而Invoke和BeginInvoke的区别嘛 就是一个是同步的 ...
- bash echo color
原文:https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux $ ; i ...
- Build_Release.bat
Build_Release.bat @echo off pushd "%~dp0" set tag=Release set PATH="C:\Program Files ...