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

Unified Diff: milo/appengine/frontend/milo.go

Issue 2275123002: Milo: pRPC endpoint for getting Buildbot master data (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: Renamed stuff 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 | « milo/appengine/buildbot/pubsub_test.go ('k') | milo/appengine/frontend/static/common/auth » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/frontend/milo.go
diff --git a/milo/appengine/frontend/milo.go b/milo/appengine/frontend/milo.go
index 91c069ce750860814e920311113e6df2debfa676..19bec5eb8df102cd4dbe3723de6b8fa51e9d930f 100644
--- a/milo/appengine/frontend/milo.go
+++ b/milo/appengine/frontend/milo.go
@@ -7,7 +7,13 @@ package frontend
import (
"net/http"
+ "golang.org/x/net/context"
+
+ "github.com/golang/protobuf/proto"
"github.com/luci/luci-go/appengine/gaemiddleware"
+ "github.com/luci/luci-go/grpc/discovery"
+ "github.com/luci/luci-go/grpc/prpc"
+ milo "github.com/luci/luci-go/milo/api/proto"
"github.com/luci/luci-go/milo/appengine/buildbot"
"github.com/luci/luci-go/milo/appengine/buildbucket"
"github.com/luci/luci-go/milo/appengine/console"
@@ -17,6 +23,10 @@ import (
"github.com/luci/luci-go/server/router"
)
+func emptyPrelude(c context.Context, methodName string, req proto.Message) (context.Context, error) {
+ return c, nil
+}
+
// Where it all begins!!!
func init() {
// Register plain ol' http handlers.
@@ -58,5 +68,14 @@ func init() {
// PubSub subscription endpoints.
r.POST("/pubsub/buildbot", basemw, buildbot.PubSubHandler)
- http.Handle("/", r)
+ // pRPC style endpoints.
+ var api prpc.Server
+ milo.RegisterBuildbotServer(&api, &milo.DecoratedBuildbot{
+ Service: &buildbot.BuildbotService{},
+ Prelude: emptyPrelude,
+ })
+ discovery.Enable(&api)
+ api.InstallHandlers(r, gaemiddleware.BaseProd())
+
+ http.DefaultServeMux.Handle("/", r)
}
« no previous file with comments | « milo/appengine/buildbot/pubsub_test.go ('k') | milo/appengine/frontend/static/common/auth » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698