Module rlx_topo

This is a pretty simple topological sort for erlang.

Authors: Joe Armstrong, Eric Merritt, Konstantin Tcepliaev.

Description

This is a pretty simple topological sort for erlang. It was originally written for ermake by Joe Armstrong back in '98. It has been pretty heavily modified by Eric Merritt since '06 and modified again for Relx. Konstantin Tcepliaev rewrote the algorithm in 2017.

A partial order on the set S is a set of pairs {Xi,Xj} such that some relation between Xi and Xj is obeyed.

A topological sort of a partial order is a sequence of elements [X1, X2, X3 ...] such that if whenever {Xi, Xj} is in the partial order i < j

This particular implementation guarantees that nodes closer to the top level of the graph will be put as close as possible to the beginning of the resulting list - this ensures that dependencies are started as late as possible, and top-level apps are started as early as possible.

Function Index

format_error/1nicely format the error from the sort.
sort_apps/1This only does a topo sort on the list of applications and assumes that there is only *one* version of each app in the list of applications.

Function Details

format_error/1

format_error(Reason::term()) -> iolist()

nicely format the error from the sort.

sort_apps/1

sort_apps(Apps::[rlx_app_info:t()]) -> {ok, [rlx_app_info:t()]} | relx:error()

This only does a topo sort on the list of applications and assumes that there is only *one* version of each app in the list of applications. This implies that you have already done the constraint solve before you pass the list of apps here to be sorted.


Generated by EDoc, Jun 11 2024, 05:32:01.