Module swh_graph::stdlib

source ·
Expand description

Standard library to work on Software Heritage compressed graph in Rust

Structs§

  • Stateful BFS (breadth-first search) visit of (a part of) the Software Heritage graph, returning deduplicated node identifiers.

Enums§

  • Recursive representation of a directory tree, ignoring sharing.

Constants§

  • Names of references (“branches”) that are considered to be pointing to the HEAD revision in a VCS, by find_head_rev below. Names are tried in order, when attempting to identify the HEAD revision.

Functions§

  • Given a graph and a snapshot node in it, return the node id of the revision pointed by the HEAD branch, it it exists.
  • Same as find_head_rev, but with the ability to configure which branch names correspond to the HEAD revision.
  • Given a graph and an origin node in it, return the node id and timestamp (as a number of seconds since Epoch) of the most recent snapshot of that origin, if it exists.
  • Given a node id pointing to a revision or release, returns the node id of the associated topmost (“root”) directory.
  • Given a graph and a directory node in it (usually, but not necessarily, the root directory of a repository), return a recursive list of the contained files and directories.
  • Given a graph and a directory node, return the node id of a named directory entry located (not recursively) in that directory, if it exists.
  • Same as fs_resolve_name, but using a pre-resolved FilenameId as entry name. Using this function is more efficient in case the same name (e.g., “README.md”) is to be looked up in many directories.
  • Given a graph and a directory node, return the node id of a directory entry located at a given path within that directory, if it exists.
  • Same as fs_resolve_path, but using as path a sequence of pre-resolved FilenameId-s. Using this function is more efficient in case the same path (e.g., “src/main.c”) is to be looked up in many directories.
  • Iterate on the nodes of the sub-graph rooted at start, in BFS order.