inject

package
v0.0.0-...-18aef32 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerAware

type ContainerAware interface {
	SetContainer(c ServiceContainer)
}

ContainerAware is an interface for container-aware components

type Service

type Service interface {
	Startup()
	Shutdown()
}

Service is the service interface

type ServiceContainer

type ServiceContainer interface {
	Ready() error
	GetService(id string) (interface{}, bool)
	RegisterService(id string, svc interface{})
	RegisterServices(services map[string]interface{})
	PrepareShutdown()
	Shutdown()
}

ServiceContainer is the service container interface

func NewContainer

func NewContainer() ServiceContainer

NewContainer creates a new service container

type ServiceRegistry

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

ServiceRegistry is a struct for keeping tabs on registered services

func (*ServiceRegistry) GetService

func (reg *ServiceRegistry) GetService(id string) (interface{}, bool)

GetService fetches a service by its ID

func (*ServiceRegistry) PrepareShutdown

func (reg *ServiceRegistry) PrepareShutdown()

PrepareShutdown prepares all services for eventual shutdown

func (*ServiceRegistry) Ready

func (reg *ServiceRegistry) Ready() error

Ready starts up the service graph and returns error if it's not ready

func (*ServiceRegistry) RegisterService

func (reg *ServiceRegistry) RegisterService(id string, svc interface{})

RegisterService registers a service

func (*ServiceRegistry) RegisterServices

func (reg *ServiceRegistry) RegisterServices(services map[string]interface{})

RegisterServices registers multiple services

func (*ServiceRegistry) Shutdown

func (reg *ServiceRegistry) Shutdown()

Shutdown shuts down all services

type ServiceWithPrepareShutdown

type ServiceWithPrepareShutdown interface {
	Startup()
	PrepareShutdown()
	Shutdown()
}

ServiceWithPrepareShutdown is the service interface with prepare shutdown method

Jump to

Keyboard shortcuts

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