|
@@ -1,7 +1,9 @@
|
|
|
package main
|
|
|
|
|
|
import (
|
|
|
+ "errors"
|
|
|
"flow"
|
|
|
+ "flow/registry"
|
|
|
"flowserver"
|
|
|
"fmt"
|
|
|
"log"
|
|
@@ -17,20 +19,53 @@ func main() {
|
|
|
|
|
|
log.Println("Running version:", flowserver.Version)
|
|
|
|
|
|
- flow.Register("somebigfunctionthatoverflows", strCat)
|
|
|
- flow.Register("str.cat", strCat)
|
|
|
- flow.Register("str.reverse", strReverse)
|
|
|
- flow.Register("str.split", strings.Split)
|
|
|
- flow.Register("str.join", strings.Join)
|
|
|
-
|
|
|
- flow.Register("delay.reverse", delayReverse)
|
|
|
- flow.Register("delay.split", delaySplit)
|
|
|
- flow.Register("delay.join", delayJoin)
|
|
|
- flow.Register("longduration", longduration)
|
|
|
- flow.Register("duration", duration)
|
|
|
+ registry.Batch{
|
|
|
+ flow.Register("delay.cat", delayCat),
|
|
|
+ flow.Register("delay.reverse", delayReverse),
|
|
|
+ flow.Register("delay.split", delaySplit),
|
|
|
+ flow.Register("delay.join", delayJoin),
|
|
|
+ flow.Register("addduration", duration),
|
|
|
+ }.Categories("string", "test").
|
|
|
+ Extra("style", map[string]string{
|
|
|
+ "color": "#a55",
|
|
|
+ })
|
|
|
+
|
|
|
+ registry.Batch{
|
|
|
+ flow.Register("multiplex4", multiplex4),
|
|
|
+ flow.Register("multiplex6", multiplex6),
|
|
|
+ flow.Register("longduration", longduration),
|
|
|
+ flow.Register("longduration", longduration),
|
|
|
+ flow.Register("error", func(s string) (string, error) {
|
|
|
+ time.Sleep(4 * time.Second)
|
|
|
+ return "", errors.New("Some error")
|
|
|
+ }),
|
|
|
+ }.Categories("test").
|
|
|
+ Extra("style", map[string]string{
|
|
|
+ "color": "#959",
|
|
|
+ })
|
|
|
+
|
|
|
+ registry.Batch{
|
|
|
+ flow.Register("str.cat", strCat),
|
|
|
+ flow.Register("str.reverse", strReverse),
|
|
|
+ flow.Register("str.split", strings.Split),
|
|
|
+ flow.Register("str.join", strings.Join),
|
|
|
+ }.Categories("string").
|
|
|
+ Extra("style", map[string]string{
|
|
|
+ "color": "#aa5",
|
|
|
+ })
|
|
|
+
|
|
|
+ addr := ":2015"
|
|
|
+ log.Println("Starting server at:", ":2015")
|
|
|
|
|
|
f := flowserver.FlowServer{}
|
|
|
- f.ListenAndServe()
|
|
|
+ f.ListenAndServe(addr)
|
|
|
+}
|
|
|
+
|
|
|
+func multiplex4(a1, a2, a3, a4 string) string {
|
|
|
+ return strings.Join([]string{a1, a2, a3, a4}, " ")
|
|
|
+}
|
|
|
+func multiplex6(a1, a2, a3, a4, a5, a6 string) string {
|
|
|
+ return strings.Join([]string{a1, a2, a3, a4, a5, a6}, " ")
|
|
|
}
|
|
|
|
|
|
/* Sample funcs */
|