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

Side by Side Diff: milo/appengine/buildbot/grpc.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 unified diff | Download patch
« no previous file with comments | « milo/appengine/buildbot/builder.go ('k') | milo/appengine/buildbot/master.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package buildbot
6
7 import (
8 "google.golang.org/grpc"
9 "google.golang.org/grpc/codes"
10
11 "github.com/luci/luci-go/common/proto/google"
12 milo "github.com/luci/luci-go/milo/api/proto"
13 "golang.org/x/net/context"
14 )
15
16 type BuildbotService struct{}
17
18 var errNotFoundGRPC = grpc.Errorf(codes.NotFound, "Master Not Found")
19
20 func (s *BuildbotService) GetCompressedMasterJSON(
21 c context.Context, req *milo.MasterRequest) (*milo.CompressedMasterJSON, error) {
22
23 if req.Name == "" {
24 return nil, grpc.Errorf(codes.InvalidArgument, "No master specif ied")
25 }
26
27 entry, err := getMasterEntry(c, req.Name)
28 switch {
29 case err == errMasterNotFound:
30 return nil, errNotFoundGRPC
31
32 case err != nil:
33 return nil, err
34 }
35
36 return &milo.CompressedMasterJSON{
37 Internal: entry.Internal,
38 Modified: &google.Timestamp{
39 Seconds: entry.Modified.Unix(),
40 Nanos: int32(entry.Modified.Nanosecond()),
41 },
42 Data: entry.Data,
43 }, nil
44 }
OLDNEW
« no previous file with comments | « milo/appengine/buildbot/builder.go ('k') | milo/appengine/buildbot/master.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698