Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotReady = errors.New("service is not ready")
Functions ¶
This section is empty.
Types ¶
type GRPCServer ¶
type GRPCServer struct {
// contains filtered or unexported fields
}
func NewGRPCServer ¶
func NewGRPCServer(name string, registerer Registerer, opts ...Option) *GRPCServer
func (*GRPCServer) Close ¶
func (g *GRPCServer) Close(_ context.Context) error
Close will stop this server.
If the server has not started, or is already stopped, this should do nothing and just return nil.
func (*GRPCServer) IsReady ¶ added in v0.2.0
func (g *GRPCServer) IsReady(_ context.Context) error
IsReady will return true if the service is ready to accept requests. This is compliant with the github.com/jamillosantos/application library.
func (*GRPCServer) Listen ¶
func (g *GRPCServer) Listen(_ context.Context) error
Listen will start the server and will block until the service is closed.
If the services is already listining, this should return an error ErrAlreadyListening.
func (*GRPCServer) Name ¶
func (g *GRPCServer) Name() string
Name will return a human identifiable name for this service. Ex: Postgresql Connection.
type Option ¶
type Option func(o *grpcOpts)
func WithBindAddress ¶
WithBindAddress sets the bind address used to open the GRPC server.
func WithConnectionTimeout ¶
WithConnectionTimeout set the connection timeout using the grpc.ConnectionTimeout option. The default value is 15 seconds.
func WithStreamInterceptor ¶
func WithStreamInterceptor(interceptors ...grpc.StreamServerInterceptor) Option
WithStreamInterceptor set stream interceptors that will be used.
func WithUnaryInterceptor ¶
func WithUnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor) Option
WithUnaryInterceptor set unary interceptors that will be used.