agh

package
v0.107.48 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package agh contains common entities and interfaces of AdGuard Home.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmptyService

type EmptyService struct{}

EmptyService is a Service that does nothing.

TODO(a.garipov): Remove if unnecessary.

func (EmptyService) Shutdown

func (EmptyService) Shutdown(_ context.Context) (err error)

Shutdown implements the Service interface for EmptyService.

func (EmptyService) Start

func (EmptyService) Start() (err error)

Start implements the Service interface for EmptyService.

type EmptyServiceWithConfig

type EmptyServiceWithConfig[ConfigType any] struct {
	EmptyService

	Conf ConfigType
}

EmptyServiceWithConfig is a ServiceWithConfig that does nothing. Its Config method returns Conf.

TODO(a.garipov): Remove if unnecessary.

func (*EmptyServiceWithConfig[ConfigType]) Config

func (s *EmptyServiceWithConfig[ConfigType]) Config() (conf ConfigType)

Config implements the ServiceWithConfig interface for *EmptyServiceWithConfig.

type Service

type Service interface {
	// Start starts the service.  It does not block.
	Start() (err error)

	// Shutdown gracefully stops the service.  ctx is used to determine
	// a timeout before trying to stop the service less gracefully.
	Shutdown(ctx context.Context) (err error)
}

Service is the interface for API servers.

TODO(a.garipov): Consider adding a context to Start.

TODO(a.garipov): Consider adding a Wait method or making an extension interface for that.

type ServiceWithConfig

type ServiceWithConfig[ConfigType any] interface {
	Service

	Config() (c ConfigType)
}

ServiceWithConfig is an extension of the Service interface for services that can return their configuration.

TODO(a.garipov): Consider removing this generic interface if we figure out how to make it testable in a better way.

Jump to

Keyboard shortcuts

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