grpcapplication

package module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2020 License: BSD-3-Clause Imports: 17 Imported by: 0

README

grpcapplication

GoDoc

Package grpcapplication offers an Application implementation of github.com/goinsane/application for GRPC applications.

Documentation

Overview

Package grpcapplication offers an Application implementation of github.com/goinsane/application for GRPC applications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPCApplication added in v0.1.0

type GRPCApplication struct {
	// App is an Application instance for wrapping notification methods if needed.
	App application.Application

	// Logger logs error and warning logs if needed.
	Logger *xlog.Logger

	// HTTPServer for using custom HTTP server if needed.
	HTTPServer *http.Server

	// GRPCServerOptions for additional server options if needed.
	GRPCServerOptions []grpc.ServerOption

	// If HandleMetrics is true, the GRPCApplication serves /metrics end-point for prometheus metrics .
	HandleMetrics bool

	// If HandlePprof is true, the GRPCApplication serves /debug/pprof/ end-point for pprof.
	HandlePprof bool

	// RegisterFunc for registering GRPC services. If it is nil, the GRPCApplication doesn't handle any request.
	RegisterFunc RegisterFunc

	// Listeners for serving requests. If it is nil, the GRPCApplication doesn't serve any connections.
	Listeners []net.Listener
	// contains filtered or unexported fields
}

GRPCApplication is an implementation of Application optimized by GRPC applications.

func (*GRPCApplication) Run added in v0.1.0

func (a *GRPCApplication) Run(ctx application.Context)

Run implements Application.Run(). It calls Serve methods for given listeners. And also it calls App.Run() asynchronously if App isn't nil.

func (*GRPCApplication) Start added in v0.1.0

func (a *GRPCApplication) Start(ctx application.Context)

Start implements Application.Start(). It initializes HTTP and GRPC servers, calls RegisterFunc. And after calls App.Start() if App isn't nil.

func (*GRPCApplication) Stop added in v0.1.0

func (a *GRPCApplication) Stop()

Stop implements Application.Stop(). And also it calls App.Stop() if App isn't nil.

func (*GRPCApplication) Terminate added in v0.1.0

func (a *GRPCApplication) Terminate(ctx context.Context)

Terminate implements Application.Terminate(). It terminates servers. And also it calls App.Terminate() asynchronously if App isn't nil.

type RegisterFunc

type RegisterFunc func(ctx application.Context, grpcServer *grpc.Server, httpServeMux *http.ServeMux)

RegisterFunc is a type of function for using in GRPCApplication.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL