Arbiter
Dependency manager library that supports decentralization
Functions
Graph.h File Reference

Go to the source code of this file.

Functions

bool ArbiterResolvedDependencyGraphAddEdge (ArbiterResolvedDependencyGraph *graph, const struct ArbiterProjectIdentifier *dependent, const struct ArbiterResolvedDependency *dependency, const struct ArbiterRequirement *requirement, char **error)
 Attempts to add an edge (dependency relationship) into the dependency graph, from dependent to dependency, without making it inconsistent. More...
 
bool ArbiterResolvedDependencyGraphAddRoot (ArbiterResolvedDependencyGraph *graph, const struct ArbiterResolvedDependency *node, const struct ArbiterRequirement *requirement, char **error)
 Attempts to add a root node into the dependency graph, without making it inconsistent. More...
 
void ArbiterResolvedDependencyGraphCopyAll (const ArbiterResolvedDependencyGraph *graph, struct ArbiterResolvedDependency **buffer)
 Copies all of the resolved dependencies in the given graph into the C array buffer, which must have enough space to contain ArbiterResolvedDependencyGraphCount() elements. More...
 
size_t ArbiterResolvedDependencyGraphCount (const ArbiterResolvedDependencyGraph *graph)
 Returns the number of unique nodes in the given graph, for use with ArbiterResolvedDependencyGraphGetAll(). More...
 
size_t ArbiterResolvedDependencyGraphCountDependencies (const ArbiterResolvedDependencyGraph *graph, const struct ArbiterProjectIdentifier *project)
 Returns the number of dependencies that the given project has in the graph, or 0 if the project does not exist in the graph. More...
 
ArbiterResolvedDependencyGraphArbiterResolvedDependencyGraphCreate (void)
 Creates an empty resolved dependency graph. More...
 
void ArbiterResolvedDependencyGraphGetAllDependencies (const ArbiterResolvedDependencyGraph *graph, const struct ArbiterProjectIdentifier *project, const struct ArbiterProjectIdentifier **buffer)
 Copies pointers to the projects representing the given project's dependencies into the C array buffer, which must have enough space to contain ArbiterResolvedDependencyGraphCountDependencies() elements. More...
 
const struct ArbiterRequirementArbiterResolvedDependencyGraphProjectRequirement (const ArbiterResolvedDependencyGraph *graph, const struct ArbiterProjectIdentifier *project)
 Returns the requirement which is attached to the given project in the dependency graph, or NULL if the project is not part of the graph. More...
 
const struct ArbiterSelectedVersionArbiterResolvedDependencyGraphProjectVersion (const ArbiterResolvedDependencyGraph *graph, const struct ArbiterProjectIdentifier *project)
 Returns the version which was selected for the given project in the dependency graph, or NULL if the project is not part of the graph. More...
 
size_t ArbiterResolvedDependencyInstallerCountInPhase (const ArbiterResolvedDependencyInstaller *installer, size_t phaseIndex)
 Returns the number of resolved dependencies that exist within the given zero-based installer phase, for use with ArbiterResolvedDependencyInstallerGetAllInPhase(). More...
 
ArbiterResolvedDependencyInstallerArbiterResolvedDependencyInstallerCreate (const ArbiterResolvedDependencyGraph *graph)
 Creates an installer for the given resolved dependency graph. More...
 
void ArbiterResolvedDependencyInstallerGetAllInPhase (const ArbiterResolvedDependencyInstaller *installer, size_t phaseIndex, const struct ArbiterResolvedDependency **buffer)
 Copies pointers to the resolved dependencies which exist at the given zero-based installer phase into the C array buffer, which must have enough space to contain ArbiterResolvedDependencyInstallerCountInPhase() elements. More...
 
size_t ArbiterResolvedDependencyInstallerPhaseCount (const ArbiterResolvedDependencyInstaller *installer)
 Returns the number of phases that the installer has, for use with ArbiterResolvedDependencyInstallerCountInPhase() and ArbiterResolvedDependencyInstallerGetAllInPhase(). More...
 

Function Documentation

§ ArbiterResolvedDependencyGraphAddEdge()

bool ArbiterResolvedDependencyGraphAddEdge ( ArbiterResolvedDependencyGraph graph,
const struct ArbiterProjectIdentifier dependent,
const struct ArbiterResolvedDependency dependency,
const struct ArbiterRequirement requirement,
char **  error 
)

Attempts to add an edge (dependency relationship) into the dependency graph, from dependent to dependency, without making it inconsistent.

If dependency refers to a project which already exists in the graph, this will attempt to intersect the version requirements of both.

Returns whether the addition succeeded. If false is returned and error is not NULL, it may be set to a string describing the error, which the caller is responsible for freeing.

§ ArbiterResolvedDependencyGraphAddRoot()

bool ArbiterResolvedDependencyGraphAddRoot ( ArbiterResolvedDependencyGraph graph,
const struct ArbiterResolvedDependency node,
const struct ArbiterRequirement requirement,
char **  error 
)

Attempts to add a root node into the dependency graph, without making it inconsistent.

If the given dependency refers to a project which already exists in the graph, this will attempt to intersect the version requirements of both.

Returns whether the addition succeeded. If false is returned and error is not NULL, it may be set to a string describing the error, which the caller is responsible for freeing.

§ ArbiterResolvedDependencyGraphCopyAll()

void ArbiterResolvedDependencyGraphCopyAll ( const ArbiterResolvedDependencyGraph graph,
struct ArbiterResolvedDependency **  buffer 
)

Copies all of the resolved dependencies in the given graph into the C array buffer, which must have enough space to contain ArbiterResolvedDependencyGraphCount() elements.

This operation does not guarantee a specific ordering to the copied items.

The copied objects must be individually freed with ArbiterFree().

§ ArbiterResolvedDependencyGraphCount()

size_t ArbiterResolvedDependencyGraphCount ( const ArbiterResolvedDependencyGraph graph)

Returns the number of unique nodes in the given graph, for use with ArbiterResolvedDependencyGraphGetAll().

The returned count may be invalidated if the graph is modified.

§ ArbiterResolvedDependencyGraphCountDependencies()

size_t ArbiterResolvedDependencyGraphCountDependencies ( const ArbiterResolvedDependencyGraph graph,
const struct ArbiterProjectIdentifier project 
)

Returns the number of dependencies that the given project has in the graph, or 0 if the project does not exist in the graph.

The returned count may be invalidated if the graph is modified.

§ ArbiterResolvedDependencyGraphCreate()

ArbiterResolvedDependencyGraph* ArbiterResolvedDependencyGraphCreate ( void  )

Creates an empty resolved dependency graph.

The returned identifier must be freed with ArbiterFree().

§ ArbiterResolvedDependencyGraphGetAllDependencies()

void ArbiterResolvedDependencyGraphGetAllDependencies ( const ArbiterResolvedDependencyGraph graph,
const struct ArbiterProjectIdentifier project,
const struct ArbiterProjectIdentifier **  buffer 
)

Copies pointers to the projects representing the given project's dependencies into the C array buffer, which must have enough space to contain ArbiterResolvedDependencyGraphCountDependencies() elements.

This operation guarantees that project identifiers will appear in the buffer in ascending order.

The copied pointers are guaranteed to remain valid until the ArbiterResolvedDependencyGraph they were obtained from is modified or freed.

§ ArbiterResolvedDependencyGraphProjectRequirement()

const struct ArbiterRequirement* ArbiterResolvedDependencyGraphProjectRequirement ( const ArbiterResolvedDependencyGraph graph,
const struct ArbiterProjectIdentifier project 
)

Returns the requirement which is attached to the given project in the dependency graph, or NULL if the project is not part of the graph.

The returned pointer is guaranteed to remain valid until the ArbiterResolvedDependencyGraph it was obtained from is modified or freed.

§ ArbiterResolvedDependencyGraphProjectVersion()

const struct ArbiterSelectedVersion* ArbiterResolvedDependencyGraphProjectVersion ( const ArbiterResolvedDependencyGraph graph,
const struct ArbiterProjectIdentifier project 
)

Returns the version which was selected for the given project in the dependency graph, or NULL if the project is not part of the graph.

The returned pointer is guaranteed to remain valid until the ArbiterResolvedDependencyGraph it was obtained from is modified or freed.

§ ArbiterResolvedDependencyInstallerCountInPhase()

size_t ArbiterResolvedDependencyInstallerCountInPhase ( const ArbiterResolvedDependencyInstaller installer,
size_t  phaseIndex 
)

Returns the number of resolved dependencies that exist within the given zero-based installer phase, for use with ArbiterResolvedDependencyInstallerGetAllInPhase().

This represents a set of projects which can safely be built or installed in parallel with one another.

§ ArbiterResolvedDependencyInstallerCreate()

ArbiterResolvedDependencyInstaller* ArbiterResolvedDependencyInstallerCreate ( const ArbiterResolvedDependencyGraph graph)

Creates an installer for the given resolved dependency graph.

The dependency graph can be safely freed after calling this function.

The returned installer must be freed with ArbiterFree().

§ ArbiterResolvedDependencyInstallerGetAllInPhase()

void ArbiterResolvedDependencyInstallerGetAllInPhase ( const ArbiterResolvedDependencyInstaller installer,
size_t  phaseIndex,
const struct ArbiterResolvedDependency **  buffer 
)

Copies pointers to the resolved dependencies which exist at the given zero-based installer phase into the C array buffer, which must have enough space to contain ArbiterResolvedDependencyInstallerCountInPhase() elements.

This operation guarantees that resolved dependencies will appear in the buffer in ascending order of their project identifiers.

The copied pointers are guaranteed to remain valid until the ArbiterResolvedDependencyInstaller they were obtained from is freed.

§ ArbiterResolvedDependencyInstallerPhaseCount()

size_t ArbiterResolvedDependencyInstallerPhaseCount ( const ArbiterResolvedDependencyInstaller installer)

Returns the number of phases that the installer has, for use with ArbiterResolvedDependencyInstallerCountInPhase() and ArbiterResolvedDependencyInstallerGetAllInPhase().