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

Unified Diff: impl/memory/datastore_index_selection.go

Issue 2302743002: Interface update, per-method Contexts. (Closed)
Patch Set: Lightning talk licenses. Created 4 years, 3 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
« no previous file with comments | « impl/memory/datastore_index.go ('k') | impl/memory/datastore_query.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/datastore_index_selection.go
diff --git a/impl/memory/datastore_index_selection.go b/impl/memory/datastore_index_selection.go
index 2a5fe2fd8a3ead0eead812ed785186dbb3458cdf..26203eaa3140a51bd2e105c4aaa5a229cf287cfa 100644
--- a/impl/memory/datastore_index_selection.go
+++ b/impl/memory/datastore_index_selection.go
@@ -36,8 +36,7 @@ func (e *ErrMissingIndex) Error() string {
// deduplication is applied externally
// projection / keysonly / entity retrieval is done externally
type reducedQuery struct {
- aid string
- ns string
+ kc ds.KeyContext
kind string
// eqFilters indicate the set of all prefix constraints which need to be
@@ -197,7 +196,7 @@ func (idxs *indexDefinitionSortableSlice) maybeAddDefinition(q *reducedQuery, s
// a builtin and it doesn't exist, it still needs to be one of the 'possible'
// indexes... it just means that the user's query will end up with no results.
coll := s.GetCollection(
- fmt.Sprintf("idx:%s:%s", q.ns, serialize.ToBytes(*id.PrepForIdxTable())))
+ fmt.Sprintf("idx:%s:%s", q.kc.Namespace, serialize.ToBytes(*id.PrepForIdxTable())))
// First, see if it's a perfect match. If it is, then our search is over.
//
@@ -319,7 +318,7 @@ func getRelevantIndexes(q *reducedQuery, s memStore) (indexDefinitionSortableSli
impossible(
fmt.Errorf("recommended missing index would be a builtin: %s", remains))
}
- return nil, &ErrMissingIndex{q.ns, remains}
+ return nil, &ErrMissingIndex{q.kc.Namespace, remains}
}
return idxs, nil
@@ -471,7 +470,7 @@ func calculateConstraints(q *reducedQuery) *constraints {
func getIndexes(q *reducedQuery, s memStore) ([]*iterDefinition, error) {
relevantIdxs := indexDefinitionSortableSlice(nil)
if q.kind == "" {
- if coll := s.GetCollection("ents:" + q.ns); coll != nil {
+ if coll := s.GetCollection("ents:" + q.kc.Namespace); coll != nil {
relevantIdxs = indexDefinitionSortableSlice{{coll: coll}}
}
} else {
« no previous file with comments | « impl/memory/datastore_index.go ('k') | impl/memory/datastore_query.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698