cleanup
This commit is contained in:
parent
ddda7dbe60
commit
90d902e99b
@ -39,7 +39,7 @@ build: $(OUT_DIR)
|
||||
# apt install gcc-mingw-w64
|
||||
GOARCH=386 GOOS=windows CC=i686-w64-mingw32-gcc CGO_ENABLED=1 go build -o $(OUT_DIR)/mapserver-windows-x86.exe
|
||||
GOARCH=amd64 GOOS=windows CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 go build -o $(OUT_DIR)/mapserver-windows-x86-64.exe
|
||||
# apt install gcc-5-arm-linux-gnueabihf, TODO: container
|
||||
# apt install gcc-5-arm-linux-gnueabihf
|
||||
GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc-5 CGO_ENABLED=1 go build $(GO_LDFLAGS) -o $(OUT_DIR)/mapserver-linux-arm
|
||||
|
||||
#go test -cpuprofile cpu.prof -memprofile mem.prof -bench . ./mapblockrenderer/
|
||||
|
@ -75,8 +75,6 @@ func (m *ColorMapping) LoadBytes(buffer []byte) (int, error) {
|
||||
return count, nil
|
||||
}
|
||||
|
||||
//TODO: colors from fs
|
||||
|
||||
func (m *ColorMapping) LoadVFSColors(useLocal bool, filename string) (int, error) {
|
||||
buffer, err := vfs.FSByte(useLocal, "/colors.txt")
|
||||
if err != nil {
|
||||
|
@ -16,7 +16,7 @@ type InitialBlocksResult struct {
|
||||
List []*Block
|
||||
UnfilteredCount int
|
||||
HasMore bool
|
||||
Progress float64
|
||||
Progress float64
|
||||
}
|
||||
|
||||
type DBAccessor interface {
|
||||
|
@ -73,10 +73,10 @@ func (this *PostgresAccessor) FindNextInitialBlocks(s settings.Settings, layers
|
||||
tcr.Pos2.Y = toY
|
||||
|
||||
fields := logrus.Fields{
|
||||
"layerId": lastlayer,
|
||||
"pos1": tcr.Pos1,
|
||||
"pos2": tcr.Pos2,
|
||||
"tile": tc,
|
||||
"layerId": lastlayer,
|
||||
"pos1": tcr.Pos1,
|
||||
"pos2": tcr.Pos2,
|
||||
"tile": tc,
|
||||
}
|
||||
log.WithFields(fields).Debug("Initial-Query")
|
||||
|
||||
@ -112,7 +112,7 @@ func (this *PostgresAccessor) FindNextInitialBlocks(s settings.Settings, layers
|
||||
s.SetInt(SETTING_LAST_Y_BLOCK, lastyblock+1)
|
||||
|
||||
result := &db.InitialBlocksResult{}
|
||||
result.Progress = float64(((lastyblock+128) * 256) + (lastxblock+128)) / float64(256*256)
|
||||
result.Progress = float64(((lastyblock+128)*256)+(lastxblock+128)) / float64(256*256)
|
||||
result.HasMore = true
|
||||
return result, nil
|
||||
}
|
||||
@ -153,7 +153,7 @@ func (this *PostgresAccessor) FindNextInitialBlocks(s settings.Settings, layers
|
||||
s.SetInt(SETTING_LAST_Y_BLOCK, lastyblock)
|
||||
|
||||
result := &db.InitialBlocksResult{}
|
||||
result.Progress = float64(((lastyblock+128) * 256) + (lastxblock+128)) / float64(256*256)
|
||||
result.Progress = float64(((lastyblock+128)*256)+(lastxblock+128)) / float64(256*256)
|
||||
result.List = blocks
|
||||
result.HasMore = true
|
||||
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
SETTING_LAST_POS = "last_pos"
|
||||
SETTING_TOTAL_LEGACY_COUNT = "total_legacy_count"
|
||||
SETTING_LAST_POS = "last_pos"
|
||||
SETTING_TOTAL_LEGACY_COUNT = "total_legacy_count"
|
||||
SETTING_PROCESSED_LEGACY_COUNT = "total_processed_legacy_count"
|
||||
)
|
||||
|
||||
@ -75,7 +75,7 @@ func (this *Sqlite3Accessor) FindNextInitialBlocks(s settings.Settings, layers [
|
||||
}
|
||||
}
|
||||
|
||||
s.SetInt64(SETTING_PROCESSED_LEGACY_COUNT, int64(result.UnfilteredCount) + processedcount)
|
||||
s.SetInt64(SETTING_PROCESSED_LEGACY_COUNT, int64(result.UnfilteredCount)+processedcount)
|
||||
|
||||
result.Progress = float64(processedcount) / float64(totallegacycount)
|
||||
result.List = blocks
|
||||
|
@ -69,7 +69,6 @@ func main() {
|
||||
}
|
||||
|
||||
//Start http server
|
||||
//TODO: defer, may cause race condition
|
||||
web.Serve(ctx)
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ type FindNextLegacyBlocksResult struct {
|
||||
HasMore bool
|
||||
List []*mapblockparser.MapBlock
|
||||
UnfilteredCount int
|
||||
Progress float64
|
||||
Progress float64
|
||||
}
|
||||
|
||||
func (a *MapBlockAccessor) FindNextLegacyBlocks(s settings.Settings, layers []*layer.Layer, limit int) (*FindNextLegacyBlocksResult, error) {
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
"mapserver/mapblockparser"
|
||||
|
||||
cache "github.com/patrickmn/go-cache"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type FindMapBlocksByMtimeResult struct {
|
||||
|
@ -8,8 +8,6 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
//TODO: mapdata struct with accessors
|
||||
|
||||
func parseMapdata(mapblock *MapBlock, data []byte) (int, error) {
|
||||
r := bytes.NewReader(data)
|
||||
|
||||
|
@ -2,9 +2,9 @@ package mapblockparser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"mapserver/coords"
|
||||
"strconv"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
func Parse(data []byte, mtime int64, pos *coords.MapBlockCoords) (*MapBlock, error) {
|
||||
@ -13,7 +13,7 @@ func Parse(data []byte, mtime int64, pos *coords.MapBlockCoords) (*MapBlock, err
|
||||
}
|
||||
|
||||
timer := prometheus.NewTimer(parseDuration)
|
||||
defer timer.ObserveDuration()
|
||||
defer timer.ObserveDuration()
|
||||
|
||||
mapblock := NewMapblock()
|
||||
mapblock.Mtime = mtime
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
"mapserver/mapblockaccessor"
|
||||
"time"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type MapBlockRenderer struct {
|
||||
@ -82,7 +82,7 @@ func (r *MapBlockRenderer) Render(pos1, pos2 *coords.MapBlockCoords) (*image.NRG
|
||||
|
||||
renderedMapblocks.Inc()
|
||||
timer := prometheus.NewTimer(renderDuration)
|
||||
defer timer.ObserveDuration()
|
||||
defer timer.ObserveDuration()
|
||||
|
||||
start := time.Now()
|
||||
defer func() {
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
|
||||
"github.com/dgraph-io/badger"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
)
|
||||
|
||||
func New(path string) (*TileDB, error) {
|
||||
|
@ -12,8 +12,8 @@ import (
|
||||
"mapserver/layer"
|
||||
"mapserver/mapblockrenderer"
|
||||
"mapserver/tiledb"
|
||||
"time"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -98,7 +98,7 @@ func (tr *TileRenderer) RenderImage(tc *coords.TileCoords, recursionDepth int) (
|
||||
|
||||
log.WithFields(logrus.Fields{"x": tc.X, "y": tc.Y, "zoom": tc.Zoom}).Debug("RenderImage")
|
||||
|
||||
renderedTiles.With(prometheus.Labels{"zoom":strconv.Itoa(tc.Zoom)}).Inc()
|
||||
renderedTiles.With(prometheus.Labels{"zoom": strconv.Itoa(tc.Zoom)}).Inc()
|
||||
timer := prometheus.NewTimer(renderDuration)
|
||||
defer timer.ObserveDuration()
|
||||
|
||||
|
@ -2,13 +2,13 @@ package web
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"mapserver/app"
|
||||
"mapserver/coords"
|
||||
"mapserver/mapobjectdb"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
type MapObjects struct {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"image/color"
|
||||
"mapserver/app"
|
||||
"mapserver/coords"
|
||||
@ -8,11 +9,8 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
|
||||
|
||||
type Tiles struct {
|
||||
ctx *app.App
|
||||
blank []byte
|
||||
@ -35,7 +33,6 @@ func (t *Tiles) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
|
||||
timer := prometheus.NewTimer(tileServeDuration)
|
||||
defer timer.ObserveDuration()
|
||||
|
||||
|
||||
layerid, _ := strconv.Atoi(parts[0])
|
||||
x, _ := strconv.Atoi(parts[1])
|
||||
y, _ := strconv.Atoi(parts[2])
|
||||
|
Loading…
Reference in New Issue
Block a user