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

Side by Side Diff: filter/txnBuf/txnbuf_test.go

Issue 2007123002: datastore: Update AllocateIDs to take keys. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Rebase, comments. Created 4 years, 6 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/txnBuf/state.go ('k') | impl/dummy/dummy.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 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 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 123 }
124 124
125 for i := range hugeData { 125 for i := range hugeData {
126 hugeData[i] = &Foo{ID: int64(i + 1), ValueNI: hugeField} 126 hugeData[i] = &Foo{ID: int64(i + 1), ValueNI: hugeField}
127 } 127 }
128 } 128 }
129 129
130 func mkds(data []*Foo) (under, over *count.DSCounter, ds datastore.Interface) { 130 func mkds(data []*Foo) (under, over *count.DSCounter, ds datastore.Interface) {
131 c := memory.UseWithAppID(context.Background(), "something~else") 131 c := memory.UseWithAppID(context.Background(), "something~else")
132 ds = datastore.Get(c) 132 ds = datastore.Get(c)
133 » _, err := ds.AllocateIDs(ds.KeyForObj(data[0]), 100) 133
134 » if err != nil { 134 » dataKey := ds.KeyForObj(data[0])
135 » if err := ds.AllocateIDs(ds.NewIncompleteKeys(100, dataKey.Kind(), dataK ey.Parent())); err != nil {
135 panic(err) 136 panic(err)
136 } 137 }
137 if err := ds.PutMulti(data); err != nil { 138 if err := ds.PutMulti(data); err != nil {
138 panic(err) 139 panic(err)
139 } 140 }
140 141
141 c, under = count.FilterRDS(c) 142 c, under = count.FilterRDS(c)
142 c = FilterRDS(c) 143 c = FilterRDS(c)
143 c, over = count.FilterRDS(c) 144 c, over = count.FilterRDS(c)
144 ds = datastore.Get(c) 145 ds = datastore.Get(c)
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 val := pm["Value"] 902 val := pm["Value"]
902 So(val[len(val)-1].Value(), ShouldResemb le, "wat") 903 So(val[len(val)-1].Value(), ShouldResemb le, "wat")
903 }), ShouldBeNil) 904 }), ShouldBeNil)
904 }) 905 })
905 906
906 }) 907 })
907 908
908 }) 909 })
909 910
910 } 911 }
OLDNEW
« no previous file with comments | « filter/txnBuf/state.go ('k') | impl/dummy/dummy.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698