github.com/hernad/nomad@v1.6.112/drivers/docker/docklog/server.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package docklog
     5  
     6  import (
     7  	"context"
     8  
     9  	"github.com/hashicorp/go-plugin"
    10  
    11  	"github.com/hernad/nomad/drivers/docker/docklog/proto"
    12  )
    13  
    14  // dockerLoggerServer is the server side translation between the protobuf and native interfaces
    15  type dockerLoggerServer struct {
    16  	broker *plugin.GRPCBroker
    17  	impl   DockerLogger
    18  }
    19  
    20  // Start proxies the protobuf Start RPC to the Start fun of the DockerLogger interface
    21  func (s *dockerLoggerServer) Start(ctx context.Context, req *proto.StartRequest) (*proto.StartResponse, error) {
    22  	opts := &StartOpts{
    23  		Endpoint:    req.Endpoint,
    24  		ContainerID: req.ContainerId,
    25  		Stdout:      req.StdoutFifo,
    26  		Stderr:      req.StderrFifo,
    27  		TTY:         req.Tty,
    28  
    29  		TLSCert: req.TlsCert,
    30  		TLSKey:  req.TlsKey,
    31  		TLSCA:   req.TlsCa,
    32  	}
    33  	err := s.impl.Start(opts)
    34  	if err != nil {
    35  		return nil, err
    36  	}
    37  	resp := &proto.StartResponse{}
    38  	return resp, nil
    39  }
    40  
    41  // Stop proxies the protobuf Stop RPC to the Stop fun of the DockerLogger interface
    42  func (s *dockerLoggerServer) Stop(ctx context.Context, req *proto.StopRequest) (*proto.StopResponse, error) {
    43  	return &proto.StopResponse{}, s.impl.Stop()
    44  }