Help us shape the future of Go! Take the 2026 Go Developer Survey

visorinit

package
v1.3.101 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package visorinit pkg/visor/visorinit/module.go c3-vis-core

Index

Constants

This section is empty.

Variables

View Source
var ErrNoInit = errors.New("module initialization function is not set")

ErrNoInit is returned when module init function is not set

Functions

This section is empty.

Types

type Hook

type Hook func(ctx context.Context, log *logging.Logger) error

Hook is a function that can be run at some point as part of module initialization This function will be called with initialization context. Pass your custom data via that context, and retrieve it within your hooks.

var DoNothing Hook = func(_ context.Context, _ *logging.Logger) error {
	return nil
}

DoNothing is an initialization hook that does nothing

type Module

type Module struct {
	Name string
	// contains filtered or unexported fields
}

Module is a single system unit that represents a part of the system that must be initialized. Module can have dependencies, that should be initialized before module can start its own initialization

func MakeModule

func MakeModule(name string, init Hook, ml *logging.MasterLogger, deps ...*Module) Module

MakeModule returns a new module with given init function and dependencies

func (*Module) InitConcurrent

func (m *Module) InitConcurrent(ctx context.Context)

InitConcurrent initializes all module dependencies recursively and concurrently. If module depends on modules a and b, this function will try to run init functions for a and b in each in a separate goroutine. It will block and wait on modules whose dependencies are not yet fully initialized themselves This function blocks until all dependencis are initialized

func (*Module) Wait

func (m *Module) Wait(ctx context.Context) error

Wait for the module to be initialized return initialization error if any

Jump to

Keyboard shortcuts

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