| Index: service/datastore/checkfilter.go
|
| diff --git a/service/datastore/checkfilter.go b/service/datastore/checkfilter.go
|
| index 478fd925b1bfbed630b1b207d7747b5637fd59de..04945c05555a11c1fa2b5a8a7d35581f09ec09cd 100644
|
| --- a/service/datastore/checkfilter.go
|
| +++ b/service/datastore/checkfilter.go
|
| @@ -7,19 +7,19 @@ package datastore
|
| import (
|
| "fmt"
|
|
|
| - "github.com/luci/gae/service/info"
|
| "github.com/luci/luci-go/common/errors"
|
| +
|
| "golang.org/x/net/context"
|
| )
|
|
|
| type checkFilter struct {
|
| RawInterface
|
|
|
| - aid string
|
| - ns string
|
| + kc KeyContext
|
| }
|
|
|
| func (tcf *checkFilter) RunInTransaction(f func(c context.Context) error, opts *TransactionOptions) error {
|
| +
|
| if f == nil {
|
| return fmt.Errorf("datastore: RunInTransaction function is nil")
|
| }
|
| @@ -45,7 +45,7 @@ func (tcf *checkFilter) GetMulti(keys []*Key, meta MultiMetaGetter, cb GetMultiC
|
| }
|
| lme := errors.NewLazyMultiError(len(keys))
|
| for i, k := range keys {
|
| - if k.IsIncomplete() || !k.Valid(true, tcf.aid, tcf.ns) {
|
| + if k.IsIncomplete() || !k.Valid(true, tcf.kc) {
|
| lme.Assign(i, ErrInvalidKey)
|
| }
|
| }
|
| @@ -70,7 +70,7 @@ func (tcf *checkFilter) PutMulti(keys []*Key, vals []PropertyMap, cb NewKeyCB) e
|
| }
|
| lme := errors.NewLazyMultiError(len(keys))
|
| for i, k := range keys {
|
| - if !k.PartialValid(tcf.aid, tcf.ns) {
|
| + if !k.PartialValid(tcf.kc) {
|
| lme.Assign(i, ErrInvalidKey)
|
| continue
|
| }
|
| @@ -98,7 +98,7 @@ func (tcf *checkFilter) DeleteMulti(keys []*Key, cb DeleteMultiCB) error {
|
| }
|
| lme := errors.NewLazyMultiError(len(keys))
|
| for i, k := range keys {
|
| - if k.IsIncomplete() || !k.Valid(false, tcf.aid, tcf.ns) {
|
| + if k.IsIncomplete() || !k.Valid(false, tcf.kc) {
|
| lme.Assign(i, ErrInvalidKey)
|
| }
|
| }
|
| @@ -112,7 +112,8 @@ func (tcf *checkFilter) DeleteMulti(keys []*Key, cb DeleteMultiCB) error {
|
| }
|
|
|
| func applyCheckFilter(c context.Context, i RawInterface) RawInterface {
|
| - inf := info.Get(c)
|
| - ns, _ := inf.GetNamespace()
|
| - return &checkFilter{i, inf.FullyQualifiedAppID(), ns}
|
| + return &checkFilter{
|
| + RawInterface: i,
|
| + kc: GetKeyContext(c),
|
| + }
|
| }
|
|
|