Skip to main content

Module repos

Module repos 

Source
Expand description

Local repository discovery: magi repos and GET /api/repos.

scan walks the roots named in [repos] roots for a ghq-layout checkout (<root>/<host>/<owner>/<repo>).

§Read-only, and cheap enough to repeat

Nothing here creates, deletes or writes anything, and no root is ever reached over the network - the whole point is that this is a filesystem fact about the operator’s own machine. Cache exists only because a scan still means walking however many roots the operator configured on every request, and the web server should not repeat that walk on every poll. It is trusted for [repos] scan_ttl seconds and can always be forced with an explicit refresh.

§One implementation, two callers

scan is the whole surface, and both magi repos and GET /api/repos (see crate::web) call it rather than each walking the filesystem in its own way. Cache wraps scan for the web server, which asks on every request; the CLI, invoked once per command, has no cache to keep.

Structs§

Cache
In-process cache of the last scan.
Repo
One repository found under a configured root.

Functions§

scan
Scan every root for a ghq-layout checkout: <root>/<host>/<owner>/<repo> holding a .git directory.