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 txnBuf | 5 package txnBuf |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "fmt" | 9 "fmt" |
10 "math/rand" | 10 "math/rand" |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 So(18, fooSetTo(ds), hugeField) | 374 So(18, fooSetTo(ds), hugeField) |
375 | 375 |
376 // We're over threshold! But the child will dele
te most of this and | 376 // We're over threshold! But the child will dele
te most of this and |
377 // bring us back to normal. | 377 // bring us back to normal. |
378 So(ds.RunInTransaction(func(c context.Context) e
rror { | 378 So(ds.RunInTransaction(func(c context.Context) e
rror { |
379 ds := datastore.Get(c) | 379 ds := datastore.Get(c) |
380 keys := make([]*datastore.Key, len(hugeD
ata)) | 380 keys := make([]*datastore.Key, len(hugeD
ata)) |
381 for i, d := range hugeData { | 381 for i, d := range hugeData { |
382 keys[i] = ds.KeyForObj(d) | 382 keys[i] = ds.KeyForObj(d) |
383 } | 383 } |
384 » » » » » return ds.DeleteMulti(keys) | 384 » » » » » return ds.DeleteMulti(keys...) |
385 }, nil), ShouldBeNil) | 385 }, nil), ShouldBeNil) |
386 | 386 |
387 return nil | 387 return nil |
388 }, &datastore.TransactionOptions{XG: true}), ShouldBeNil
) | 388 }, &datastore.TransactionOptions{XG: true}), ShouldBeNil
) |
389 | 389 |
390 So(18, fooShouldHave(ds), hugeField) | 390 So(18, fooShouldHave(ds), hugeField) |
391 }) | 391 }) |
392 }) | 392 }) |
393 } | 393 } |
394 | 394 |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 val := pm["Value"] | 901 val := pm["Value"] |
902 So(val[len(val)-1].Value(), ShouldResemb
le, "wat") | 902 So(val[len(val)-1].Value(), ShouldResemb
le, "wat") |
903 }), ShouldBeNil) | 903 }), ShouldBeNil) |
904 }) | 904 }) |
905 | 905 |
906 }) | 906 }) |
907 | 907 |
908 }) | 908 }) |
909 | 909 |
910 } | 910 } |
OLD | NEW |