OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
iannucci
2016/04/01 02:45:42
er... rebase?
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package dsQueryBatch | |
6 | |
7 import ( | |
8 ds "github.com/luci/gae/service/datastore" | |
9 "golang.org/x/net/context" | |
10 ) | |
11 | |
12 // BatchQueries installs a datastore filter that causes all queries to be broken | |
13 // into a series of iterative fixed-size queries. The batching uses cursors to | |
14 // chain the iterations together. | |
15 // | |
16 // This helps accommodate query size or time limits enforced by the backing | |
17 // datastore implementation. | |
18 // | |
19 // Note that this expands a single query into a series of queries, which may | |
20 // lose additional single-query consistency guarantees. | |
21 func BatchQueries(c context.Context, batchSize int32) context.Context { | |
22 return ds.AddRawFilters(c, func(ic context.Context, ri ds.RawInterface) ds.RawInterface { | |
23 return &iterQueryFilter{ | |
24 RawInterface: ri, | |
25 batchSize: batchSize, | |
26 } | |
27 }) | |
28 } | |
OLD | NEW |