open-nomad/client/logmon/server.go
Tim Gross eb06c25d5f
deps: remove deprecated net/context (#13932)
The `golang.org/x/net/context` package was merged into the stdlib as of go
1.7. Update the imports to use the identical stdlib version. Clean up import
blocks for the impacted files to remove unnecessary package aliasing.
2022-07-28 14:46:56 -04:00

37 lines
841 B
Go

package logmon
import (
"context"
"github.com/hashicorp/go-plugin"
"github.com/hashicorp/nomad/client/logmon/proto"
)
type logmonServer struct {
broker *plugin.GRPCBroker
impl LogMon
}
func (s *logmonServer) Start(ctx context.Context, req *proto.StartRequest) (*proto.StartResponse, error) {
cfg := &LogConfig{
LogDir: req.LogDir,
StdoutLogFile: req.StdoutFileName,
StderrLogFile: req.StderrFileName,
MaxFiles: int(req.MaxFiles),
MaxFileSizeMB: int(req.MaxFileSizeMb),
StdoutFifo: req.StdoutFifo,
StderrFifo: req.StderrFifo,
}
err := s.impl.Start(cfg)
if err != nil {
return nil, err
}
resp := &proto.StartResponse{}
return resp, nil
}
func (s *logmonServer) Stop(ctx context.Context, req *proto.StopRequest) (*proto.StopResponse, error) {
return &proto.StopResponse{}, s.impl.Stop()
}