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

Unified Diff: service/datastore/checkfilter.go

Issue 2302743002: Interface update, per-method Contexts. (Closed)
Patch Set: Lightning talk licenses. Created 4 years, 3 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/prod/user.go ('k') | service/datastore/checkfilter_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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),
+ }
}
« no previous file with comments | « impl/prod/user.go ('k') | service/datastore/checkfilter_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698