mirror of
				https://bitbucket.org/s_l_teichmann/mtsatellite
				synced 2025-11-04 09:55:34 +01:00 
			
		
		
		
	Started with db abstraction in seeder.
This commit is contained in:
		@@ -10,7 +10,6 @@ import (
 | 
			
		||||
	"os"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"sync"
 | 
			
		||||
 | 
			
		||||
	"bitbucket.org/s_l_teichmann/mtsatellite/common"
 | 
			
		||||
@@ -57,7 +56,7 @@ func createTiles(
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func createBaseLevel(
 | 
			
		||||
	address string,
 | 
			
		||||
	dbcc dbClientCreator,
 | 
			
		||||
	xMin, yMin, zMin, xMax, yMax, zMax int,
 | 
			
		||||
	transparent bool, transparentDim float32,
 | 
			
		||||
	colorsFile string, bg color.RGBA, outDir string,
 | 
			
		||||
@@ -79,17 +78,10 @@ func createBaseLevel(
 | 
			
		||||
	jobs := make(chan blockPos)
 | 
			
		||||
	var done sync.WaitGroup
 | 
			
		||||
 | 
			
		||||
	var proto string
 | 
			
		||||
	if strings.ContainsRune(address, '/') {
 | 
			
		||||
		proto = "unix"
 | 
			
		||||
	} else {
 | 
			
		||||
		proto = "tcp"
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for i := 0; i < numWorkers; i++ {
 | 
			
		||||
		var client *common.RedisClient
 | 
			
		||||
		var client common.DBClient
 | 
			
		||||
 | 
			
		||||
		if client, err = common.NewRedisClient(proto, address); err != nil {
 | 
			
		||||
		if client, err = dbcc(); err != nil {
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		done.Add(1)
 | 
			
		||||
 
 | 
			
		||||
@@ -6,9 +6,7 @@ package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"flag"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"log"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"bitbucket.org/s_l_teichmann/mtsatellite/common"
 | 
			
		||||
)
 | 
			
		||||
@@ -70,16 +68,12 @@ func main() {
 | 
			
		||||
 | 
			
		||||
	bg := common.ParseColorDefault(bgColor, common.BackgroundColor)
 | 
			
		||||
 | 
			
		||||
	dbcc := createDBClientCreator(host, port)
 | 
			
		||||
 | 
			
		||||
	if !skipBaseLevel {
 | 
			
		||||
		td := common.Clamp32f(float32(transparentDim/100.0), 0.0, 1.0)
 | 
			
		||||
		var address string
 | 
			
		||||
		if strings.ContainsRune(host, '/') {
 | 
			
		||||
			address = host
 | 
			
		||||
		} else {
 | 
			
		||||
			address = fmt.Sprintf("%s:%d", host, port)
 | 
			
		||||
		}
 | 
			
		||||
		if err := createBaseLevel(
 | 
			
		||||
			address,
 | 
			
		||||
			dbcc,
 | 
			
		||||
			xMin, yMin, zMin, xMax, yMax, zMax,
 | 
			
		||||
			transparent, td,
 | 
			
		||||
			colorsFile, bg,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user