golazy.dev golazy.dev / lazydeps Index | Files

package lazydeps

import "golazy.dev/lazydeps"

Package lazydeps records application dependency initialization and the dependency graph between services.

Applications receive a *Scope from lazyapp.Config.Dependencies and initialize shared services with Service. Service returns a typed Ref; calling Ref.Use inside another service initializer records that dependency edge and returns the wrapped service value.

Constants

Functions

Types

type Edge

type Edge struct {
	From	string	`json:"from"`
	To	string	`json:"to"`
}

type Func

type Func[T any] func(context.Context) (context.Context, T, error, context.CancelFunc)

type LazyDevRuntime

LazyDevRuntime reports application runtime state to dependency development handlers.

type LazyDevRuntime interface {
	SetDraining(bool)
	Draining() bool
	ActiveRequests() int64
	ActiveConnections() int64
}

type LazyDevShutdownState

type LazyDevShutdownState struct {
	Graph			Graph			`json:"graph"`
	Ready			bool			`json:"ready"`
	ReadyStatus		int			`json:"ready_status"`
	ReadyText		string			`json:"ready_text"`
	ActiveRequests		int64			`json:"active_requests"`
	ActiveConnections	int64			`json:"active_connections"`
	Running			bool			`json:"running"`
	Phase			string			`json:"phase"`
	Message			string			`json:"message"`
	Nodes			[]LazyDevShutdownNode	`json:"nodes"`
	Error			string			`json:"error,omitempty"`
}