TBR syncbase: s/end/limit/

Change-Id: I58ddab25a705e00787d71f2dda6c267f5884f770
diff --git a/services/syncbase/store/leveldb/db.go b/services/syncbase/store/leveldb/db.go
index 6f89ac8..ee49b1c 100644
--- a/services/syncbase/store/leveldb/db.go
+++ b/services/syncbase/store/leveldb/db.go
@@ -97,13 +97,13 @@
 }
 
 // Scan implements the store.StoreReader interface.
-func (d *db) Scan(start, end []byte) store.Stream {
+func (d *db) Scan(start, limit []byte) store.Stream {
 	d.mu.RLock()
 	defer d.mu.RUnlock()
 	if d.err != nil {
 		return &store.InvalidStream{d.err}
 	}
-	return newStream(d, start, end, d.readOptions)
+	return newStream(d, start, limit, d.readOptions)
 }
 
 // Put implements the store.StoreWriter interface.
diff --git a/services/syncbase/store/leveldb/snapshot.go b/services/syncbase/store/leveldb/snapshot.go
index 7b82c7c..1e920fd 100644
--- a/services/syncbase/store/leveldb/snapshot.go
+++ b/services/syncbase/store/leveldb/snapshot.go
@@ -64,11 +64,11 @@
 }
 
 // Scan implements the store.StoreReader interface.
-func (s *snapshot) Scan(start, end []byte) store.Stream {
+func (s *snapshot) Scan(start, limit []byte) store.Stream {
 	s.mu.RLock()
 	defer s.mu.RUnlock()
 	if s.err != nil {
 		return &store.InvalidStream{s.err}
 	}
-	return newStream(s.d, start, end, s.cOpts)
+	return newStream(s.d, start, limit, s.cOpts)
 }
diff --git a/services/syncbase/store/leveldb/stream.go b/services/syncbase/store/leveldb/stream.go
index 4705e59..bc146e8 100644
--- a/services/syncbase/store/leveldb/stream.go
+++ b/services/syncbase/store/leveldb/stream.go
@@ -21,7 +21,7 @@
 	// mu protects the state of the stream.
 	mu    sync.Mutex
 	cIter *C.syncbase_leveldb_iterator_t
-	end   []byte
+	limit []byte
 
 	hasAdvanced bool
 	err         error
@@ -37,12 +37,12 @@
 
 var _ store.Stream = (*stream)(nil)
 
-func newStream(d *db, start, end []byte, cOpts *C.leveldb_readoptions_t) *stream {
+func newStream(d *db, start, limit []byte, cOpts *C.leveldb_readoptions_t) *stream {
 	cStr, size := cSlice(start)
 	cIter := C.syncbase_leveldb_create_iterator(d.cDb, cOpts, cStr, size)
 	return &stream{
 		cIter: cIter,
-		end:   end,
+		limit: limit,
 	}
 }
 
@@ -66,7 +66,7 @@
 	} else {
 		C.syncbase_leveldb_iter_next(s.cIter)
 	}
-	if s.cIter.is_valid != 0 && (len(s.end) == 0 || bytes.Compare(s.cKey(), s.end) < 0) {
+	if s.cIter.is_valid != 0 && (len(s.limit) == 0 || bytes.Compare(s.cKey(), s.limit) < 0) {
 		s.hasValue = true
 		s.key = s.cKey()
 		s.value = s.cVal()
diff --git a/services/syncbase/store/leveldb/transaction.go b/services/syncbase/store/leveldb/transaction.go
index 12c3a65..2137978 100644
--- a/services/syncbase/store/leveldb/transaction.go
+++ b/services/syncbase/store/leveldb/transaction.go
@@ -70,13 +70,13 @@
 }
 
 // Scan implements the store.StoreReader interface.
-func (tx *transaction) Scan(start, end []byte) store.Stream {
+func (tx *transaction) Scan(start, limit []byte) store.Stream {
 	tx.mu.Lock()
 	defer tx.mu.Unlock()
 	if tx.err != nil {
 		return &store.InvalidStream{tx.err}
 	}
-	return tx.snapshot.Scan(start, end)
+	return tx.snapshot.Scan(start, limit)
 }
 
 // Put implements the store.StoreWriter interface.
diff --git a/services/syncbase/store/memstore/stream.go b/services/syncbase/store/memstore/stream.go
index 221d33c..f60e27e 100644
--- a/services/syncbase/store/memstore/stream.go
+++ b/services/syncbase/store/memstore/stream.go
@@ -23,10 +23,10 @@
 
 var _ store.Stream = (*stream)(nil)
 
-func newStream(sn *snapshot, start, end []byte) *stream {
+func newStream(sn *snapshot, start, limit []byte) *stream {
 	keys := []string{}
 	for k := range sn.data {
-		if k >= string(start) && (len(end) == 0 || k < string(end)) {
+		if k >= string(start) && (len(limit) == 0 || k < string(limit)) {
 			keys = append(keys, k)
 		}
 	}
diff --git a/services/syncbase/store/model.go b/services/syncbase/store/model.go
index 22a5c99..8d85b2a 100644
--- a/services/syncbase/store/model.go
+++ b/services/syncbase/store/model.go
@@ -16,8 +16,8 @@
 	// fails with ErrUnknownKey.
 	Get(key, valbuf []byte) ([]byte, error)
 
-	// Scan returns all rows with keys in range [start, end).
-	Scan(start, end []byte) Stream
+	// Scan returns all rows with keys in range [start, limit).
+	Scan(start, limit []byte) Stream
 }
 
 // StoreWriter writes data to a CRUD-capable storage engine.
diff --git a/services/syncbase/store/test/store.go b/services/syncbase/store/test/store.go
index a0b150f..08b39b5 100644
--- a/services/syncbase/store/test/store.go
+++ b/services/syncbase/store/test/store.go
@@ -88,13 +88,13 @@
 	}
 	// Verify 10 random Scan() calls.
 	for i := 0; i < 10; i++ {
-		start, end := s.rnd.Intn(s.size), s.rnd.Intn(s.size)
-		if start > end {
-			start, end = end, start
+		start, limit := s.rnd.Intn(s.size), s.rnd.Intn(s.size)
+		if start > limit {
+			start, limit = limit, start
 		}
-		end++
-		stream := st.Scan([]byte(fmt.Sprintf("%05d", start)), []byte(fmt.Sprintf("%05d", end)))
-		for start = s.lowerBound(start); start < end; start = s.lowerBound(start + 1) {
+		limit++
+		stream := st.Scan([]byte(fmt.Sprintf("%05d", start)), []byte(fmt.Sprintf("%05d", limit)))
+		for start = s.lowerBound(start); start < limit; start = s.lowerBound(start + 1) {
 			keystr := fmt.Sprintf("%05d", start)
 			verifyAdvance(t, stream, []byte(keystr), s.memtable[keystr])
 		}