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

Unified Diff: filter/featureBreaker/mail.go

Issue 1525923002: Implement Mail service. (Closed) Base URL: https://github.com/luci/gae.git@filter_user
Patch Set: tests and words Created 5 years 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/count/mail.go ('k') | impl/dummy/dummy.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: filter/featureBreaker/mail.go
diff --git a/filter/featureBreaker/mail.go b/filter/featureBreaker/mail.go
new file mode 100644
index 0000000000000000000000000000000000000000..d5023c59802285f38f904da8dd2d34678a065b91
--- /dev/null
+++ b/filter/featureBreaker/mail.go
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package featureBreaker
+
+import (
+ "github.com/luci/gae/service/mail"
+ "golang.org/x/net/context"
+)
+
+type mailState struct {
+ *state
+
+ mail.Interface
+}
+
+var _ mail.Interface = (*mailState)(nil)
+
+func (m *mailState) Send(msg *mail.Message) error {
+ return m.run(func() error { return m.Interface.Send(msg) })
+}
+
+func (m *mailState) SendToAdmins(msg *mail.Message) error {
+ return m.run(func() error { return m.Interface.SendToAdmins(msg) })
+}
+
+// FilterMail installs a counter mail filter in the context.
+func FilterMail(c context.Context, defaultError error) (context.Context, FeatureBreaker) {
+ state := newState(defaultError)
+ return mail.AddFilters(c, func(ic context.Context, i mail.Interface) mail.Interface {
+ return &mailState{state, i}
+ }), state
+}
« no previous file with comments | « filter/count/mail.go ('k') | impl/dummy/dummy.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698