| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package memory | 5 package memory |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "bytes" | 8 "bytes" |
| 9 "errors" | 9 "errors" |
| 10 "fmt" | 10 "fmt" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } | 136 } |
| 137 return newNormalStrategy(rq.kc, cb, head) | 137 return newNormalStrategy(rq.kc, cb, head) |
| 138 } | 138 } |
| 139 | 139 |
| 140 func parseSuffix(aid, ns string, suffixFormat []ds.IndexColumn, suffix []byte, c
ount int) (raw [][]byte, decoded []ds.Property) { | 140 func parseSuffix(aid, ns string, suffixFormat []ds.IndexColumn, suffix []byte, c
ount int) (raw [][]byte, decoded []ds.Property) { |
| 141 buf := serialize.Invertible(bytes.NewBuffer(suffix)) | 141 buf := serialize.Invertible(bytes.NewBuffer(suffix)) |
| 142 decoded = make([]ds.Property, len(suffixFormat)) | 142 decoded = make([]ds.Property, len(suffixFormat)) |
| 143 raw = make([][]byte, len(suffixFormat)) | 143 raw = make([][]byte, len(suffixFormat)) |
| 144 | 144 |
| 145 err := error(nil) | 145 err := error(nil) |
| 146 » kc := ds.KeyContext{aid, ns} | 146 » kc := ds.MkKeyContext(aid, ns) |
| 147 for i := range decoded { | 147 for i := range decoded { |
| 148 if count >= 0 && i >= count { | 148 if count >= 0 && i >= count { |
| 149 break | 149 break |
| 150 } | 150 } |
| 151 needInvert := suffixFormat[i].Descending | 151 needInvert := suffixFormat[i].Descending |
| 152 | 152 |
| 153 buf.SetInvert(needInvert) | 153 buf.SetInvert(needInvert) |
| 154 decoded[i], err = serialize.ReadProperty(buf, serialize.WithoutC
ontext, kc) | 154 decoded[i], err = serialize.ReadProperty(buf, serialize.WithoutC
ontext, kc) |
| 155 memoryCorruption(err) | 155 memoryCorruption(err) |
| 156 | 156 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 keyProp := decodedProps[len(decodedProps)-1] | 293 keyProp := decodedProps[len(decodedProps)-1] |
| 294 if keyProp.Type() != ds.PTKey { | 294 if keyProp.Type() != ds.PTKey { |
| 295 impossible(fmt.Errorf("decoded index row doesn't end wit
h a Key: %#v", keyProp)) | 295 impossible(fmt.Errorf("decoded index row doesn't end wit
h a Key: %#v", keyProp)) |
| 296 } | 296 } |
| 297 | 297 |
| 298 return strategy.handle( | 298 return strategy.handle( |
| 299 rawData, decodedProps, keyProp.Value().(*ds.Key), | 299 rawData, decodedProps, keyProp.Value().(*ds.Key), |
| 300 getCursorFn(suffix)) | 300 getCursorFn(suffix)) |
| 301 }) | 301 }) |
| 302 } | 302 } |
| OLD | NEW |