pub struct SourceManager { /* private fields */ }Expand description
Manager for multiple config sources — handles fetching, caching, version checking.
Implementations§
Source§impl SourceManager
impl SourceManager
Sourcepub fn new(cache_dir: &Path) -> Self
pub fn new(cache_dir: &Path) -> Self
Create a new SourceManager using the given cache directory.
Sourcepub fn set_allow_unsigned(&mut self, allow: bool)
pub fn set_allow_unsigned(&mut self, allow: bool)
Set whether to allow unsigned source content (bypasses signature verification).
Sourcepub fn default_cache_dir() -> Result<PathBuf>
pub fn default_cache_dir() -> Result<PathBuf>
Default cache directory: ~/.local/share/cfgd/sources/
Sourcepub fn load_sources(
&mut self,
sources: &[SourceSpec],
printer: &Printer,
) -> Result<()>
pub fn load_sources( &mut self, sources: &[SourceSpec], printer: &Printer, ) -> Result<()>
Load all sources from config, fetching if needed. Returns an error if sources were specified but none loaded successfully.
Sourcepub fn load_source(
&mut self,
spec: &SourceSpec,
printer: &Printer,
) -> Result<()>
pub fn load_source( &mut self, spec: &SourceSpec, printer: &Printer, ) -> Result<()>
Load a single source — clone or fetch, parse manifest, check version.
Sourcepub fn parse_manifest(
&self,
name: &str,
source_dir: &Path,
) -> Result<ConfigSourceDocument>
pub fn parse_manifest( &self, name: &str, source_dir: &Path, ) -> Result<ConfigSourceDocument>
Parse the ConfigSource manifest from a source directory.
Sourcepub fn verify_commit_signature(
&self,
name: &str,
source_dir: &Path,
constraints: &SourceConstraints,
) -> Result<()>
pub fn verify_commit_signature( &self, name: &str, source_dir: &Path, constraints: &SourceConstraints, ) -> Result<()>
Verify the HEAD commit of a source repo has a valid GPG or SSH signature.
Checks allow_unsigned on this SourceManager and require_signed_commits
on the constraints before delegating to verify_head_signature.
Sourcepub fn get(&self, name: &str) -> Option<&CachedSource>
pub fn get(&self, name: &str) -> Option<&CachedSource>
Get a cached source by name.
Sourcepub fn all_sources(&self) -> &HashMap<String, CachedSource>
pub fn all_sources(&self) -> &HashMap<String, CachedSource>
Get all cached sources.
Sourcepub fn load_source_profile(
&self,
source_name: &str,
profile_name: &str,
) -> Result<ProfileDocument>
pub fn load_source_profile( &self, source_name: &str, profile_name: &str, ) -> Result<ProfileDocument>
Load a profile from a source’s profiles directory.
Sourcepub fn source_profiles_dir(&self, source_name: &str) -> Result<PathBuf>
pub fn source_profiles_dir(&self, source_name: &str) -> Result<PathBuf>
Get the source profiles directory path.
Sourcepub fn source_files_dir(&self, source_name: &str) -> Result<PathBuf>
pub fn source_files_dir(&self, source_name: &str) -> Result<PathBuf>
Get the source files directory path.
Sourcepub fn remove_source(&mut self, name: &str) -> Result<()>
pub fn remove_source(&mut self, name: &str) -> Result<()>
Remove a source from cache.
Sourcepub fn build_source_spec(
name: &str,
url: &str,
profile: Option<&str>,
) -> SourceSpec
pub fn build_source_spec( name: &str, url: &str, profile: Option<&str>, ) -> SourceSpec
Build a SourceSpec for adding a new source.