syncbase: implement client batches

Change-Id: I9556f926c32b6e37772d276975285c6bffb3a9fc
diff --git a/services/syncbase/server/app.go b/services/syncbase/server/app.go
index aa4bfb3..1e1fe1e 100644
--- a/services/syncbase/server/app.go
+++ b/services/syncbase/server/app.go
@@ -19,6 +19,7 @@
 	"v.io/v23/verror"
 )
 
+// app is a per-app singleton (i.e. not per-request) that handles App RPCs.
 type app struct {
 	name string
 	s    *service
@@ -66,12 +67,14 @@
 func (a *app) GlobChildren__(ctx *context.T, call rpc.ServerCall) (<-chan string, error) {
 	// Check perms.
 	sn := a.s.st.NewSnapshot()
+	closeSnapshot := func() error {
+		return sn.Close()
+	}
 	if err := util.Get(ctx, call, sn, a, &appData{}); err != nil {
-		sn.Close()
+		closeSnapshot()
 		return nil, err
 	}
-	pattern := "*"
-	return util.Glob(ctx, call, pattern, sn, util.JoinKeyParts(util.DbInfoPrefix, a.name))
+	return util.Glob(ctx, call, "*", sn, closeSnapshot, util.JoinKeyParts(util.DbInfoPrefix, a.name))
 }
 
 ////////////////////////////////////////