pub struct InputFetcher { /* private fields */ }Expand description
A content-addressed input fetcher that downloads and caches flake inputs.
Inputs are cached under ~/.cache/sui/inputs/ (or a custom directory)
keyed by their narHash from the lock file. Cache hits skip network
access entirely.
Implementations§
Source§impl InputFetcher
impl InputFetcher
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a fetcher using the default cache directory (~/.cache/sui/inputs/).
Sourcepub fn with_cache_dir(cache_dir: PathBuf) -> Self
pub fn with_cache_dir(cache_dir: PathBuf) -> Self
Create a fetcher with a custom cache directory.
Sourcepub fn is_cached(&self, locked: &LockedInput) -> bool
pub fn is_cached(&self, locked: &LockedInput) -> bool
Whether this input would be served from cache without any network access.
Deliberately shares Self::cache_probe with Self::fetch rather
than re-deriving the cache path: two independent notions of “cached”
drift, and the drift is invisible — a reporter would announce “already
present” for an entry the fetcher then re-downloads. Note it applies the
same non-empty requirement, so a directory left behind by a fetch
that died mid-extract counts as a miss here exactly as it does there.
Sourcepub fn fetch(&self, locked: &LockedInput) -> Result<PathBuf, FetchError>
pub fn fetch(&self, locked: &LockedInput) -> Result<PathBuf, FetchError>
Fetch a locked input and return the local filesystem path.
Uses content-addressed caching by narHash — if the hash is present
and a cached directory exists, returns immediately without network access.
Sourcepub fn github_archive_url(owner: &str, repo: &str, rev: &str) -> String
pub fn github_archive_url(owner: &str, repo: &str, rev: &str) -> String
Construct the GitHub archive URL for a locked input.
Sourcepub fn gitlab_archive_url(
host: Option<&str>,
owner: &str,
repo: &str,
rev: &str,
) -> String
pub fn gitlab_archive_url( host: Option<&str>, owner: &str, repo: &str, rev: &str, ) -> String
GitLab archive URL. Shape differs from GitHub — the file
name embeds the repo + rev and lives under /-/archive/{rev}/.
Honors host so self-hosted gitlab instances (e.g.
gitlab.gnome.org, git.example.com) work; defaults to
gitlab.com when host is None.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InputFetcher
impl RefUnwindSafe for InputFetcher
impl Send for InputFetcher
impl Sync for InputFetcher
impl Unpin for InputFetcher
impl UnsafeUnpin for InputFetcher
impl UnwindSafe for InputFetcher
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.