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} |
-} |