Documentation ¶
Index ¶
- func AppendService(serviceType service.ServiceType, fn ServiceFn) bool
- func Exists(services ...service.ServiceType) (map[service.ServiceType]bool, bool)
- func Get(name service.ServiceType) (service.Service, bool)
- func List() []service.Service
- func LoadDependencies(ctx *cli.Context, baseService *service.BaseService) error
- func New(ctx *cli.Context) (service.Service, error)
- func Register(name service.ServiceType, srvc service.Service) bool
- func RegisterServices(ctx *cli.Context, baseService service.Service) error
- func Remove(serviceType service.ServiceType)
- func Run(ctx *cli.Context, srvc service.Service) error
- type ServiceFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendService ¶
func AppendService(serviceType service.ServiceType, fn ServiceFn) bool
func Exists ¶
func Exists(services ...service.ServiceType) (map[service.ServiceType]bool, bool)
Exists checks if services exist in the registry. It returns a map containing the services that do not exist in the registry and a boolean indicating if all services exist.
func Get ¶
func Get(name service.ServiceType) (service.Service, bool)
Get retrieves the internal information of a specific registered service based on its name. It returns the internal information of the registered service, or nil if the service does not exist.
func LoadDependencies ¶
func LoadDependencies(ctx *cli.Context, baseService *service.BaseService) error
LoadDependencies loads dependencies for registered services into the base service.
It iterates through the registered services and their dependencies, registers each dependency into the base service, and returns an error if any dependency registration fails.
func New ¶
New creates a new service based on the provided context.
It retrieves the requested services from the context and validates their existence. Then, it creates a new base service with the requested services and registers built-in loader services. After that, it loads dependencies for the base service and returns the created base service. It returns an error if any step fails during the process.
func Register ¶
func Register(name service.ServiceType, srvc service.Service) bool
Register adds a service to the registry if it doesn't already exist. It returns true if the service was successfully registered, false otherwise.
func RegisterServices ¶
RegisterServices registers built-in services including attached services with the provided context and base service. It returns an error if any of the built-in services fail to register.
func Remove ¶
func Remove(serviceType service.ServiceType)
Remove removes a service from the registry.