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 ...
随机推荐
- 20145201 实验二 Java面向对象程序设计
20145201实验二 Java面向对象程序设计 初步掌握单元测试和TDD 实验步骤 (一)单元测试 (1) 三种代码 编程是智力活动,不是打字,编程前要把干什么.如何干想清楚才能把程序写对.写好.与 ...
- 2018-2019-2 20165114《网络对抗技术》Exp2 后门原理与实践
目录 一.实验准备 二.实验内容 三.基础问题回答 四.实验过程及步骤 五.实验总结与体会 六.实验中遇到的问题与错误. 一.实验准备 1.后门概念 后门就是不经过正常认证流程而访问系统的通道. 哪里 ...
- Redis单线程原理
redis是以socket方式通信,socket服务端可同时接受多个客户端请求连接,也就是说,redis服务同时面对多个redis客户端连接请求,而redis服务本身是单线程运行. 假设,现在有A,B ...
- Memcached add 命令
Memcached add 命令用于将 value(数据值) 存储在指定的 key(键) 中. 如果 add 的 key 已经存在,则不会更新数据,之前的值将仍然保持相同,并且您将获得响应 NOT_S ...
- scala学习手记14 - 单例对象
java中的单例模式都很熟悉了:简单地说就是一个类只能有一个实例.在scala中创建单例对象非常简单,创建类时使用object关键字替换class即可.因为单例类无法初始化,所以不能向它的主构造函数传 ...
- tech| kafka入门书籍导读
J梳理了一下自己在入门 kafka 时读过的一些书, 希望能帮助到对 kafka 感兴趣的小伙伴. 涉及到的书籍: kafka 权威指南 Kafka: The Definitive Guide (ka ...
- angular一些常用的方法:
angular.copy(); 用法:对Object对象的深度拷贝$scope.data = {name:'yanjinyun',age:'11'}; $scope.origData = angula ...
- AtCoder Regular Contest 079
C题,刚开始以为遍历整个树,后来发现二重循环判断就行了 #include<map> #include<set> #include<cmath> #include&l ...
- stringToDateUtils 字符串转化日期
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; impor ...
- 【Python】unicode' object is not callable
在Python中,出现'unicode' object is not callable的错误一般是把字符串当做函数使用了.