pub struct SourcesConfig {
pub sources: Vec<SourceDefinition>,
pub disabled_agents: Vec<String>,
}Expand description
Root configuration containing all source definitions.
Fields§
§sources: Vec<SourceDefinition>List of configured sources.
disabled_agents: Vec<String>Connectors to skip during indexing even if their files exist locally or in configured remote mirrors.
Implementations§
Source§impl SourcesConfig
impl SourcesConfig
Sourcepub fn load() -> Result<Self, ConfigError>
pub fn load() -> Result<Self, ConfigError>
Load configuration from the default location.
Returns an empty config if the file doesn’t exist.
Sourcepub fn load_from(path: &PathBuf) -> Result<Self, ConfigError>
pub fn load_from(path: &PathBuf) -> Result<Self, ConfigError>
Load configuration from a specific path.
Sourcepub fn save(&self) -> Result<(), ConfigError>
pub fn save(&self) -> Result<(), ConfigError>
Save configuration to the default location.
Sourcepub fn save_to(&self, path: &Path) -> Result<(), ConfigError>
pub fn save_to(&self, path: &Path) -> Result<(), ConfigError>
Save configuration to a specific path.
Sourcepub fn config_path() -> Result<PathBuf, ConfigError>
pub fn config_path() -> Result<PathBuf, ConfigError>
Get the default configuration file path.
Uses XDG conventions:
- Primary:
$XDG_CONFIG_HOME/cass/sources.toml - Fallback: platform-specific config dir (e.g.,
~/.config/cass/sources.tomlon Linux)
Sourcepub fn validate(&self) -> Result<(), ConfigError>
pub fn validate(&self) -> Result<(), ConfigError>
Validate all sources in the configuration.
Sourcepub fn find_source(&self, name: &str) -> Option<&SourceDefinition>
pub fn find_source(&self, name: &str) -> Option<&SourceDefinition>
Find a source by name.
Sourcepub fn find_source_mut(&mut self, name: &str) -> Option<&mut SourceDefinition>
pub fn find_source_mut(&mut self, name: &str) -> Option<&mut SourceDefinition>
Find a source by name (mutable).
Sourcepub fn add_source(
&mut self,
source: SourceDefinition,
) -> Result<(), ConfigError>
pub fn add_source( &mut self, source: SourceDefinition, ) -> Result<(), ConfigError>
Add a new source. Returns error if name already exists.
Sourcepub fn remove_source(&mut self, name: &str) -> bool
pub fn remove_source(&mut self, name: &str) -> bool
Remove a source by name. Returns true if found and removed.
Sourcepub fn remote_sources(&self) -> impl Iterator<Item = &SourceDefinition>
pub fn remote_sources(&self) -> impl Iterator<Item = &SourceDefinition>
Get all remote sources (SSH type).
pub fn configured_disabled_agents(&self) -> Vec<String>
pub fn is_agent_disabled(&self, agent: &str) -> bool
pub fn exclude_agent_from_indexing( &mut self, agent: &str, ) -> Result<bool, ConfigError>
pub fn include_agent_in_indexing( &mut self, agent: &str, ) -> Result<bool, ConfigError>
Source§impl SourcesConfig
impl SourcesConfig
Sourcepub fn write_with_backup(&self) -> Result<BackupInfo, ConfigError>
pub fn write_with_backup(&self) -> Result<BackupInfo, ConfigError>
Write configuration with backup.
Creates a uniquely named backup of the existing config (if any) before writing the new configuration atomically.
Sourcepub fn merge_source(
&mut self,
source: SourceDefinition,
) -> Result<MergeResult, ConfigError>
pub fn merge_source( &mut self, source: SourceDefinition, ) -> Result<MergeResult, ConfigError>
Merge a source into the configuration.
Returns MergeResult::Added if the source was added,
or MergeResult::AlreadyExists if a source with the same name exists.
Sourcepub fn merge_preview(
&mut self,
preview: &ConfigPreview,
) -> Result<(usize, Vec<String>), ConfigError>
pub fn merge_preview( &mut self, preview: &ConfigPreview, ) -> Result<(usize, Vec<String>), ConfigError>
Merge multiple sources from a preview.
Returns a tuple of (added_count, skipped_names).
Sourcepub fn configured_names(&self) -> HashSet<String>
pub fn configured_names(&self) -> HashSet<String>
Get set of configured source names.
Sourcepub fn configured_name_keys(&self) -> HashSet<String>
pub fn configured_name_keys(&self) -> HashSet<String>
Get normalized source-name keys for duplicate detection and lookups.
Trait Implementations§
Source§impl Clone for SourcesConfig
impl Clone for SourcesConfig
Source§fn clone(&self) -> SourcesConfig
fn clone(&self) -> SourcesConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SourcesConfig
impl Debug for SourcesConfig
Source§impl Default for SourcesConfig
impl Default for SourcesConfig
Source§fn default() -> SourcesConfig
fn default() -> SourcesConfig
Source§impl<'de> Deserialize<'de> for SourcesConfig
impl<'de> Deserialize<'de> for SourcesConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for SourcesConfig
impl RefUnwindSafe for SourcesConfig
impl Send for SourcesConfig
impl Sync for SourcesConfig
impl Unpin for SourcesConfig
impl UnsafeUnpin for SourcesConfig
impl UnwindSafe for SourcesConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for 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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().