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

Side by Side Diff: impl/memory/datastore_index_selection.go

Issue 1365743002: Refactor serialization helpers from impl/memory -> service/datastore/serialize (Closed) Base URL: https://github.com/luci/gae.git@estimate_size
Patch Set: rebassseeeee Created 5 years, 2 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 Chromium 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 by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package memory 5 package memory
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "fmt" 9 "fmt"
10 "sort" 10 "sort"
11 "strings" 11 "strings"
12 12
13 ds "github.com/luci/gae/service/datastore" 13 ds "github.com/luci/gae/service/datastore"
14 "github.com/luci/gae/service/datastore/serialize" 14 "github.com/luci/gae/service/datastore/serialize"
15 "github.com/luci/luci-go/common/stringset" 15 "github.com/luci/luci-go/common/stringset"
16 ) 16 )
17 17
18 var bjoin = serialize.Join
Vadim Sh. 2015/09/24 19:06:14 why?
iannucci 2015/09/24 19:43:41 lazy >_< fixed.
19
18 // reducedQuery contains only the pieces of the query necessary to iterate for 20 // reducedQuery contains only the pieces of the query necessary to iterate for
19 // results. 21 // results.
20 // deduplication is applied externally 22 // deduplication is applied externally
21 // projection / keysonly / entity retrieval is done externally 23 // projection / keysonly / entity retrieval is done externally
22 type reducedQuery struct { 24 type reducedQuery struct {
23 ns string 25 ns string
24 kind string 26 kind string
25 27
26 // eqFilters indicate the set of all prefix constraints which need to be 28 // eqFilters indicate the set of all prefix constraints which need to be
27 // fulfilled in the composite query. All of these will translate into pr efix 29 // fulfilled in the composite query. All of these will translate into pr efix
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 if bestIdx == nil { 533 if bestIdx == nil {
532 // something is really wrong here... if relevantIdxs is !nil, then we 534 // something is really wrong here... if relevantIdxs is !nil, then we
533 // should always be able to make progress in this loop. 535 // should always be able to make progress in this loop.
534 impossible(fmt.Errorf("deadlock: cannot fulfil query?")) 536 impossible(fmt.Errorf("deadlock: cannot fulfil query?"))
535 } 537 }
536 ret = append(ret, generate(q, bestIdx, constraints)) 538 ret = append(ret, generate(q, bestIdx, constraints))
537 } 539 }
538 540
539 return ret, nil 541 return ret, nil
540 } 542 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698