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

Side by Side Diff: service/datastore/interface.go

Issue 1357343002: Add missing AllocateIDs API. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: add panic Created 5 years, 2 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 | « service/datastore/checkfilter.go ('k') | service/datastore/raw_interface.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 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
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 }
OLDNEW
« no previous file with comments | « service/datastore/checkfilter.go ('k') | service/datastore/raw_interface.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698