From 97332cc3e1d714fa074f2458e6bf017bc6e0671d Mon Sep 17 00:00:00 2001 From: Josh Baker Date: Mon, 23 May 2016 14:21:18 -0700 Subject: [PATCH] fixed resp count --- controller/dev.go | 2 ++ controller/scanner.go | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) 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.") }