Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { GRPCClient *grpc.ClientConn Creds credentials.TransportCredentials Endpoint string // contains filtered or unexported fields }
Client encapsulates logic for new gRPC clint
func NewClient ¶
func NewClient(creds credentials.TransportCredentials, endpoint string, enableMetrics bool, logger *logrus.Logger) (*Client, error)
NewClient creates new Client object with hostTCP, port, creds and calls init function Receives credentials for connection, connection endpoint (for example 'tcp://localhost:8888') and logrus logger Returns an instance of Client struct or error if initClient() function failed
func (*Client) Close ¶
Close function calls Close method in ClientConn Returns error if something went wrong
func (*Client) GetEndpoint ¶
GetEndpoint returns endpoint representation Returns url.Path if Scheme is unix or url.Host otherwise
type ServerRunner ¶
type ServerRunner struct { GRPCServer *grpc.Server Creds credentials.TransportCredentials Endpoint string // contains filtered or unexported fields }
ServerRunner encapsulates logic for creating/starting/stopping gRPC server
func NewServerRunner ¶
func NewServerRunner(creds credentials.TransportCredentials, endpoint string, enableMetrics bool, logger *logrus.Logger) *ServerRunner
NewServerRunner returns ServerRunner object based on parameters that had provided Receives credentials for connection, connection endpoint (for example 'tcp://localhost:8888') and logrus logger Returns an instance of ServerRunner struct
func (*ServerRunner) GetEndpoint ¶
func (sr *ServerRunner) GetEndpoint() (string, string)
GetEndpoint returns endpoint representation Returns url.Path if Scheme is unix or url.Host otherwise
func (*ServerRunner) RunServer ¶
func (sr *ServerRunner) RunServer() error
RunServer creates Listener and starts gRPC server on endpoint Receives error if error occurred during Listener creation or during GRPCServer.Serve
func (*ServerRunner) SetLogger ¶
func (sr *ServerRunner) SetLogger(logger *logrus.Logger)
SetLogger sets logrus logger to ServerRunner struct Receives logrus logger
func (*ServerRunner) StopServer ¶
func (sr *ServerRunner) StopServer()
StopServer gracefully stops gRPC server and closes listener