luis 7 лет назад
Родитель
Сommit
5c9b760428

+ 1 - 1
.drone.yml

@@ -34,7 +34,7 @@ pipeline:
       - go get -d ./go/src/...
       - go get -d -t ./go/src/...
       - go/deps/bin/gocov test -v -race ./go/src/... | go/deps/bin/gocov report
-      - CGO_ENABLED=0 go build -o DIST/flowserver flowserver/cmd/flowserver  
+      - CGO_ENABLED=0 go build -o DIST/demo1 flow/cmd/demo1  
   rebuild-cache:
     image: drillster/drone-volume-cache
     rebuild: true

+ 5 - 5
Makefile

@@ -1,5 +1,5 @@
 
-all: DIST/flowserver DIST/web
+all: DIST/demo1 DIST/web
 
 clean:
 	rm -rf DIST
@@ -7,7 +7,7 @@ clean:
 DIST:
 	mkdir -p DIST
 
-DIST/flowserver: DIST
+DIST/demo1: DIST
 	cd go;make
 	cp go/DIST/* DIST/
 
@@ -20,7 +20,7 @@ DIST/web: DIST browser/vue-flow/node_modules
 	cd browser/vue-flow;yarn build
 	cp -r browser/vue-flow/dist/* DIST/web
 
-DIST/.dockerized: DIST/flowserver DIST/web
+DIST/.dockerized: DIST/demo1 DIST/web
 	docker build --rm -t hexasoftware.com:5000/flow-proto -f ./docker/Dockerfile .
 	touch DIST/.dockerized
 
@@ -32,10 +32,10 @@ push: DIST/.dockerized
 
 frontend: DIST/web
 
-backend: DIST/flowserver
+backend: DIST/demo1
 
 dev: clean backend
-	tmux split "DEBUG=1 DIST/flowserver;$$SHELL"
+	tmux split "DEBUG=1 DIST/demo1;$$SHELL"
 	cd browser/vue-flow; yarn dev
 
 builder:

+ 1 - 1
docker/Dockerfile

@@ -2,4 +2,4 @@ FROM scratch
 COPY DIST/ /app
 WORKDIR /app
 EXPOSE 2015
-CMD ["/app/flowserver"]
+CMD ["/app/demo1"]

+ 2 - 2
go/Makefile

@@ -1,4 +1,4 @@
-# Luis Figueiredo (luisf@casemyway.com)
+# Luis Figueiredo (luisf@hexasoftware.com)
 # 
 
 GOPATH=$(CURDIR)/deps:$(CURDIR)
@@ -11,7 +11,7 @@ GETENV=
 # What packages to build
 
 # CLI Packages
-CLI=flowserver/cmd/flowserver
+CLI=flow/cmd/demo1
 BIN=$(addprefix $(DIST)/, $(notdir $(CLI)))
 
 # Windows build

+ 2 - 2
go/src/flowserver/cmd/flowserver/main.go

@@ -2,8 +2,8 @@ package main
 
 import (
 	"flow"
+	"flow/flowserver"
 	"flow/registry"
-	"flowserver"
 	"fmt"
 	"io"
 	"log"
@@ -62,7 +62,7 @@ func stream(w io.Writer, val interface{}) interface{} {
 ////////////////////
 // Testing custom struct operations
 /////
-//
+
 // CustomStruct testing custom struct passing
 type CustomStruct struct {
 	Name string

+ 0 - 3
go/src/flow/flow_test.go

@@ -4,7 +4,6 @@ import (
 	"bytes"
 	"encoding/json"
 	"errors"
-	"log"
 	"testing"
 	"time"
 
@@ -56,12 +55,10 @@ func TestIDGen(t *testing.T) {
 
 	f := flow.New()
 	f.SetIDGen(func() string {
-		log.Println("Requesting ID", len(idTable))
 		if len(idTable) == 0 {
 			return "0"
 		}
 		newID := idTable[len(idTable)-1]
-		t.Log("Returning ID", newID)
 		idTable = idTable[:len(idTable)-1]
 		return newID
 	})

+ 1 - 1
go/src/flowserver/chatroom.go

@@ -2,7 +2,7 @@ package flowserver
 
 import (
 	"errors"
-	"flowserver/flowmsg"
+	"flow/flowserver/flowmsg"
 	"log"
 	"sync"
 

go/src/flowserver/flowbuilder.go → go/src/flow/flowserver/flowbuilder.go


go/src/flowserver/flowmsg/flowmessage.go → go/src/flow/flowserver/flowmsg/flowmessage.go


go/src/flowserver/flowserver.go → go/src/flow/flowserver/flowserver.go


+ 1 - 1
go/src/flowserver/session.go

@@ -4,8 +4,8 @@ import (
 	"encoding/json"
 	"errors"
 	"flow"
+	"flow/flowserver/flowmsg"
 	"flow/registry"
-	"flowserver/flowmsg"
 	"fmt"
 	"io/ioutil"
 	"log"

+ 1 - 1
go/src/flowserver/sessionmgr.go

@@ -4,7 +4,7 @@ import (
 	"encoding/json"
 	"errors"
 	"flow"
-	"flowserver/flowmsg"
+	"flow/flowserver/flowmsg"
 	"log"
 	"net/http"
 	"path/filepath"

go/src/flowserver/version.go → go/src/flow/flowserver/version.go


+ 0 - 1
go/src/flowserver/util.go

@@ -1 +0,0 @@
-package flowserver

+ 0 - 138
go/src/flowx/main.go

@@ -1,138 +0,0 @@
-package main
-
-import (
-	"encoding/json"
-	"flow"
-	"flow/registry"
-	"flowserver"
-	"log"
-
-	"github.com/gohxs/prettylog"
-)
-
-const jsonRaw = `
-{
- "nodes": [
-  {
-   "id": "38d76987-290f-ea1d-0ba0-3c63c1bde6a0",
-   "label": "MatMul",
-   "src": "StrCat",
-   "x": 447,
-   "y": 290.34375
-  },
-  {
-   "id": "378e389b-27d3-8b66-90fa-664bcab18a38",
-   "label": "Variable",
-   "src": "Variable",
-   "x": 229,
-   "y": 383.34375
-  },
-  {
-   "id": "3e589bf7-f415-7a31-94e4-7ec8fa28b0c1",
-   "label": "Input",
-   "src": "Input",
-   "x": 250,
-   "y": 165.34375
-  },
-  {
-   "id": "97d5a94f-0e43-df2d-e97d-f347dd186682",
-   "label": "Activator",
-   "src": "StrReverse",
-   "x": 637,
-   "y": 332.34375
-  }
- ],
- "links": [
-  {
-   "from": "3e589bf7-f415-7a31-94e4-7ec8fa28b0c1",
-   "in": 0,
-   "to": "38d76987-290f-ea1d-0ba0-3c63c1bde6a0"
-  },
-  {
-   "from": "378e389b-27d3-8b66-90fa-664bcab18a38",
-   "in": 1,
-   "to": "38d76987-290f-ea1d-0ba0-3c63c1bde6a0"
-  },
-  {
-   "from": "38d76987-290f-ea1d-0ba0-3c63c1bde6a0",
-   "in": 0,
-   "to": "97d5a94f-0e43-df2d-e97d-f347dd186682"
-  }
- ]
-}`
-
-func main() {
-	prettylog.Global()
-	doc := flowserver.FlowDocument{
-		Nodes: []flowserver.Node{},
-		Links: []flowserver.Link{},
-	}
-	json.Unmarshal([]byte(jsonRaw), &doc)
-	// Handling flow
-	//
-	reg := registry.New()
-	reg.Register("StrCat", StrCat)
-	reg.Register("StrReverse", StrReverse)
-
-	f := flow.New()
-	f.SetRegistry(reg)
-
-	nodeMap := map[string]flowserver.Node{}
-	for _, n := range doc.Nodes {
-		nodeMap[n.ID] = n
-	}
-	inputMap := map[string]flow.Operation{}
-
-	ninput := 0
-	for _, n := range doc.Nodes {
-		// Find link refered as To
-		param := make([]interface{}, 10) // 10 is temporary to test out operations
-		lastParamID := -1
-		for _, l := range doc.Links {
-			if l.To != n.ID {
-				continue
-			}
-			if l.In > lastParamID {
-				lastParamID = l.In
-			}
-			// Define operators here
-			from := nodeMap[l.From]
-			switch from.Src {
-			case "Input":
-				inOp, ok := inputMap[n.ID]
-				if !ok {
-					inOp = f.In(ninput)
-					inputMap[n.ID] = inOp
-					ninput++
-				}
-				param[l.In] = inOp // By id perhaps
-			case "Variable":
-				param[l.In] = f.Var(from.ID, "Temporary")
-			default:
-				param[l.In] = f.Res(from.ID)
-			}
-		}
-		param = param[:lastParamID+1]
-		if n.Src == "Input" || n.Src == "Variable" {
-			continue
-		}
-		f.DefOp(n.ID, n.Src, param...)
-	}
-
-	log.Println("Flow:\n", f)
-	f.Analyse(nil, "my string")
-
-}
-
-func StrCat(a1 string, a2 string) string {
-	return a1 + a2
-}
-func StrReverse(s string) string {
-	n := len(s)
-	runes := make([]rune, n)
-	for _, r := range s {
-		n--
-		runes[n] = r
-	}
-	return string(runes[n:])
-}