Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: filter/dsQueryBatch/context.go

Issue 1846123002: Fix missing/broken ds.Stop handling in raw DS. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: filter/dsQueryBatch/context.go
diff --git a/filter/dsQueryBatch/context.go b/filter/dsQueryBatch/context.go
new file mode 100644
index 0000000000000000000000000000000000000000..ec31ed2e0ac4e0efb833cc175e603861cb3d5706
--- /dev/null
+++ b/filter/dsQueryBatch/context.go
@@ -0,0 +1,28 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
iannucci 2016/04/01 02:45:42 er... rebase?
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package dsQueryBatch
+
+import (
+ ds "github.com/luci/gae/service/datastore"
+ "golang.org/x/net/context"
+)
+
+// BatchQueries installs a datastore filter that causes all queries to be broken
+// into a series of iterative fixed-size queries. The batching uses cursors to
+// chain the iterations together.
+//
+// This helps accommodate query size or time limits enforced by the backing
+// datastore implementation.
+//
+// Note that this expands a single query into a series of queries, which may
+// lose additional single-query consistency guarantees.
+func BatchQueries(c context.Context, batchSize int32) context.Context {
+ return ds.AddRawFilters(c, func(ic context.Context, ri ds.RawInterface) ds.RawInterface {
+ return &iterQueryFilter{
+ RawInterface: ri,
+ batchSize: batchSize,
+ }
+ })
+}
« filter/count/count.go ('K') | « filter/count/rds.go ('k') | filter/dsQueryBatch/filter.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698