builder

package module
v0.0.0-...-8b0fa57 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Needs string `json:"needs"`
	GRPC  struct {
		ListenAddress string `json:"listen_address"`
		// Default connection timeout is 120 seconds
		// https://godoc.org/google.golang.org/grpc#ConnectionTimeout
		ConnectionTimeoutSeconds uint32               `json:"connection_timeout_seconds"`
		Certs                    certs.TLSCredsConfig `json:"certs"`
	} `json:"grpc"`
	Gateway struct {
		ListenAddress     string               `json:"listen_address"`
		AllowedOrigins    []string             `json:"allowed_origins"`
		Certs             certs.TLSCredsConfig `json:"certs"`
		HTTP              bool                 `json:"http"`
		ReadTimeout       time.Duration        `json:"read_timeout"`
		ReadHeaderTimeout time.Duration        `json:"read_header_timeout"`
		WriteTimeout      time.Duration        `json:"write_timeout"`
		IdleTimeout       time.Duration        `json:"idle_timeout"`
	} `json:"gateway"`
	Health struct {
		ListenAddress string `json:"listen_address"`
	} `json:"health"`
}

type GRPCRegistrations

type GRPCRegistrations func(server *grpc.Server)

type Gateway

type Gateway struct {
	Server *http.Server
	Mux    *http.ServeMux
	Certs  *certs.TLSCredsConfig
}

type HandlerRegistrations

type HandlerRegistrations func(ctx context.Context, mux *runtime.ServeMux, grpcEndpoint string, opts []grpc.DialOption) error

type HealthServer

type HealthServer struct {
	Server     *health.Server
	GRPCServer *grpc.Server
}

HealthServer contains everything we need to be able to serve a health status endpoint.

type Server

type Server struct {
	Config        *API
	Server        *grpc.Server
	Listener      net.Listener
	Registrations GRPCRegistrations
	Gateway       Gateway
	Health        *HealthServer
	Started       chan bool
}

type ServiceFactory

type ServiceFactory struct{}

func NewServiceFactory

func NewServiceFactory() *ServiceFactory

func (*ServiceFactory) CreateService

func (f *ServiceFactory) CreateService(config *API, opts []grpc.ServerOption, registrations GRPCRegistrations,
	handlerRegistrations HandlerRegistrations,
	withGateway bool) (*Server, error)

type ServiceInterface

type ServiceInterface interface {
	Start(context.Context) error
	Stop(context.Context) error
}

type ServiceManager

type ServiceManager struct {
	Context context.Context

	Servers       map[string]*Server
	DependencyMap map[string]string
	// contains filtered or unexported fields
}

func NewServiceManager

func NewServiceManager(logger *zerolog.Logger) *ServiceManager

func (*ServiceManager) AddGRPCServer

func (s *ServiceManager) AddGRPCServer(server *Server) error

func (*ServiceManager) StartServers

func (s *ServiceManager) StartServers(ctx context.Context) error

func (*ServiceManager) StopServers

func (s *ServiceManager) StopServers(ctx context.Context)

Jump to

Keyboard shortcuts

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