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

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

Issue 1844183003: Don't filter "Stop" error in raw interface. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Count filter doesn't count Stop as error. Created 4 years, 8 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 | « filter/count/rds.go ('k') | impl/memory/datastore_query_execution_test.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 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 "sync" 10 "sync"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 if oldPM, err = rpm(old); err != nil { 276 if oldPM, err = rpm(old); err != nil {
277 return 277 return
278 } 278 }
279 } 279 }
280 ents.Set(keyBytes(ret), dataBytes) 280 ents.Set(keyBytes(ret), dataBytes)
281 updateIndexes(d.head, ret, oldPM, pmap) 281 updateIndexes(d.head, ret, oldPM, pmap)
282 return 282 return
283 }() 283 }()
284 if cb != nil { 284 if cb != nil {
285 if err := cb(k, err); err != nil { 285 if err := cb(k, err); err != nil {
286 if err == ds.Stop {
287 return nil
288 }
289 return err 286 return err
290 } 287 }
291 } 288 }
292 } 289 }
293 return nil 290 return nil
294 } 291 }
295 292
296 func getMultiInner(keys []*ds.Key, cb ds.GetMultiCB, getColl func() (*memCollect ion, error)) error { 293 func getMultiInner(keys []*ds.Key, cb ds.GetMultiCB, getColl func() (*memCollect ion, error)) error {
297 ents, err := getColl() 294 ents, err := getColl()
298 if err != nil { 295 if err != nil {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 if err != nil { 348 if err != nil {
352 return err 349 return err
353 } 350 }
354 ents.Delete(kb) 351 ents.Delete(kb)
355 updateIndexes(d.head, k, oldPM, nil) 352 updateIndexes(d.head, k, oldPM, nil)
356 } 353 }
357 return nil 354 return nil
358 }() 355 }()
359 if cb != nil { 356 if cb != nil {
360 if err := cb(err); err != nil { 357 if err := cb(err); err != nil {
361 if err == ds.Stop {
362 return nil
363 }
364 return err 358 return err
365 } 359 }
366 } 360 }
367 } 361 }
368 } else if cb != nil { 362 } else if cb != nil {
369 for range keys { 363 for range keys {
370 if err := cb(nil); err != nil { 364 if err := cb(nil); err != nil {
371 if err == ds.Stop {
372 return nil
373 }
374 return err 365 return err
375 } 366 }
376 } 367 }
377 } 368 }
378 return nil 369 return nil
379 } 370 }
380 371
381 func (d *dataStoreData) canApplyTxn(obj memContextObj) bool { 372 func (d *dataStoreData) canApplyTxn(obj memContextObj) bool {
382 // TODO(riannucci): implement with Flush/FlushRevert for persistance. 373 // TODO(riannucci): implement with Flush/FlushRevert for persistance.
383 374
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } 563 }
573 564
574 func keyBytes(key *ds.Key) []byte { 565 func keyBytes(key *ds.Key) []byte {
575 return serialize.ToBytes(ds.MkProperty(key)) 566 return serialize.ToBytes(ds.MkProperty(key))
576 } 567 }
577 568
578 func rpm(data []byte) (ds.PropertyMap, error) { 569 func rpm(data []byte) (ds.PropertyMap, error) {
579 return serialize.ReadPropertyMap(bytes.NewBuffer(data), 570 return serialize.ReadPropertyMap(bytes.NewBuffer(data),
580 serialize.WithContext, "", "") 571 serialize.WithContext, "", "")
581 } 572 }
OLDNEW
« no previous file with comments | « filter/count/rds.go ('k') | impl/memory/datastore_query_execution_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698