dependency

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Experimental Gimbap Dependency Manager

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FxDependencyManager

type FxDependencyManager struct {
	IDependencyManager
	// contains filtered or unexported fields
}

func NewFxManager

func NewFxManager() *FxDependencyManager

func (*FxDependencyManager) OnStart

func (f *FxDependencyManager) OnStart()

func (*FxDependencyManager) OnStop

func (f *FxDependencyManager) OnStop()

func (*FxDependencyManager) ResolveDependencies

func (f *FxDependencyManager) ResolveDependencies(instanceMap map[reflect.Type]reflect.Value, providerList []*provider.Provider)

type GimbapDependencyManager added in v0.0.7

type GimbapDependencyManager struct {
	IDependencyManager
	// contains filtered or unexported fields
}

func NewGimbapDependencyManager added in v0.0.7

func NewGimbapDependencyManager() *GimbapDependencyManager

func (*GimbapDependencyManager) OnStart added in v0.0.7

func (g *GimbapDependencyManager) OnStart()

func (*GimbapDependencyManager) OnStop added in v0.0.7

func (g *GimbapDependencyManager) OnStop()

func (*GimbapDependencyManager) ResolveDependencies added in v0.0.7

func (g *GimbapDependencyManager) ResolveDependencies(instanceMap map[reflect.Type]reflect.Value, providerList []*provider.Provider)

type GimbapDependencyManagerContext added in v0.0.7

type GimbapDependencyManagerContext struct {
	/*
		Dependency graph to resolve the dependencies
		The map will register a list of nodes that require the key node
		The node will be consumed upon initialization

		If any node is not consumed then it must throw --> circular dependency or missing dependency
	*/
	DependencyGraph map[reflect.Type]map[reflect.Type]*dependencyNode

	/*
		The starting node list to resolve the dependencies
		These are nodes that do not require any other nodes to initialize
	*/
	StartNodeMap map[reflect.Type]*dependencyNode

	// Reference to the instance map
	InstanceMap map[reflect.Type]reflect.Value
}

Context holder to make the dependency manager stateless

func NewGimbapDependencyManagerContext added in v0.0.7

func NewGimbapDependencyManagerContext(instanceMap map[reflect.Type]reflect.Value) *GimbapDependencyManagerContext

type IDependencyManager

type IDependencyManager interface {
	// ResolveDependencies the dependencies to the target
	//
	// The first parameter is the result map which contains the resolved dependencies.
	// The second parameter is the list of providers to resolve.
	ResolveDependencies(instanceMap map[reflect.Type]reflect.Value, providers []*provider.Provider)

	// Lifecycle methods
	OnStart()
	OnStop()
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳