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