Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CollectorEntries ¶
type CollectorEntries []CollectorEntry
CollectorEntries is type alias for the CollectorEntries slice
type CollectorEntry ¶
CollectorEntry entry is collector interface struct which contain: 1. in types like func (a int, b string etc...) 2 function name
type Entry ¶
type Entry struct {
// RefID, structure, which provides interface dep
RefID string
// Name of the entry
Name string
// IsReference, can be true, false or nil (unknown)
IsReference *bool
// IsDisabled retrun true if vertex returns errors.Disabled
IsDisabled bool
// Kind is just reflect.Kind
Kind reflect.Kind
}
Entry is the general entry used in InitDepsToInvoke, CollectsDepsToInvoke, addToList and etc..
type FnsToCall ¶
type FnsToCall [][]string
FnsToCall is slice with the functions which can return the same resulting set of values for example fn a() b --| fn c() b ----> both a and c returns b
type In ¶
In struct represents In value, which contain: 1. 'in' as reflect.Value 2. dep name as string
type Meta ¶
type Meta struct {
// FnsProviderToInvoke is the function names to invoke if type implements Provides() interface
FnsProviderToInvoke ProviderEntries
// CollectorEntries is the function names to invoke if type implements Collector() interface
CollectorEntries CollectorEntries
// List of the vertex deps
// foo4.DB, foo4.S4 etc.. which were found in the Init() method
InitDepsToInvoke map[string][]Entry
InitDepsOrd []string
// List of the vertex deps
// foo4.DB, foo4.S4 etc.. which were found in the Collects() method
CollectsDepsToInvoke map[string][]Entry
}
Meta information included into the Vertex May include: 1. Disabled info 2. Relation status
type ProvidedEntry ¶
type ProvidedEntry struct {
Str string
// we need to distinguish false (default bool value) and nil --> we don't know information about reference
IsReference *bool
Value reflect.Value
Kind reflect.Kind
}
ProvidedEntry is proviers helper entity
type ProviderEntries ¶
type ProviderEntries []ProviderEntry
ProviderEntries is type alias for the ProviderEntry slice
func (*ProviderEntries) Merge ¶
func (pe *ProviderEntries) Merge() FnsToCall
Merge creates FnsToCall
type ProviderEntry ¶
ProviderEntry is Provides interface method representation. It consists of: 1. Function name 2. Return type Ids (strings), for example foo.S2
type Vertex ¶
type Vertex struct {
// ID of the vertex, currently string representation of the structure fn
ID string
// Vertex (Registered structure)
Iface any
// Meta information about current Vertex
Meta Meta
// Dependencies of the node
Dependencies []*Vertex
// Set of entries which can vertex provide (for example, foo4 vertex can provide DB instance and logger)
Provides map[string]ProvidedEntry
// If vertex disabled it removed from the processing (Init, Serve, Stop), but present in the graph
IsDisabled bool
// for the topological sort, private
NumOfDeps int
Visited bool
Visiting bool
// contains filtered or unexported fields
}
Vertex is main vertex representation for the graph since we can have cyclic dependencies when we traverse the VerticesMap, we should mark nodes as visited or not to detect cycle
func (*Vertex) AddProvider ¶
AddProvider adds an provider for a dep (vertex->vertex)
func (*Vertex) RemoveProvider ¶
RemoveProvider removes provider from the map