OLD | NEW |
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" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 buf indexRowGen | 158 buf indexRowGen |
159 } | 159 } |
160 | 160 |
161 // matcher.match checks to see if the mapped, serialized property values | 161 // matcher.match checks to see if the mapped, serialized property values |
162 // match the index. If they do, it returns a indexRowGen. Do not write or modify | 162 // match the index. If they do, it returns a indexRowGen. Do not write or modify |
163 // the data in the indexRowGen. | 163 // the data in the indexRowGen. |
164 func (m *matcher) match(idx *ds.IndexDefinition, sip serializedIndexablePmap) (i
ndexRowGen, bool) { | 164 func (m *matcher) match(idx *ds.IndexDefinition, sip serializedIndexablePmap) (i
ndexRowGen, bool) { |
165 m.buf.propVec = m.buf.propVec[:0] | 165 m.buf.propVec = m.buf.propVec[:0] |
166 m.buf.orders = m.buf.orders[:0] | 166 m.buf.orders = m.buf.orders[:0] |
167 for _, sb := range idx.SortBy { | 167 for _, sb := range idx.SortBy { |
| 168 if sb.Property == "__key__" { |
| 169 panic("don't know how to build compound index on __key__
") |
| 170 } |
168 if pv, ok := sip[sb.Property]; ok { | 171 if pv, ok := sip[sb.Property]; ok { |
169 m.buf.propVec = append(m.buf.propVec, pv) | 172 m.buf.propVec = append(m.buf.propVec, pv) |
170 m.buf.orders = append(m.buf.orders, sb.Direction) | 173 m.buf.orders = append(m.buf.orders, sb.Direction) |
171 } else { | 174 } else { |
172 return indexRowGen{}, false | 175 return indexRowGen{}, false |
173 } | 176 } |
174 } | 177 } |
175 return m.buf, true | 178 return m.buf, true |
176 } | 179 } |
177 | 180 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 } | 315 } |
313 | 316 |
314 func updateIndicies(store *memStore, key ds.Key, oldEnt, newEnt ds.PropertyMap)
{ | 317 func updateIndicies(store *memStore, key ds.Key, oldEnt, newEnt ds.PropertyMap)
{ |
315 // load all current complex query index definitions. | 318 // load all current complex query index definitions. |
316 compIdx := getCompIdxs(getIdxColl(store)) | 319 compIdx := getCompIdxs(getIdxColl(store)) |
317 | 320 |
318 mergeIndexes(key.Namespace(), store, | 321 mergeIndexes(key.Namespace(), store, |
319 indexEntriesWithBuiltins(key, oldEnt, compIdx), | 322 indexEntriesWithBuiltins(key, oldEnt, compIdx), |
320 indexEntriesWithBuiltins(key, newEnt, compIdx)) | 323 indexEntriesWithBuiltins(key, newEnt, compIdx)) |
321 } | 324 } |
OLD | NEW |