diff --git a/controller/dev.go b/controller/dev.go index ca969ba1..c9f53db8 100644 --- a/controller/dev.go +++ b/controller/dev.go @@ -14,6 +14,8 @@ import ( "github.com/tidwall/tile38/controller/server" ) +// MASSINSERT num_keys num_points [minx miny maxx maxy] + const useRandField = true func randMassInsertPosition(minLat, minLon, maxLat, maxLon float64) (float64, float64) { diff --git a/controller/scanner.go b/controller/scanner.go index 54686478..9c742d59 100644 --- a/controller/scanner.go +++ b/controller/scanner.go @@ -154,11 +154,17 @@ func (sw *scanWriter) writeFoot(cursor uint64) { sw.wr.WriteString(`,"cursor":` + strconv.FormatUint(cursor, 10)) case server.RESP: sw.wr.Reset() - values := []resp.Value{ - resp.IntegerValue(int(cursor)), - resp.ArrayValue(sw.values), + var data []byte + var err error + if sw.output == outputCount { + data, err = resp.IntegerValue(int(sw.count)).MarshalRESP() + } else { + values := []resp.Value{ + resp.IntegerValue(int(cursor)), + resp.ArrayValue(sw.values), + } + data, err = resp.ArrayValue(values).MarshalRESP() } - data, err := resp.ArrayValue(values).MarshalRESP() if err != nil { panic("Eek this is bad. Marshal resp should not fail.") }