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

Side by Side Diff: impl/dummy/dummy.go

Issue 1355783002: Refactor keys and queries in datastore service and implementation. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package dummy 5 package dummy
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "runtime" 9 "runtime"
10 "strings" 10 "strings"
11 "time" 11 "time"
12 12
13 "github.com/luci/gae/service/datastore" 13 "github.com/luci/gae/service/datastore"
14 "github.com/luci/gae/service/datastore/dskey"
15 "github.com/luci/gae/service/info" 14 "github.com/luci/gae/service/info"
16 "github.com/luci/gae/service/memcache" 15 "github.com/luci/gae/service/memcache"
17 "github.com/luci/gae/service/taskqueue" 16 "github.com/luci/gae/service/taskqueue"
18 "golang.org/x/net/context" 17 "golang.org/x/net/context"
19 ) 18 )
20 19
21 const niFmtStr = "dummy: method %s.%s is not implemented" 20 const niFmtStr = "dummy: method %s.%s is not implemented"
22 21
23 // ni returns an error whose message is an appropriate expansion of niFmtStr. 22 // ni returns an error whose message is an appropriate expansion of niFmtStr.
24 // 23 //
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 57 }
59 } 58 }
60 59
61 return fmt.Errorf(niFmtStr, iface, funcName) 60 return fmt.Errorf(niFmtStr, iface, funcName)
62 } 61 }
63 62
64 /////////////////////////////////// ds //////////////////////////////////// 63 /////////////////////////////////// ds ////////////////////////////////////
65 64
66 type ds struct{} 65 type ds struct{}
67 66
68 func (ds) NewKey(kind string, sid string, iid int64, par datastore.Key) datastor e.Key { 67 func (ds) PutMulti([]*datastore.Key, []datastore.PropertyMap, datastore.PutMulti CB) error {
69 » return dskey.New("dummy~appid", "", kind, sid, iid, par)
70 }
71 func (ds) DecodeKey(string) (datastore.Key, error) { panic(ni()) }
72 func (ds) PutMulti([]datastore.Key, []datastore.PropertyMap, datastore.PutMultiC B) error {
73 panic(ni()) 68 panic(ni())
74 } 69 }
75 func (ds) GetMulti([]datastore.Key, datastore.MultiMetaGetter, datastore.GetMult iCB) error { 70 func (ds) GetMulti([]*datastore.Key, datastore.MultiMetaGetter, datastore.GetMul tiCB) error {
76 panic(ni()) 71 panic(ni())
77 } 72 }
78 func (ds) DeleteMulti([]datastore.Key, datastore.DeleteMultiCB) error { panic(ni ()) } 73 func (ds) DeleteMulti([]*datastore.Key, datastore.DeleteMultiCB) error { panic(n i()) }
79 func (ds) NewQuery(string) datastore.Query { panic(ni ()) } 74 func (ds) NewQuery(string) datastore.Query { panic(n i()) }
80 func (ds) DecodeCursor(string) (datastore.Cursor, error) { panic(ni ()) } 75 func (ds) DecodeCursor(string) (datastore.Cursor, error) { panic(n i()) }
81 func (ds) Run(datastore.Query, datastore.RawRunCB) error { panic(ni ()) } 76 func (ds) Run(*datastore.FinalizedQuery, datastore.RawRunCB) error { panic(n i()) }
82 func (ds) RunInTransaction(func(context.Context) error, *datastore.TransactionOp tions) error { 77 func (ds) RunInTransaction(func(context.Context) error, *datastore.TransactionOp tions) error {
83 panic(ni()) 78 panic(ni())
84 } 79 }
85 func (ds) Testable() datastore.Testable { return nil } 80 func (ds) Testable() datastore.Testable { return nil }
86 81
87 var dummyDSInst = ds{} 82 var dummyDSInst = ds{}
88 83
89 // Datastore returns a dummy datastore.RawInterface implementation suitable 84 // Datastore returns a dummy datastore.RawInterface implementation suitable
90 // for embedding. Every method panics with a message containing the name of the 85 // for embedding. Every method panics with a message containing the name of the
91 // method which was unimplemented. 86 // method which was unimplemented.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 func (i) IsCapabilityDisabled(err error) bool { panic(ni()) } 148 func (i) IsCapabilityDisabled(err error) bool { panic(ni()) }
154 func (i) IsOverQuota(err error) bool { panic(ni()) } 149 func (i) IsOverQuota(err error) bool { panic(ni()) }
155 func (i) IsTimeoutError(err error) bool { panic(ni()) } 150 func (i) IsTimeoutError(err error) bool { panic(ni()) }
156 151
157 var dummyInfoInst = i{} 152 var dummyInfoInst = i{}
158 153
159 // Info returns a dummy info.Interface implementation suitable for embedding. 154 // Info returns a dummy info.Interface implementation suitable for embedding.
160 // Every method panics with a message containing the name of the method which 155 // Every method panics with a message containing the name of the method which
161 // was unimplemented. 156 // was unimplemented.
162 func Info() info.Interface { return dummyInfoInst } 157 func Info() info.Interface { return dummyInfoInst }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698