mirror of https://github.com/tidwall/tile38.git
Added geom indexing environment options
T38IDXGEOM -- Point threshold for indexing geometry T38IDXMULTI -- Child threshold for indexing multi/collection Default is 64 Using zero will disable indexing Example: T38IDXGEOM=0 tile38-server # disables geometry indexing T38IDXGEOM=256 tile38-server # indexing geometries 256+ points
This commit is contained in:
parent
d64aad9be0
commit
8ee4c10862
|
@ -12,6 +12,7 @@ import (
|
|||
"path/filepath"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -63,6 +64,9 @@ type Controller struct {
|
|||
config *Config
|
||||
epc *endpoint.Manager
|
||||
|
||||
// env opts
|
||||
geomParseOpts geojson.ParseOptions
|
||||
|
||||
// atomics
|
||||
followc aint // counter increases when follow property changes
|
||||
statsTotalConns aint // counter for total connections
|
||||
|
@ -140,6 +144,7 @@ func ListenAndServeEx(host string, port int, dir string, ln *net.Listener, http
|
|||
http: http,
|
||||
pubsub: newPubsub(),
|
||||
}
|
||||
|
||||
c.hookex.Expired = func(item expire.Item) {
|
||||
switch v := item.(type) {
|
||||
case *Hook:
|
||||
|
@ -159,6 +164,19 @@ func ListenAndServeEx(host string, port int, dir string, ln *net.Listener, http
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.geomParseOpts = *geojson.DefaultParseOptions
|
||||
n, err := strconv.ParseUint(os.Getenv("T38IDXGEOM"), 10, 32)
|
||||
if err == nil {
|
||||
c.geomParseOpts.IndexGeometry = int(n)
|
||||
}
|
||||
n, err = strconv.ParseUint(os.Getenv("T38IDXMULTI"), 10, 32)
|
||||
if err == nil {
|
||||
c.geomParseOpts.IndexChildren = int(n)
|
||||
}
|
||||
log.Debugf("geom indexing: %d", c.geomParseOpts.IndexGeometry)
|
||||
log.Debugf("multi indexing: %d", c.geomParseOpts.IndexChildren)
|
||||
|
||||
// load the queue before the aof
|
||||
qdb, err := buntdb.Open(core.QueueFileName)
|
||||
if err != nil {
|
||||
|
|
|
@ -689,7 +689,7 @@ func (c *Controller) parseSetArgs(vs []resp.Value) (
|
|||
err = errInvalidNumberOfArguments
|
||||
return
|
||||
}
|
||||
d.obj, err = geojson.Parse(object, nil)
|
||||
d.obj, err = geojson.Parse(object, &c.geomParseOpts)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue