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