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

Unified Diff: impl/memory/raw_datastore.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: impl/memory/raw_datastore.go
diff --git a/impl/memory/raw_datastore.go b/impl/memory/raw_datastore.go
index 3908f145b48a3d3862c25186261744b122ea8956..4bef17d6a66040468ade38f9678524fa5472b02f 100644
--- a/impl/memory/raw_datastore.go
+++ b/impl/memory/raw_datastore.go
@@ -9,7 +9,7 @@ import (
"golang.org/x/net/context"
- rds "github.com/luci/gae/service/rawdatastore"
+ ds "github.com/luci/gae/service/datastore"
)
//////////////////////////////////// public ////////////////////////////////////
@@ -17,7 +17,7 @@ import (
// useRDS adds a gae.Datastore implementation to context, accessible
// by gae.GetDS(c)
func useRDS(c context.Context) context.Context {
- return rds.SetFactory(c, func(ic context.Context) rds.Interface {
+ return ds.SetRawFactory(c, func(ic context.Context) ds.RawInterface {
dsd := cur(ic).Get(memContextDSIdx)
ns := curGID(ic).namespace
@@ -37,36 +37,36 @@ type dsImpl struct {
c context.Context
}
-var _ rds.Interface = (*dsImpl)(nil)
+var _ ds.RawInterface = (*dsImpl)(nil)
-func (d *dsImpl) DecodeKey(encoded string) (rds.Key, error) {
- return rds.NewKeyFromEncoded(encoded)
+func (d *dsImpl) DecodeKey(encoded string) (ds.Key, error) {
+ return ds.NewKeyFromEncoded(encoded)
}
-func (d *dsImpl) NewKey(kind, stringID string, intID int64, parent rds.Key) rds.Key {
- return rds.NewKey(globalAppID, d.ns, kind, stringID, intID, parent)
+func (d *dsImpl) NewKey(kind, stringID string, intID int64, parent ds.Key) ds.Key {
+ return ds.NewKey(globalAppID, d.ns, kind, stringID, intID, parent)
}
-func (d *dsImpl) PutMulti(keys []rds.Key, vals []rds.PropertyLoadSaver, cb rds.PutMultiCB) error {
+func (d *dsImpl) PutMulti(keys []ds.Key, vals []ds.PropertyMap, cb ds.PutMultiCB) error {
d.data.putMulti(keys, vals, cb)
return nil
}
-func (d *dsImpl) GetMulti(keys []rds.Key, cb rds.GetMultiCB) error {
+func (d *dsImpl) GetMulti(keys []ds.Key, cb ds.GetMultiCB) error {
d.data.getMulti(keys, cb)
return nil
}
-func (d *dsImpl) DeleteMulti(keys []rds.Key, cb rds.DeleteMultiCB) error {
+func (d *dsImpl) DeleteMulti(keys []ds.Key, cb ds.DeleteMultiCB) error {
d.data.delMulti(keys, cb)
return nil
}
-func (d *dsImpl) NewQuery(kind string) rds.Query {
+func (d *dsImpl) NewQuery(kind string) ds.Query {
return &queryImpl{ns: d.ns, kind: kind}
}
-func (d *dsImpl) Run(q rds.Query, cb rds.RunCB) error {
+func (d *dsImpl) Run(q ds.Query, cb ds.RawRunCB) error {
return nil
/*
rq := q.(*queryImpl)
@@ -82,36 +82,36 @@ type txnDsImpl struct {
ns string
}
-var _ rds.Interface = (*txnDsImpl)(nil)
+var _ ds.RawInterface = (*txnDsImpl)(nil)
-func (d *txnDsImpl) DecodeKey(encoded string) (rds.Key, error) {
- return rds.NewKeyFromEncoded(encoded)
+func (d *txnDsImpl) DecodeKey(encoded string) (ds.Key, error) {
+ return ds.NewKeyFromEncoded(encoded)
}
-func (d *txnDsImpl) NewKey(kind, stringID string, intID int64, parent rds.Key) rds.Key {
- return rds.NewKey(globalAppID, d.ns, kind, stringID, intID, parent)
+func (d *txnDsImpl) NewKey(kind, stringID string, intID int64, parent ds.Key) ds.Key {
+ return ds.NewKey(globalAppID, d.ns, kind, stringID, intID, parent)
}
-func (d *txnDsImpl) PutMulti(keys []rds.Key, vals []rds.PropertyLoadSaver, cb rds.PutMultiCB) error {
+func (d *txnDsImpl) PutMulti(keys []ds.Key, vals []ds.PropertyMap, cb ds.PutMultiCB) error {
return d.data.run(func() error {
d.data.putMulti(keys, vals, cb)
return nil
})
}
-func (d *txnDsImpl) GetMulti(keys []rds.Key, cb rds.GetMultiCB) error {
+func (d *txnDsImpl) GetMulti(keys []ds.Key, cb ds.GetMultiCB) error {
return d.data.run(func() error {
return d.data.getMulti(keys, cb)
})
}
-func (d *txnDsImpl) DeleteMulti(keys []rds.Key, cb rds.DeleteMultiCB) error {
+func (d *txnDsImpl) DeleteMulti(keys []ds.Key, cb ds.DeleteMultiCB) error {
return d.data.run(func() error {
return d.data.delMulti(keys, cb)
})
}
-func (d *txnDsImpl) Run(q rds.Query, cb rds.RunCB) error {
+func (d *txnDsImpl) Run(q ds.Query, cb ds.RawRunCB) error {
rq := q.(*queryImpl)
if rq.ancestor == nil {
return errors.New("memory: queries in transactions only support ancestor queries")
@@ -119,10 +119,10 @@ func (d *txnDsImpl) Run(q rds.Query, cb rds.RunCB) error {
panic("NOT IMPLEMENTED")
}
-func (*txnDsImpl) RunInTransaction(func(c context.Context) error, *rds.TransactionOptions) error {
+func (*txnDsImpl) RunInTransaction(func(c context.Context) error, *ds.TransactionOptions) error {
return errors.New("datastore: nested transactions are not supported")
}
-func (d *txnDsImpl) NewQuery(kind string) rds.Query {
+func (d *txnDsImpl) NewQuery(kind string) ds.Query {
return &queryImpl{ns: d.ns, kind: kind}
}

Powered by Google App Engine
This is Rietveld 408576698