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 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 Loading... |
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 Loading... |
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 } |
OLD | NEW |