blob: 1cdde09009df019a8e9ec4bea691d3aafff05193 [file] [log] [blame]
// 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 execlog
import (
gomapb ""
pb ""
// TODO: expvar counter
// Client is a client to access execlog service via gRPC.
type Client struct {
addr string
dialOpts []grpc.DialOption
// NewClient creates new client to access execlog service serving on address.
func NewClient(address string, opts ...grpc.DialOption) Client {
return Client{
addr: address,
dialOpts: opts,
// SaveLog saves requested execlog.
func (c Client) SaveLog(ctx context.Context, in *gomapb.SaveLogReq, opts ...grpc.CallOption) (*gomapb.SaveLogResp, error) {
conn, err := grpc.DialContext(ctx, c.addr,
}, c.dialOpts...)...)
if err != nil {
return nil, err
defer conn.Close()
return pb.NewLogServiceClient(conn).SaveLog(ctx, in,
}, opts...)...)