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

Side by Side Diff: filter/dsQueryBatch/context.go

Issue 2021753002: Change gae to apache 2 license. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package dsQueryBatch 5 package dsQueryBatch
6 6
7 import ( 7 import (
8 ds "github.com/luci/gae/service/datastore" 8 ds "github.com/luci/gae/service/datastore"
9 "golang.org/x/net/context" 9 "golang.org/x/net/context"
10 ) 10 )
11 11
12 // BatchQueries installs a datastore filter that causes all queries to be broken 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 13 // into a series of iterative fixed-size queries. The batching uses cursors to
14 // chain the iterations together. 14 // chain the iterations together.
15 // 15 //
16 // This helps accommodate query size or time limits enforced by the backing 16 // This helps accommodate query size or time limits enforced by the backing
17 // datastore implementation. 17 // datastore implementation.
18 // 18 //
19 // Note that this expands a single query into a series of queries, which may 19 // Note that this expands a single query into a series of queries, which may
20 // lose additional single-query consistency guarantees. 20 // lose additional single-query consistency guarantees.
21 func BatchQueries(c context.Context, batchSize int32) context.Context { 21 func BatchQueries(c context.Context, batchSize int32) context.Context {
22 return ds.AddRawFilters(c, func(ic context.Context, ri ds.RawInterface) ds.RawInterface { 22 return ds.AddRawFilters(c, func(ic context.Context, ri ds.RawInterface) ds.RawInterface {
23 return &iterQueryFilter{ 23 return &iterQueryFilter{
24 RawInterface: ri, 24 RawInterface: ri,
25 batchSize: batchSize, 25 batchSize: batchSize,
26 } 26 }
27 }) 27 })
28 } 28 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698