Documentation ¶
Index ¶
Constants ¶
const ( // InitMethodName is the function fn for the reflection InitMethodName = "Init" // ServeMethodName is the function fn for the Serve ServeMethodName = "Serve" // StopMethodName is the function fn for the reflection to Stop the service StopMethodName = "Stop" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector interface { // Collects search for the plugins which implements given interfaces in the args Collects() []*dep.In }
Collector declares the ability to accept the plugins which match the provided method signature.
type Container ¶
type Container interface { // Serve used to Start the plugin in topological order Serve() (<-chan *Result, error) // Stop stops the plugins in rev-topological order Stop() error // Register registers one plugin in container Register(service any) error // Plugins method is responsible for returning an all registered plugins Plugins() string // RegisterAll register set of comma separated plugins in container RegisterAll(service ...any) error // Init initializes all plugins (calling Init function), calculate vertices, invoke Collects and Provided functions if exist Init() error }
Container - Internal container interface
type Endure ¶
type Endure struct {
// contains filtered or unexported fields
}
Endure struct represent main endure repr
func (*Endure) Register ¶
Register registers the dependencies in the Endure graph without invoking any methods
func (*Endure) RegisterAll ¶
RegisterAll is the helper for the register to register more than one structure in the endure
func (*Endure) Serve ¶
Serve used to start serving vertices Do not change this method fn, sync with constants in the beginning of this file
type Named ¶
type Named interface { // Name return user-friendly name of the plugin Name() string }
Named -> Name of the service
type Options ¶
type Options func(endure *Endure)
Options is the endure options
func EnableProfiler ¶
func EnableProfiler() Options
func GracefulShutdownTimeout ¶
GracefulShutdownTimeout sets the timeout to kill the vertices is one or more of them are frozen
func LogHandler ¶ added in v2.3.0
LogHandler defines the logger handler to create the slog.Logger
For example:
container = endure.New(slog.LevelInfo, LogHandler(slog.NewTextHandler( os.Stderr, &slog.HandlerOptions{Level: slog.LevelInfo})))
type Provider ¶
type Provider interface { // Provides function return set of functions which provided dependencies to other plugins Provides() []*dep.Out }
Provider declares the ability to provide service edges of declared types.