Expand description
Standard library to work on Software Heritage compressed graph in Rust
Structs§
- Node
Visit - Stateful BFS (breadth-first search) visit of (a part of) the Software Heritage graph, returning deduplicated node identifiers.
Enums§
- FsTree
- Recursive representation of a directory tree, ignoring sharing.
Constants§
- HEAD_
REF_ NAMES - 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§
- find_
head_ rev - Given a graph and a snapshot node in it, return the node id of the revision pointed by the HEAD branch, it it exists.
- find_
head_ rev_ by_ refs - Same as find_head_rev, but with the ability to configure which branch names correspond to the HEAD revision.
- find_
latest_ snp - 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.
- find_
root_ dir - Given a node id pointing to a revision or release, returns the node id of the associated topmost (“root”) directory.
- fs_
ls_ tree - 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.
- fs_
resolve_ name - 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.
- fs_
resolve_ name_ by_ id - 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.
- fs_
resolve_ path - 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.
- fs_
resolve_ path_ by_ id - 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.
- iter_
nodes - Iterate on the nodes of the sub-graph rooted at
start
, in BFS order.