adaptors

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package adaptors provides adaptors for common services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPCService

type GRPCService struct {
	// contains filtered or unexported fields
}

GRPCService is a gRPC server adapter for lifecycle manager.

func NewGRPCService

func NewGRPCService(addr string, srv *grpc.Server) *GRPCService

NewGRPCService creates new gRPC server adapter.

func (*GRPCService) RegisterLifecycle

func (s *GRPCService) RegisterLifecycle(name string, lf LifecycleRegistry)

RegisterLifecycle registers service in lifecycle manager.

func (*GRPCService) Start

func (s *GRPCService) Start(ctx context.Context, errCh chan<- error) error

func (*GRPCService) Stop

func (s *GRPCService) Stop(ctx context.Context) error

type HTTPService

type HTTPService struct {
	// contains filtered or unexported fields
}

HTTPService is an adapter for http.Server to implement lifecycle hooks.

func NewHTTPService

func NewHTTPService(srv *http.Server) *HTTPService

NewHTTPService creates new HTTPService adaptor.

func (*HTTPService) RegisterLifecycle

func (s *HTTPService) RegisterLifecycle(name string, lf LifecycleRegistry)

RegisterLifecycle registers this service in lifecycle manager.

func (*HTTPService) Start

func (s *HTTPService) Start(ctx context.Context, errCh chan<- error) error

func (*HTTPService) Stop

func (s *HTTPService) Stop(ctx context.Context) error

type LifecycleRegistry

type LifecycleRegistry interface {
	RegisterService(service types.ServiceConfig)
}

LifecycleRegistry provides method to register lifecycle service.

Jump to

Keyboard shortcuts

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