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 ...
随机推荐
- MySQL数据库表分区功能详解
1.什么是表分区? mysql数据库中的数据是以文件的形势存在磁盘上的,默认放在/mysql/data下面(可以通过my.cnf中的datadir来查看),一张表主要对应着三个文件,一个是frm存放表 ...
- 使用MyCat分表分库原理分析
Mycat可以实现 读写分离 分表分库 主从复制是MySQL自带的哈~ 关于分片取模算法: 根据id进行取模 根据数据库集群的数量(或者说是表数量,mycat里面一个表对应一个库) 使用MyCat ...
- RabbitMQ 之 WorkQueues工作队列
模型图 为什么会出现 work queues? 前提:使用 simple 队列的时候 (上一篇博客)我们应用程序在是使用消息系统的时候,一般生产者 P 生产消息是毫不费力的(发送消息即可),而消费者接 ...
- VMware与Windows主机交换文件
1. 安装 VMwareTool ,直接拖拽文件 2. 安装 VMwareTool,然后WMare配置 共享文件夹 3. 通过 U盘 4. for Linux:Windows安装 SSH Client ...
- scala学习手记23 - 函数值
scala的一个最主要的特性就是支持函数编程.函数是函数编程中的一等公民:函数可以作为参数传递给其他函数,可以作为其他函数的返回值,甚至可以在其它函数中嵌套.这些高阶函数称为函数值. 举一个简单的例子 ...
- spring3: 依赖和依赖注入-xml配置-DI的配置
3.1.1 依赖和依赖注入 传统应用程序设计中所说的依赖一般指“类之间的关系”,那先让我们复习一下类之间的关系: 泛化:表示类与类之间的继承关系.接口与接口之间的继承关系: 实现:表示类对接口的实现 ...
- unity 使用MVC模式
这两天看了下老大的项目,他基本都是用MVC模式,写的很好,在此把我理解的记录下来 Model:实体对象(对应数据库记录的类) View:视图 presenter(controller):业务处理 vi ...
- APP耗电量专项测试整理
Android: (使用batterystats) 方法: 手机自带的电量监控.GT 命令(5.0以上系统才可以): 1.下载historian.py脚本,下载地址:https://github.co ...
- 更改当前启动项,开关Hyper-V
switch-HyperV.bat @echo off "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\ ...
- MYSQL(python)安装记录
捯饬了很长时间,终于安装成功了,特此记录下! MYSQL历史版本下载,一般为绿色版本 地址:http://downloads.mysql.com/archives/community/ MYSQL安装 ...