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 memory | 5 package memory |
6 | 6 |
7 import ( | 7 import ( |
8 "errors" | 8 "errors" |
9 "fmt" | 9 "fmt" |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // dsImpl exists solely to bind the current c to the datastore data. | 75 // dsImpl exists solely to bind the current c to the datastore data. |
76 type dsImpl struct { | 76 type dsImpl struct { |
77 data *dataStoreData | 77 data *dataStoreData |
78 ns string | 78 ns string |
79 hasNS bool | 79 hasNS bool |
80 c context.Context | 80 c context.Context |
81 } | 81 } |
82 | 82 |
83 var _ ds.RawInterface = (*dsImpl)(nil) | 83 var _ ds.RawInterface = (*dsImpl)(nil) |
84 | 84 |
85 func (d *dsImpl) AllocateIDs(incomplete *ds.Key, n int) (int64, error) { | 85 func (d *dsImpl) AllocateIDs(keys []*ds.Key, cb ds.PutMultiCB) error { |
86 » return d.data.allocateIDs(incomplete, n) | 86 » return d.data.allocateIDs(keys, cb) |
87 } | 87 } |
88 | 88 |
89 func (d *dsImpl) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.PutMultiC
B) error { | 89 func (d *dsImpl) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.PutMultiC
B) error { |
90 d.data.putMulti(keys, vals, cb) | 90 d.data.putMulti(keys, vals, cb) |
91 return nil | 91 return nil |
92 } | 92 } |
93 | 93 |
94 func (d *dsImpl) GetMulti(keys []*ds.Key, _meta ds.MultiMetaGetter, cb ds.GetMul
tiCB) error { | 94 func (d *dsImpl) GetMulti(keys []*ds.Key, _meta ds.MultiMetaGetter, cb ds.GetMul
tiCB) error { |
95 return d.data.getMulti(keys, cb) | 95 return d.data.getMulti(keys, cb) |
96 } | 96 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 ////////////////////////////////// txnDsImpl /////////////////////////////////// | 181 ////////////////////////////////// txnDsImpl /////////////////////////////////// |
182 | 182 |
183 type txnDsImpl struct { | 183 type txnDsImpl struct { |
184 data *txnDataStoreData | 184 data *txnDataStoreData |
185 ns string | 185 ns string |
186 hasNS bool | 186 hasNS bool |
187 } | 187 } |
188 | 188 |
189 var _ ds.RawInterface = (*txnDsImpl)(nil) | 189 var _ ds.RawInterface = (*txnDsImpl)(nil) |
190 | 190 |
191 func (d *txnDsImpl) AllocateIDs(incomplete *ds.Key, n int) (int64, error) { | 191 func (d *txnDsImpl) AllocateIDs(keys []*ds.Key, cb ds.PutMultiCB) error { |
192 » return d.data.parent.allocateIDs(incomplete, n) | 192 » return d.data.parent.allocateIDs(keys, cb) |
193 } | 193 } |
194 | 194 |
195 func (d *txnDsImpl) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.PutMul
tiCB) error { | 195 func (d *txnDsImpl) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.PutMul
tiCB) error { |
196 return d.data.run(func() error { | 196 return d.data.run(func() error { |
197 d.data.putMulti(keys, vals, cb) | 197 d.data.putMulti(keys, vals, cb) |
198 return nil | 198 return nil |
199 }) | 199 }) |
200 } | 200 } |
201 | 201 |
202 func (d *txnDsImpl) GetMulti(keys []*ds.Key, _meta ds.MultiMetaGetter, cb ds.Get
MultiCB) error { | 202 func (d *txnDsImpl) GetMulti(keys []*ds.Key, _meta ds.MultiMetaGetter, cb ds.Get
MultiCB) error { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 if ns == "" && hasNS { | 252 if ns == "" && hasNS { |
253 // The user has set an empty namespace. Datastore does not suppo
rt this | 253 // The user has set an empty namespace. Datastore does not suppo
rt this |
254 // for queries. | 254 // for queries. |
255 // | 255 // |
256 // Bug on file is: | 256 // Bug on file is: |
257 // https://code.google.com/p/googleappengine/issues/detail?id=12
914 | 257 // https://code.google.com/p/googleappengine/issues/detail?id=12
914 |
258 return errors.New("namespace may not be present and empty") | 258 return errors.New("namespace may not be present and empty") |
259 } | 259 } |
260 return nil | 260 return nil |
261 } | 261 } |
OLD | NEW |