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

Unified Diff: service/datastore/raw_interface.go

Issue 1259593005: Add 'user friendly' datastore API. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: 100% coverage of new code Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: service/datastore/raw_interface.go
diff --git a/service/rawdatastore/interface.go b/service/datastore/raw_interface.go
similarity index 82%
rename from service/rawdatastore/interface.go
rename to service/datastore/raw_interface.go
index 220cf6ec5026f9fa2e7008beb77499ee3f5f95a0..5fd860f073e15f24d554f0bfe662d7ea3d347f12 100644
--- a/service/rawdatastore/interface.go
+++ b/service/datastore/raw_interface.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package rawdatastore
+package datastore
import (
"fmt"
@@ -51,16 +51,16 @@ type Query interface {
Start(c Cursor) Query
}
-// RunCB is the callback signature provided to Interface.Run
+// RawRunCB is the callback signature provided to RawInterface.Run
//
// - key is the Key of the entity
// - val is the data of the entity (or nil, if the query was keys-only)
// - getCursor can be invoked to obtain the current cursor.
//
// Return true to continue iterating through the query results, or false to stop.
-type RunCB func(key Key, val PropertyMap, getCursor func() (Cursor, error)) bool
+type RawRunCB func(key Key, val PropertyMap, getCursor func() (Cursor, error)) bool
-// GetMultiCB is the callback signature provided to Interface.GetMulti
+// GetMultiCB is the callback signature provided to RawInterface.GetMulti
//
// - val is the data of the entity
// * It may be nil if some of the keys to the GetMulti were bad, since all
@@ -68,7 +68,7 @@ type RunCB func(key Key, val PropertyMap, getCursor func() (Cursor, error)) bool
// - err is an error associated with this entity (e.g. ErrNoSuchEntity).
type GetMultiCB func(val PropertyMap, err error)
-// PutMultiCB is the callback signature provided to Interface.PutMulti
+// PutMultiCB is the callback signature provided to RawInterface.PutMulti
//
// - key is the new key for the entity (if the original was incomplete)
// * It may be nil if some of the keys/vals to the PutMulti were bad, since
@@ -76,15 +76,15 @@ type GetMultiCB func(val PropertyMap, err error)
// - err is an error associated with putting this entity.
type PutMultiCB func(key Key, err error)
-// DeleteMultiCB is the callback signature provided to Interface.DeleteMulti
+// DeleteMultiCB is the callback signature provided to RawInterface.DeleteMulti
//
// - err is an error associated with deleting this entity.
type DeleteMultiCB func(err error)
-// Interface implements the datastore functionality without any of the fancy
+// RawInterface implements the datastore functionality without any of the fancy
// reflection stuff. This is so that Filters can avoid doing lots of redundant
-// reflection work. See datastore.Interface for a more user-friendly interface.
-type Interface interface {
+// reflection work. See datastore.RawInterface for a more user-friendly interface.
+type RawInterface interface {
NewKey(kind, stringID string, intID int64, parent Key) Key
DecodeKey(encoded string) (Key, error)
NewQuery(kind string) Query
@@ -92,7 +92,7 @@ type Interface interface {
RunInTransaction(f func(c context.Context) error, opts *TransactionOptions) error
// Run executes the given query, and calls `cb` for each successfully item.
- Run(q Query, cb RunCB) error
+ Run(q Query, cb RawRunCB) error
// GetMulti retrieves items from the datastore.
//
@@ -111,9 +111,8 @@ type Interface interface {
//
// NOTE: Implementations and filters are guaranteed that len(keys) ==
// len(vals), that keys are all Valid, and in the correct namespace.
- // Additionally, vals are guaranteed to be PropertyMaps already. Callback
- // may be nil.
- PutMulti(keys []Key, vals []PropertyLoadSaver, cb PutMultiCB) error
+ // Callback may be nil.
+ PutMulti(keys []Key, vals []PropertyMap, cb PutMultiCB) error
// DeleteMulti removes items from the datastore.
//

Powered by Google App Engine
This is Rietveld 408576698