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 "golang.org/x/net/context" | 8 "golang.org/x/net/context" |
9 ) | 9 ) |
10 | 10 |
11 // Interface is the 'user-friendly' interface to access the current filtered | 11 // Interface is the 'user-friendly' interface to access the current filtered |
12 // datastore service implementation. | 12 // datastore service implementation. |
13 // | 13 // |
14 // Note that in exchange for userfriendliness, this interface ends up doing | 14 // Note that in exchange for userfriendliness, this interface ends up doing |
15 // a lot of reflection. | 15 // a lot of reflection. |
16 // | 16 // |
17 // Methods taking 'interface{}' objects describe what a valid type for that | 17 // Methods taking 'interface{}' objects describe what a valid type for that |
18 // interface are in the comments. | 18 // interface are in the comments. |
19 // | 19 // |
20 // Struct objects passed in will be converted to PropertyLoadSaver interfaces | 20 // Struct objects passed in will be converted to PropertyLoadSaver interfaces |
21 // using this package's GetPLS function. | 21 // using this package's GetPLS function. |
22 type Interface interface { | 22 type Interface interface { |
| 23 // AllocateIDs allows you to allocate IDs from the datastore without put
ting |
| 24 // any data. `incomplete` must be a PartialValid Key. If there's no erro
r, |
| 25 // a contiguous block of IDs of n length starting at `start` will be res
erved |
| 26 // indefinitely for the user application code for use in new keys. The |
| 27 // appengine automatic ID generator will never automatically assign thes
e IDs |
| 28 // for Keys of this type. |
| 29 AllocateIDs(incomplete *Key, n int) (start int64, err error) |
| 30 |
23 // KeyForObj extracts a key from src. | 31 // KeyForObj extracts a key from src. |
24 // | 32 // |
25 // It is the same as KeyForObjErr, except that if KeyForObjErr would hav
e | 33 // It is the same as KeyForObjErr, except that if KeyForObjErr would hav
e |
26 // returned an error, this method panics. It's safe to use if you know t
hat | 34 // returned an error, this method panics. It's safe to use if you know t
hat |
27 // src statically meets the metadata constraints described by KeyForObjE
rr. | 35 // src statically meets the metadata constraints described by KeyForObjE
rr. |
28 KeyForObj(src interface{}) *Key | 36 KeyForObj(src interface{}) *Key |
29 | 37 |
30 // MakeKey is a convenience method for manufacturing a *Key. It should o
nly be | 38 // MakeKey is a convenience method for manufacturing a *Key. It should o
nly be |
31 // used when elems... is known statically (e.g. in the code) to be corre
ct. | 39 // used when elems... is known statically (e.g. in the code) to be corre
ct. |
32 // | 40 // |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 161 |
154 // Testable returns the Testable interface for the implementation, or ni
l if | 162 // Testable returns the Testable interface for the implementation, or ni
l if |
155 // there is none. | 163 // there is none. |
156 Testable() Testable | 164 Testable() Testable |
157 | 165 |
158 // Raw returns the underlying RawInterface. The Interface and RawInterfa
ce may | 166 // Raw returns the underlying RawInterface. The Interface and RawInterfa
ce may |
159 // be used interchangably; there's no danger of interleaving access to t
he | 167 // be used interchangably; there's no danger of interleaving access to t
he |
160 // datastore via the two. | 168 // datastore via the two. |
161 Raw() RawInterface | 169 Raw() RawInterface |
162 } | 170 } |
OLD | NEW |