service

package
v0.0.0-...-984e724 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service interface {

	// Returns the name of the service. It is used mainly for logs.
	Name() string

	// Start the service I/O. A service must me Stop()ed before deleting the
	// reference, or a memleak could exist with pending goroutines.
	//
	// Calling Start() twice without calling Stop() between is an undefined behavior
	// and is forbidden.
	Start() error

	// Stop the service I/O, and stops any goroutine attached. After this call,
	// the service object can safely be discarded
	//
	// Calling Stop() twice without calling Start() between is an undefined behavior
	// and is forbidden.
	Stop() error

	// Get every other service on which this service directly depends.
	// For example, a database service might log events, and thus would
	// returns the logger service in the slice returned by this method
	//
	// This allows the app to correctly start the dependencies of a service
	// in the right order.
	//
	// It is the responsability of the app not to create a dependency loop, which
	// would create an infinite loop during the enumeration of services.
	Dependencies() []Service
}

The common service interface A service is an API that provides I/O with a unified interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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