Chromium Code Reviews| 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 datastore | 5 package datastore |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 | 9 |
| 10 "golang.org/x/net/context" | 10 "golang.org/x/net/context" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 return nullMetaGetter | 98 return nullMetaGetter |
| 99 } | 99 } |
| 100 return m[idx] | 100 return m[idx] |
| 101 } | 101 } |
| 102 | 102 |
| 103 // RawInterface implements the datastore functionality without any of the fancy | 103 // RawInterface implements the datastore functionality without any of the fancy |
| 104 // reflection stuff. This is so that Filters can avoid doing lots of redundant | 104 // reflection stuff. This is so that Filters can avoid doing lots of redundant |
| 105 // reflection work. See datastore.Interface for a more user-friendly interface. | 105 // reflection work. See datastore.Interface for a more user-friendly interface. |
| 106 type RawInterface interface { | 106 type RawInterface interface { |
| 107 // AllocateIDs allows you to allocate IDs from the datastore without put ting | 107 // AllocateIDs allows you to allocate IDs from the datastore without put ting |
| 108 » // any data. `incomplete` must be a PartialValid Key. If there's no erro r, | 108 » // any data. The supplied keys must be PartialValid and share the same e ntity |
| 109 » // a contiguous block of IDs of n length starting at `start` will be res erved | 109 » // type. |
| 110 » // indefinitely for the user application code for use in new keys. The | 110 » // |
| 111 » // appengine automatic ID generator will never automatically assign thes e IDs | 111 » // If there's no error, the keys in the slice will be replaced with keys |
| 112 » // for Keys of this type. | 112 » // containing integer IDs assigned to them. |
| 113 » AllocateIDs(incomplete *Key, n int) (start int64, err error) | 113 » AllocateIDs(keys []*Key, cb PutMultiCB) error |
|
iannucci
2016/06/14 01:46:04
maybe PutMultiCB should be renamed? Or duplicated
| |
| 114 | 114 |
| 115 // RunInTransaction runs f in a transaction. | 115 // RunInTransaction runs f in a transaction. |
| 116 // | 116 // |
| 117 // opts may be nil. | 117 // opts may be nil. |
| 118 // | 118 // |
| 119 // NOTE: Implementations and filters are guaranteed that: | 119 // NOTE: Implementations and filters are guaranteed that: |
| 120 // - f is not nil | 120 // - f is not nil |
| 121 RunInTransaction(f func(c context.Context) error, opts *TransactionOptio ns) error | 121 RunInTransaction(f func(c context.Context) error, opts *TransactionOptio ns) error |
| 122 | 122 |
| 123 // DecodeCursor converts a string returned by a Cursor into a Cursor ins tance. | 123 // DecodeCursor converts a string returned by a Cursor into a Cursor ins tance. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 // - len(keys) > 0 | 171 // - len(keys) > 0 |
| 172 // - all keys are Valid, !Incomplete, and in the current namespace | 172 // - all keys are Valid, !Incomplete, and in the current namespace |
| 173 // - none keys of the keys are 'special' (use a kind prefixed with '__ ') | 173 // - none keys of the keys are 'special' (use a kind prefixed with '__ ') |
| 174 // - cb is not nil | 174 // - cb is not nil |
| 175 DeleteMulti(keys []*Key, cb DeleteMultiCB) error | 175 DeleteMulti(keys []*Key, cb DeleteMultiCB) error |
| 176 | 176 |
| 177 // Testable returns the Testable interface for the implementation, or ni l if | 177 // Testable returns the Testable interface for the implementation, or ni l if |
| 178 // there is none. | 178 // there is none. |
| 179 Testable() Testable | 179 Testable() Testable |
| 180 } | 180 } |
| OLD | NEW |