Documentation
¶
Overview ¶
Package toposort provides a topological sort for segments/flags based on their dependencies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Sort ¶
func Sort(allData []st.Collection) []st.Collection
Sort performs a topological sort on the given data collections, so that the items can be inserted into a persistent store to minimize the risk of evaluating a flag before its prerequisites/segments have been stored.
Types ¶
type AdjacencyList ¶
AdjacencyList is a map of vertices (kind/key) to neighbors (dependencies).
type DependencyTracker ¶ added in v7.15.5
type DependencyTracker struct {
// contains filtered or unexported fields
}
DependencyTracker maintains a bidirectional dependency graph that can be updated whenever an item has changed.
A nearly identical unexported implementation exists in internal/datasource for the FDv1 code path; that copy will go away when FDv1 is removed.
func NewDependencyTracker ¶ added in v7.15.5
func NewDependencyTracker() *DependencyTracker
NewDependencyTracker creates a DependencyTracker with an empty dependency graph.
func (*DependencyTracker) AddAffectedItems ¶ added in v7.15.5
func (d *DependencyTracker) AddAffectedItems(itemsOut Neighbors, initialModifiedItem Vertex)
AddAffectedItems populates the given set with the union of the initial item and all items that directly or indirectly depend on it (based on the current state of the dependency graph).
func (*DependencyTracker) Reset ¶ added in v7.15.5
func (d *DependencyTracker) Reset()
Reset clears the dependency graph.
func (*DependencyTracker) UpdateDependenciesFrom ¶ added in v7.15.5
func (d *DependencyTracker) UpdateDependenciesFrom( kind st.DataKind, fromKey string, fromItem st.ItemDescriptor, )
UpdateDependenciesFrom updates the dependency graph when an item has changed.
type Neighbors ¶
type Neighbors map[Vertex]struct{}
Neighbors is a set of vertices. It is used instead of a list for efficient lookup.
func GetNeighbors ¶
func GetNeighbors(kind st.DataKind, fromItem st.ItemDescriptor) Neighbors
GetNeighbors returns all direct neighbors of the given item.