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

Side by Side Diff: milo/buildsource/buildbot/datastore.go

Issue 2977863002: [milo] Refactor all html knowledge out of backends. (Closed)
Patch Set: now with case insensitivity Created 3 years, 5 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
« no previous file with comments | « milo/buildsource/buildbot/buildinfo.go ('k') | milo/buildsource/buildbot/grpc.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The LUCI Authors. 1 // Copyright 2016 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 return &datastore.Batcher{ 38 return &datastore.Batcher{
39 Size: constraints.QueryBatchSize, 39 Size: constraints.QueryBatchSize,
40 } 40 }
41 } 41 }
42 42
43 // runBuildsQuery takes a buildbotBuild query and returns a list of builds 43 // runBuildsQuery takes a buildbotBuild query and returns a list of builds
44 // along with a cursor. We pass the limit here and apply it to the query as 44 // along with a cursor. We pass the limit here and apply it to the query as
45 // an optimization because then we can create a build container of that size. 45 // an optimization because then we can create a build container of that size.
46 func runBuildsQuery(c context.Context, q *datastore.Query, limit int32) ( 46 func runBuildsQuery(c context.Context, q *datastore.Query, limit int32) (
47 » []*buildbotBuild, *datastore.Cursor, error) { 47 » []*buildbotBuild, datastore.Cursor, error) {
48 48
49 if limit != 0 { 49 if limit != 0 {
50 q = q.Limit(limit) 50 q = q.Limit(limit)
51 } 51 }
52 builds := make([]*buildbotBuild, 0, limit) 52 builds := make([]*buildbotBuild, 0, limit)
53 » var nextCursor *datastore.Cursor 53 » var nextCursor datastore.Cursor
54 err := getBuildQueryBatcher(c).Run( 54 err := getBuildQueryBatcher(c).Run(
55 c, q, func(build *buildbotBuild, getCursor datastore.CursorCB) e rror { 55 c, q, func(build *buildbotBuild, getCursor datastore.CursorCB) e rror {
56 builds = append(builds, build) 56 builds = append(builds, build)
57 tmpCursor, err := getCursor() 57 tmpCursor, err := getCursor()
58 if err != nil { 58 if err != nil {
59 return err 59 return err
60 } 60 }
61 » » » nextCursor = &tmpCursor 61 » » » nextCursor = tmpCursor
62 return nil 62 return nil
63 }) 63 })
64 return builds, nextCursor, err 64 return builds, nextCursor, err
65 } 65 }
OLDNEW
« no previous file with comments | « milo/buildsource/buildbot/buildinfo.go ('k') | milo/buildsource/buildbot/grpc.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698