-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexec.go
35 lines (29 loc) · 1.08 KB
/
exec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2017 The Goma 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 backend
import (
"context"
"go.opencensus.io/trace"
"google.golang.org/grpc"
"go.chromium.org/goma/server/exec"
"go.chromium.org/goma/server/log"
gomapb "go.chromium.org/goma/server/proto/api"
execpb "go.chromium.org/goma/server/proto/exec"
"go.chromium.org/goma/server/rpc"
)
// ExecServer handles /e.
type ExecServer struct {
Client execpb.ExecServiceClient
}
// Exec handles /e.
func (s ExecServer) Exec(ctx context.Context, req *gomapb.ExecReq) (*gomapb.ExecResp, error) {
ctx, span := trace.StartSpan(ctx, "go.chromium.org/goma/server/backend.ExecServer.Exec")
defer span.End()
ctx = passThroughContext(ctx)
ctx, id := rpc.TagID(ctx, req.GetRequesterInfo())
logger := log.FromContext(ctx)
logger.Infof("call exec %s", id)
resp, err := s.Client.Exec(ctx, req, grpc.MaxCallSendMsgSize(exec.DefaultMaxReqMsgSize), grpc.MaxCallRecvMsgSize(exec.DefaultMaxRespMsgSize))
return resp, wrapError(ctx, "exec", err)
}