Browse Source

Remove gorail

Project is no longer available on Github. Uncertain
what happened, but it appears to been made closed
source for the time being
Hamilton Turner 10 years ago
parent
commit
2bc9f82493

+ 0 - 1
.travis.yml

@@ -43,7 +43,6 @@ env:
     - "TESTDIR=Go/falcore"
     - "TESTDIR=Go/falcore"
     - "TESTDIR=Go/gin"
     - "TESTDIR=Go/gin"
     - "TESTDIR=Go/go"
     - "TESTDIR=Go/go"
-    - "TESTDIR=Go/gorail"
     - "TESTDIR=Go/revel"
     - "TESTDIR=Go/revel"
     - "TESTDIR=Go/revel-jet"
     - "TESTDIR=Go/revel-jet"
     - "TESTDIR=Go/revel-qbs"
     - "TESTDIR=Go/revel-qbs"

+ 0 - 17
frameworks/Go/gorail/README.md

@@ -1,17 +0,0 @@
-# Gorail Core Benchmarking Test
-
-This is the Gorail Core portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
-Gorail Core is a lightweight HTTP server framework, for those who don't want an over simplied framework
-
-### JSON Encoding Test
-* [JSON test source](src/hello/hello.go)
-
-## Versions
-
-* [Go 1.2](http://golang.org/)
-
-## Test URLs
-
-### JSON Encoding Test
-
-http://localhost:8080/json

+ 0 - 4
frameworks/Go/gorail/bash_profile.sh

@@ -1,4 +0,0 @@
-# Set the root of our go installation
-export GOROOT=${IROOT}/go
-
-export GOPATH=${TROOT}

+ 0 - 28
frameworks/Go/gorail/benchmark_config

@@ -1,28 +0,0 @@
-{
-  "framework": "gorail",
-  "tests": [{
-    "default": {
-      "setup_file": "setup",
-      "json_url": "/json",
-      "db_url": "/db",
-      "query_url": "/queries?queries=",
-      "fortune_url": "/fortune",
-      "update_url": "/update?queries=",
-      "plaintext_url": "/plaintext",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Micro",
-      "database": "MySQL",
-      "framework": "gorail",
-      "language": "Go",
-      "orm": "Raw",
-      "platform": "Go",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "gorail",
-      "notes": "",
-      "versus": "go"
-    }
-  }]
-}

+ 0 - 3
frameworks/Go/gorail/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends go

+ 0 - 2
frameworks/Go/gorail/setup.bat

@@ -1,2 +0,0 @@
-set GOPATH=C:\FrameworkBenchmarks\gorail
-go run src\hello\hello.go

+ 0 - 10
frameworks/Go/gorail/setup.sh

@@ -1,10 +0,0 @@
-#!/bin/bash
-
-sed -i 's|tcp(.*:3306)|tcp('"${DBHOST}"':3306)|g' src/hello/hello.go
-
-# Where to find the go executable
-export PATH="$GOROOT/bin:$PATH"
-
-go get ./...
-
-go run src/hello/hello.go &

+ 0 - 6
frameworks/Go/gorail/source_code

@@ -1,6 +0,0 @@
-./go/src/
-./go/src/hello
-./go/src/hello/hello.go
-./go/templates/
-./go/templates/fortune.html
-./go/templates/layout.html

+ 0 - 199
frameworks/Go/gorail/src/hello/hello.go

@@ -1,199 +0,0 @@
-package main
-
-import (
-	"database/sql"
-	"github.com/gorail/core"
-	"html/template"
-	"log"
-	"math/rand"
-	"net/http"
-	"runtime"
-	"sort"
-	"strconv"
-
-	_ "github.com/go-sql-driver/mysql"
-)
-
-type Message struct {
-	Message string `json:"message"`
-}
-
-type World struct {
-	Id           uint16 `json:"id"`
-	RandomNumber uint16 `json:"randomNumber"`
-}
-
-type Fortune struct {
-	Id      uint16 `json:"id"`
-	Message string `json:"message"`
-}
-
-const (
-	// Database
-	connectionString   = "benchmarkdbuser:benchmarkdbpass@tcp(localhost:3306)/hello_world"
-	worldSelect        = "SELECT id, randomNumber FROM World WHERE id = ?"
-	worldUpdate        = "UPDATE World SET randomNumber = ? WHERE id = ?"
-	fortuneSelect      = "SELECT id, message FROM Fortune;"
-	worldRowCount      = 10000
-	maxConnectionCount = 256
-
-	helloWorldString = "Hello, World!"
-)
-
-var (
-	// Templates
-	tmpl = template.Must(template.ParseFiles("templates/layout.html", "templates/fortune.html"))
-
-	// Database
-	worldStatement   *sql.Stmt
-	fortuneStatement *sql.Stmt
-	updateStatement  *sql.Stmt
-
-	helloWorldBytes = []byte(helloWorldString)
-)
-
-func main() {
-	runtime.GOMAXPROCS(runtime.NumCPU())
-
-	db, err := sql.Open("mysql", connectionString)
-	if err != nil {
-		log.Fatalf("Error opening database: %v", err)
-	}
-	db.SetMaxIdleConns(maxConnectionCount)
-	worldStatement, err = db.Prepare(worldSelect)
-	if err != nil {
-		log.Fatal(err)
-	}
-	fortuneStatement, err = db.Prepare(fortuneSelect)
-	if err != nil {
-		log.Fatal(err)
-	}
-	updateStatement, err = db.Prepare(worldUpdate)
-	if err != nil {
-		log.Fatal(err)
-	}
-
-	app := core.NewApp()
-
-	app.DefaultRouter = app.DirRouter("main").RegisterFuncMap(core.FuncMap{
-		"db":        dbHandler,
-		"queries":   queriesHandler,
-		"json":      jsonHandler,
-		"fortune":   fortuneHandler,
-		"update":    updateHandler,
-		"plaintext": plaintextHandler,
-	})
-
-	app.Listen(":8080")
-}
-
-// Test 1: JSON serialization
-func jsonHandler(c *core.Context) {
-	c.Res.Header().Set("Content-Type", "application/javascript")
-	c.Json().Send(&Message{helloWorldString})
-}
-
-// Test 2: Single database query
-func dbHandler(c *core.Context) {
-	var world World
-	err := worldStatement.QueryRow(rand.Intn(worldRowCount)+1).Scan(&world.Id, &world.RandomNumber)
-	if err != nil {
-		log.Fatalf("Error scanning world row: %s", err.Error())
-	}
-
-	c.Res.Header().Set("Content-Type", "application/json")
-	c.Json().Send(&world)
-}
-
-// Test 3: Multiple database queries
-func queriesHandler(c *core.Context) {
-	n := 1
-	if nStr := c.Req.URL.Query().Get("queries"); len(nStr) > 0 {
-		n, _ = strconv.Atoi(nStr)
-	}
-
-	if n <= 1 {
-		dbHandler(c)
-		return
-	}
-
-	world := make([]World, n)
-	for i := 0; i < n; i++ {
-		err := worldStatement.QueryRow(rand.Intn(worldRowCount)+1).Scan(&world[i].Id, &world[i].RandomNumber)
-		if err != nil {
-			log.Fatalf("Error scanning world row: %s", err.Error())
-		}
-	}
-
-	c.Res.Header().Set("Content-Type", "application/json")
-	c.Json().Send(world)
-}
-
-// Test 4: Fortunes
-func fortuneHandler(c *core.Context) {
-	rows, err := fortuneStatement.Query()
-	if err != nil {
-		log.Fatalf("Error preparing statement: %v", err)
-	}
-
-	fortunes := make(Fortunes, 0, 16)
-	for rows.Next() { //Fetch rows
-		fortune := Fortune{}
-		if err := rows.Scan(&fortune.Id, &fortune.Message); err != nil {
-			log.Fatalf("Error scanning fortune row: %s", err.Error())
-		}
-		fortunes = append(fortunes, &fortune)
-	}
-	fortunes = append(fortunes, &Fortune{Message: "Additional fortune added at request time."})
-
-	sort.Sort(ByMessage{fortunes})
-	c.Res.Header().Set("Content-Type", "text/html")
-	if err := tmpl.Execute(c.Res, fortunes); err != nil {
-		http.Error(c.Res, err.Error(), http.StatusInternalServerError)
-	}
-}
-
-// Test 5: Database updates
-func updateHandler(c *core.Context) {
-	n := 1
-	if nStr := c.Req.URL.Query().Get("queries"); len(nStr) > 0 {
-		n, _ = strconv.Atoi(nStr)
-	}
-
-	c.Res.Header().Set("Content-Type", "application/json")
-
-	if n <= 1 {
-		var world World
-		worldStatement.QueryRow(rand.Intn(worldRowCount)+1).Scan(&world.Id, &world.RandomNumber)
-		world.RandomNumber = uint16(rand.Intn(worldRowCount) + 1)
-		updateStatement.Exec(world.RandomNumber, world.Id)
-		c.Json().Send(&world)
-	} else {
-		world := make([]World, n)
-		for i := 0; i < n; i++ {
-			if err := worldStatement.QueryRow(rand.Intn(worldRowCount)+1).Scan(&world[i].Id, &world[i].RandomNumber); err != nil {
-				log.Fatalf("Error scanning world row: %s", err.Error())
-			}
-			world[i].RandomNumber = uint16(rand.Intn(worldRowCount) + 1)
-			if _, err := updateStatement.Exec(world[i].RandomNumber, world[i].Id); err != nil {
-				log.Fatalf("Error updating world row: %s", err.Error())
-			}
-		}
-		c.Json().Send(world)
-	}
-}
-
-// Test 6: Plaintext
-func plaintextHandler(c *core.Context) {
-	c.Res.Header().Set("Content-Type", "text/plain")
-	c.Res.Write(helloWorldBytes)
-}
-
-type Fortunes []*Fortune
-
-func (s Fortunes) Len() int      { return len(s) }
-func (s Fortunes) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
-type ByMessage struct{ Fortunes }
-
-func (s ByMessage) Less(i, j int) bool { return s.Fortunes[i].Message < s.Fortunes[j].Message }

+ 0 - 14
frameworks/Go/gorail/templates/fortune.html

@@ -1,14 +0,0 @@
-{{define "content"}}
-<table>
-<tr>
-<th>id</th>
-<th>message</th>
-</tr>
-{{range .}}
-<tr>
-<td>{{.Id}}</td>
-<td>{{.Message}}</td>
-</tr>
-{{end}}
-</table>
-{{end}}

+ 0 - 9
frameworks/Go/gorail/templates/layout.html

@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title>Fortunes</title>
-</head>
-<body>
-{{template "content" .}}
-</body>
-</html>