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

Unified Diff: impl/dummy/dummy.go

Issue 2302743002: Interface update, per-method Contexts. (Closed)
Patch Set: 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
Index: impl/dummy/dummy.go
diff --git a/impl/dummy/dummy.go b/impl/dummy/dummy.go
index a11518c30ebf75605097f6cd0b36d5b2ef96b753..87a799d04038933b1899fcecffca9a4aa331ec23 100644
--- a/impl/dummy/dummy.go
+++ b/impl/dummy/dummy.go
@@ -17,6 +17,7 @@ import (
"github.com/luci/gae/service/module"
"github.com/luci/gae/service/taskqueue"
"github.com/luci/gae/service/user"
+
"golang.org/x/net/context"
)
@@ -73,8 +74,10 @@ func ni() error {
type ds struct{}
-func (ds) AllocateIDs([]*datastore.Key, datastore.NewKeyCB) error { panic(ni()) }
-func (ds) PutMulti([]*datastore.Key, []datastore.PropertyMap, datastore.NewKeyCB) error { panic(ni()) }
+func (ds) AllocateIDs([]*datastore.Key, datastore.NewKeyCB) error { panic(ni()) }
+func (ds) PutMulti([]*datastore.Key, []datastore.PropertyMap, datastore.NewKeyCB) error {
+ panic(ni())
+}
func (ds) GetMulti([]*datastore.Key, datastore.MultiMetaGetter, datastore.GetMultiCB) error {
panic(ni())
}
@@ -85,7 +88,10 @@ func (ds) Run(*datastore.FinalizedQuery, datastore.RawRunCB) error { panic(n
func (ds) RunInTransaction(func(context.Context) error, *datastore.TransactionOptions) error {
panic(ni())
}
-func (ds) Testable() datastore.Testable { return nil }
+func (ds) WithTransaction(datastore.Transaction) context.Context { panic(ni()) }
+func (ds) CurrentTransaction() datastore.Transaction { panic(ni()) }
+
+func (ds) GetTestable() datastore.Testable { return nil }
var dummyDSInst = ds{}
@@ -98,7 +104,7 @@ func Datastore() datastore.RawInterface { return dummyDSInst }
type mc struct{}
-func (mc) NewItem(key string) memcache.Item { panic(ni()) }
+func (mc) NewItem(string) memcache.Item { panic(ni()) }
func (mc) AddMulti([]memcache.Item, memcache.RawCB) error { panic(ni()) }
func (mc) SetMulti([]memcache.Item, memcache.RawCB) error { panic(ni()) }
func (mc) GetMulti([]string, memcache.RawItemCB) error { panic(ni()) }
@@ -123,7 +129,7 @@ func (tq) AddMulti([]*taskqueue.Task, string, taskqueue.RawTaskCB) error { panic
func (tq) DeleteMulti([]*taskqueue.Task, string, taskqueue.RawCB) error { panic(ni()) }
func (tq) Purge(string) error { panic(ni()) }
func (tq) Stats([]string, taskqueue.RawStatsCB) error { panic(ni()) }
-func (tq) Testable() taskqueue.Testable { return nil }
+func (tq) GetTestable() taskqueue.Testable { return nil }
var dummyTQInst = tq{}
@@ -136,27 +142,31 @@ func TaskQueue() taskqueue.RawInterface { return dummyTQInst }
type i struct{}
-func (i) AccessToken(scopes ...string) (token string, expiry time.Time, err error) { panic(ni()) }
-func (i) AppID() string { return "appid" }
-func (i) FullyQualifiedAppID() string { return "dummy~appid" }
-func (i) GetNamespace() (string, bool) { return "dummy-namespace", true }
-func (i) ModuleHostname(module, version, instance string) (string, error) { panic(ni()) }
-func (i) ModuleName() string { panic(ni()) }
-func (i) DefaultVersionHostname() string { panic(ni()) }
-func (i) PublicCertificates() ([]info.Certificate, error) { panic(ni()) }
-func (i) RequestID() string { panic(ni()) }
-func (i) ServiceAccount() (string, error) { panic(ni()) }
-func (i) SignBytes(bytes []byte) (keyName string, signature []byte, err error) { panic(ni()) }
-func (i) VersionID() string { panic(ni()) }
-func (i) Namespace(namespace string) (context.Context, error) { panic(ni()) }
-func (i) Datacenter() string { panic(ni()) }
-func (i) InstanceID() string { panic(ni()) }
-func (i) IsDevAppServer() bool { panic(ni()) }
-func (i) ServerSoftware() string { panic(ni()) }
-func (i) IsCapabilityDisabled(err error) bool { panic(ni()) }
-func (i) IsOverQuota(err error) bool { panic(ni()) }
-func (i) IsTimeoutError(err error) bool { panic(ni()) }
-func (i) Testable() info.Testable { panic(ni()) }
+func (i) AccessToken(...string) (token string, expiry time.Time, err error) {
+ panic(ni())
+}
+func (i) AppID() string { return "appid" }
+func (i) FullyQualifiedAppID() string { return "dummy~appid" }
+func (i) GetNamespace() string { return "dummy-namespace" }
+func (i) ModuleHostname(module, version, instance string) (string, error) {
+ panic(ni())
+}
+func (i) ModuleName() string { panic(ni()) }
+func (i) DefaultVersionHostname() string { panic(ni()) }
+func (i) PublicCertificates() ([]info.Certificate, error) { panic(ni()) }
+func (i) RequestID() string { panic(ni()) }
+func (i) ServiceAccount() (string, error) { panic(ni()) }
+func (i) SignBytes([]byte) (keyName string, signature []byte, err error) { panic(ni()) }
+func (i) VersionID() string { panic(ni()) }
+func (i) Namespace(string) (context.Context, error) { panic(ni()) }
+func (i) Datacenter() string { panic(ni()) }
+func (i) InstanceID() string { panic(ni()) }
+func (i) IsDevAppServer() bool { panic(ni()) }
+func (i) ServerSoftware() string { panic(ni()) }
+func (i) IsCapabilityDisabled(error) bool { panic(ni()) }
+func (i) IsOverQuota(error) bool { panic(ni()) }
+func (i) IsTimeoutError(error) bool { panic(ni()) }
+func (i) GetTestable() info.Testable { panic(ni()) }
var dummyInfoInst = i{}
@@ -176,14 +186,14 @@ func (u) LoginURL(string) (string, error) { panic(ni()) }
func (u) LoginURLFederated(string, string) (string, error) { panic(ni()) }
func (u) LogoutURL(string) (string, error) { panic(ni()) }
func (u) OAuthConsumerKey() (string, error) { panic(ni()) }
-func (u) Testable() user.Testable { panic(ni()) }
+func (u) GetTestable() user.Testable { panic(ni()) }
var dummyUserInst = u{}
// User returns a dummy user.Interface implementation suitable for embedding.
// Every method panics with a message containing the name of the method which
// was unimplemented.
-func User() user.Interface { return dummyUserInst }
+func User() user.RawInterface { return dummyUserInst }
////////////////////////////////////// m ///////////////////////////////////////
@@ -191,30 +201,32 @@ type m struct{}
func (m) Send(*mail.Message) error { panic(ni()) }
func (m) SendToAdmins(*mail.Message) error { panic(ni()) }
-func (m) Testable() mail.Testable { panic(ni()) }
+func (m) GetTestable() mail.Testable { panic(ni()) }
var dummyMailInst = m{}
// Mail returns a dummy mail.Interface implementation suitable for embedding.
// Every method panics with a message containing the name of the method which
// was unimplemented.
-func Mail() mail.Interface { return dummyMailInst }
+func Mail() mail.RawInterface { return dummyMailInst }
/////////////////////////////////// mod ////////////////////////////////////
type mod struct{}
-func (mod) List() ([]string, error) { panic(ni()) }
-func (mod) NumInstances(module, version string) (int, error) { panic(ni()) }
-func (mod) SetNumInstances(module, version string, instances int) error { panic(ni()) }
-func (mod) Versions(module string) ([]string, error) { panic(ni()) }
-func (mod) DefaultVersion(module string) (string, error) { panic(ni()) }
-func (mod) Start(module, version string) error { panic(ni()) }
-func (mod) Stop(module, version string) error { panic(ni()) }
+func (mod) List() ([]string, error) { panic(ni()) }
+func (mod) NumInstances(module, version string) (int, error) { panic(ni()) }
+func (mod) SetNumInstances(module, version string, instances int) error {
+ panic(ni())
+}
+func (mod) Versions(module string) ([]string, error) { panic(ni()) }
+func (mod) DefaultVersion(module string) (string, error) { panic(ni()) }
+func (mod) Start(module, version string) error { panic(ni()) }
+func (mod) Stop(module, version string) error { panic(ni()) }
var dummyModuleInst = mod{}
// Module returns a dummy module.Interface implementation suitable for
// embedding. Every method panics with a message containing the name of the
// method which was unimplemented.
-func Module() module.Interface { return dummyModuleInst }
+func Module() module.RawInterface { return dummyModuleInst }

Powered by Google App Engine
This is Rietveld 408576698