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

Unified Diff: impl/memory/raw_datastore.go

Issue 1281173002: Refactor: Rename some files. (Closed) Base URL: https://github.com/luci/gae.git@tweak_testable
Patch Set: Created 5 years, 4 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
« no previous file with comments | « impl/memory/plist_test.go ('k') | impl/memory/raw_datastore_data.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/raw_datastore.go
diff --git a/impl/memory/raw_datastore.go b/impl/memory/raw_datastore.go
deleted file mode 100644
index 3c5a14c716d174608a2abf72d55570f08809daa9..0000000000000000000000000000000000000000
--- a/impl/memory/raw_datastore.go
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package memory
-
-import (
- "errors"
-
- "golang.org/x/net/context"
-
- ds "github.com/luci/gae/service/datastore"
-)
-
-//////////////////////////////////// public ////////////////////////////////////
-
-// useRDS adds a gae.Datastore implementation to context, accessible
-// by gae.GetDS(c)
-func useRDS(c context.Context) context.Context {
- return ds.SetRawFactory(c, func(ic context.Context) ds.RawInterface {
- dsd := cur(ic).Get(memContextDSIdx)
-
- ns := curGID(ic).namespace
- if x, ok := dsd.(*dataStoreData); ok {
- return &dsImpl{x, ns, ic}
- }
- return &txnDsImpl{dsd.(*txnDataStoreData), ns}
- })
-}
-
-//////////////////////////////////// dsImpl ////////////////////////////////////
-
-// dsImpl exists solely to bind the current c to the datastore data.
-type dsImpl struct {
- data *dataStoreData
- ns string
- c context.Context
-}
-
-var _ ds.RawInterface = (*dsImpl)(nil)
-
-func (d *dsImpl) DecodeKey(encoded string) (ds.Key, error) {
- return ds.NewKeyFromEncoded(encoded)
-}
-
-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 []ds.Key, vals []ds.PropertyMap, cb ds.PutMultiCB) error {
- d.data.putMulti(keys, vals, cb)
- return nil
-}
-
-func (d *dsImpl) GetMulti(keys []ds.Key, _meta ds.MultiMetaGetter, cb ds.GetMultiCB) error {
- d.data.getMulti(keys, cb)
- return nil
-}
-
-func (d *dsImpl) DeleteMulti(keys []ds.Key, cb ds.DeleteMultiCB) error {
- d.data.delMulti(keys, cb)
- return nil
-}
-
-func (d *dsImpl) NewQuery(kind string) ds.Query {
- return &queryImpl{ns: d.ns, kind: kind}
-}
-
-func (d *dsImpl) Run(q ds.Query, cb ds.RawRunCB) error {
- return nil
- /*
- rq := q.(*queryImpl)
- rq = rq.normalize().checkCorrectness(d.ns, false)
- return &queryIterImpl{rq}
- */
-}
-
-////////////////////////////////// txnDsImpl ///////////////////////////////////
-
-type txnDsImpl struct {
- data *txnDataStoreData
- ns string
-}
-
-var _ ds.RawInterface = (*txnDsImpl)(nil)
-
-func (d *txnDsImpl) DecodeKey(encoded string) (ds.Key, error) {
- return ds.NewKeyFromEncoded(encoded)
-}
-
-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 []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 []ds.Key, _meta ds.MultiMetaGetter, cb ds.GetMultiCB) error {
- return d.data.run(func() error {
- return d.data.getMulti(keys, cb)
- })
-}
-
-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 ds.Query, cb ds.RawRunCB) error {
- rq := q.(*queryImpl)
- if rq.ancestor == nil {
- return errors.New("memory: queries in transactions only support ancestor queries")
- }
- panic("NOT IMPLEMENTED")
-}
-
-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) ds.Query {
- return &queryImpl{ns: d.ns, kind: kind}
-}
« no previous file with comments | « impl/memory/plist_test.go ('k') | impl/memory/raw_datastore_data.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698