| Index: service/datastore/checkfilter.go
|
| diff --git a/service/rawdatastore/checkfilter.go b/service/datastore/checkfilter.go
|
| similarity index 67%
|
| rename from service/rawdatastore/checkfilter.go
|
| rename to service/datastore/checkfilter.go
|
| index 002c965f5437ede665dab45770b842d0b19526bf..87d30eb29a1c3f68189d786412dd4aa2901649c1 100644
|
| --- a/service/rawdatastore/checkfilter.go
|
| +++ b/service/datastore/checkfilter.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"
|
| @@ -13,7 +13,7 @@ import (
|
| )
|
|
|
| type checkFilter struct {
|
| - Interface
|
| + RawInterface
|
|
|
| aid string
|
| ns string
|
| @@ -23,14 +23,14 @@ func (tcf *checkFilter) RunInTransaction(f func(c context.Context) error, opts *
|
| if f == nil {
|
| return nil
|
| }
|
| - return tcf.Interface.RunInTransaction(f, opts)
|
| + return tcf.RawInterface.RunInTransaction(f, opts)
|
| }
|
|
|
| -func (tcf *checkFilter) Run(q Query, cb RunCB) error {
|
| +func (tcf *checkFilter) Run(q Query, cb RawRunCB) error {
|
| if q == nil || cb == nil {
|
| return nil
|
| }
|
| - return tcf.Interface.Run(q, cb)
|
| + return tcf.RawInterface.Run(q, cb)
|
| }
|
|
|
| func (tcf *checkFilter) GetMulti(keys []Key, cb GetMultiCB) error {
|
| @@ -49,12 +49,12 @@ func (tcf *checkFilter) GetMulti(keys []Key, cb GetMultiCB) error {
|
| }
|
| return nil
|
| }
|
| - return tcf.Interface.GetMulti(keys, cb)
|
| + return tcf.RawInterface.GetMulti(keys, cb)
|
| }
|
|
|
| -func (tcf *checkFilter) PutMulti(keys []Key, vals []PropertyLoadSaver, cb PutMultiCB) error {
|
| +func (tcf *checkFilter) PutMulti(keys []Key, vals []PropertyMap, cb PutMultiCB) error {
|
| if len(keys) != len(vals) {
|
| - return fmt.Errorf("rawdatastore: GetMulti with mismatched keys/vals lengths (%d/%d)", len(keys), len(vals))
|
| + return fmt.Errorf("datastore: GetMulti with mismatched keys/vals lengths (%d/%d)", len(keys), len(vals))
|
| }
|
| if len(keys) == 0 {
|
| return nil
|
| @@ -70,7 +70,7 @@ func (tcf *checkFilter) PutMulti(keys []Key, vals []PropertyLoadSaver, cb PutMul
|
| }
|
| v := vals[i]
|
| if v == nil {
|
| - if !lme.Assign(i, errors.New("rawdatastore: PutMulti got nil vals entry")) {
|
| + if !lme.Assign(i, errors.New("datastore: PutMulti got nil vals entry")) {
|
| lme.Assign(i, v.Problem())
|
| }
|
| }
|
| @@ -82,20 +82,7 @@ func (tcf *checkFilter) PutMulti(keys []Key, vals []PropertyLoadSaver, cb PutMul
|
| return nil
|
| }
|
|
|
| - err := error(nil)
|
| - pmVals := make([]PropertyLoadSaver, len(vals))
|
| - for i, val := range vals {
|
| - pmVals[i], err = val.Save(true)
|
| - lme.Assign(i, err)
|
| - }
|
| - if me := lme.Get(); me != nil {
|
| - for _, err := range me.(errors.MultiError) {
|
| - cb(nil, err)
|
| - }
|
| - return nil
|
| - }
|
| -
|
| - return tcf.Interface.PutMulti(keys, pmVals, cb)
|
| + return tcf.RawInterface.PutMulti(keys, vals, cb)
|
| }
|
|
|
| func (tcf *checkFilter) DeleteMulti(keys []Key, cb DeleteMultiCB) error {
|
| @@ -114,10 +101,10 @@ func (tcf *checkFilter) DeleteMulti(keys []Key, cb DeleteMultiCB) error {
|
| }
|
| return nil
|
| }
|
| - return tcf.Interface.DeleteMulti(keys, cb)
|
| + return tcf.RawInterface.DeleteMulti(keys, cb)
|
| }
|
|
|
| -func applyCheckFilter(c context.Context, i Interface) Interface {
|
| +func applyCheckFilter(c context.Context, i RawInterface) RawInterface {
|
| inf := info.Get(c)
|
| return &checkFilter{i, inf.AppID(), inf.GetNamespace()}
|
| }
|
|
|