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

Unified Diff: filter/dscache/support.go

Issue 1355783002: Refactor keys and queries in datastore service and implementation. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: appease errcheck Created 5 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 | « filter/dscache/plan.go ('k') | filter/featureBreaker/rds.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: filter/dscache/support.go
diff --git a/filter/dscache/support.go b/filter/dscache/support.go
index 1fc73384528ae3ab2711f460a022ed9f836c15c4..ea64460886d971efa1272e9e7072d08e3058f60c 100644
--- a/filter/dscache/support.go
+++ b/filter/dscache/support.go
@@ -22,10 +22,10 @@ type supportContext struct {
c context.Context
mc memcache.Interface
mr *rand.Rand
- shardsForKey func(ds.Key) int
+ shardsForKey func(*ds.Key) int
}
-func (s *supportContext) numShards(k ds.Key) int {
+func (s *supportContext) numShards(k *ds.Key) int {
ret := DefaultShards
if s.shardsForKey != nil {
ret = s.shardsForKey(k)
@@ -39,7 +39,7 @@ func (s *supportContext) numShards(k ds.Key) int {
return ret
}
-func (s *supportContext) mkRandKeys(keys []ds.Key, metas ds.MultiMetaGetter) []string {
+func (s *supportContext) mkRandKeys(keys []*ds.Key, metas ds.MultiMetaGetter) []string {
ret := []string(nil)
for i, key := range keys {
if !metas.GetMetaDefault(i, CacheEnableMeta, true).(bool) {
@@ -57,7 +57,7 @@ func (s *supportContext) mkRandKeys(keys []ds.Key, metas ds.MultiMetaGetter) []s
return ret
}
-func (s *supportContext) mkAllKeys(keys []ds.Key) []string {
+func (s *supportContext) mkAllKeys(keys []*ds.Key) []string {
size := 0
nums := make([]int, len(keys))
for i, key := range keys {
@@ -102,7 +102,7 @@ func (s *supportContext) crappyNonce() []byte {
return ret
}
-func (s *supportContext) mutation(keys []ds.Key, f func() error) error {
+func (s *supportContext) mutation(keys []*ds.Key, f func() error) error {
lockItems, lockKeys := s.mkAllLockItems(keys)
if lockItems == nil {
return f()
@@ -124,7 +124,7 @@ func (s *supportContext) mutation(keys []ds.Key, f func() error) error {
return err
}
-func (s *supportContext) mkRandLockItems(keys []ds.Key, metas ds.MultiMetaGetter) ([]memcache.Item, []byte) {
+func (s *supportContext) mkRandLockItems(keys []*ds.Key, metas ds.MultiMetaGetter) ([]memcache.Item, []byte) {
mcKeys := s.mkRandKeys(keys, metas)
if len(mcKeys) == 0 {
return nil, nil
@@ -143,7 +143,7 @@ func (s *supportContext) mkRandLockItems(keys []ds.Key, metas ds.MultiMetaGetter
return ret, nonce
}
-func (s *supportContext) mkAllLockItems(keys []ds.Key) ([]memcache.Item, []string) {
+func (s *supportContext) mkAllLockItems(keys []*ds.Key) ([]memcache.Item, []string) {
mcKeys := s.mkAllKeys(keys)
if mcKeys == nil {
return nil, nil
« no previous file with comments | « filter/dscache/plan.go ('k') | filter/featureBreaker/rds.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698