pub struct Storage { /* private fields */ }
Expand description
Local filesystem storage for cached llms.txt documentation
Implementations§
Source§impl Storage
impl Storage
Sourcepub fn with_root(root_dir: PathBuf) -> Result<Self>
pub fn with_root(root_dir: PathBuf) -> Result<Self>
Creates a new storage instance with a custom root directory
Sourcepub fn with_paths(root_dir: PathBuf, config_dir: PathBuf) -> Result<Self>
pub fn with_paths(root_dir: PathBuf, config_dir: PathBuf) -> Result<Self>
Creates a new storage instance with explicit data and config directories
Sourcepub fn config_dir(&self) -> &Path
pub fn config_dir(&self) -> &Path
Returns the root configuration directory path used for descriptors
Sourcepub fn descriptor_path(&self, alias: &str) -> Result<PathBuf>
pub fn descriptor_path(&self, alias: &str) -> Result<PathBuf>
Returns the path to the descriptor TOML for a source
Sourcepub fn save_descriptor(&self, descriptor: &SourceDescriptor) -> Result<()>
pub fn save_descriptor(&self, descriptor: &SourceDescriptor) -> Result<()>
Persist a descriptor to disk, creating parent directories if necessary
Sourcepub fn load_descriptor(&self, alias: &str) -> Result<Option<SourceDescriptor>>
pub fn load_descriptor(&self, alias: &str) -> Result<Option<SourceDescriptor>>
Load a descriptor if it exists
Sourcepub fn remove_descriptor(&self, alias: &str) -> Result<()>
pub fn remove_descriptor(&self, alias: &str) -> Result<()>
Remove descriptor file for an alias if present
Sourcepub fn tool_dir(&self, source: &str) -> Result<PathBuf>
pub fn tool_dir(&self, source: &str) -> Result<PathBuf>
Returns the directory path for a given alias
Sourcepub fn ensure_tool_dir(&self, source: &str) -> Result<PathBuf>
pub fn ensure_tool_dir(&self, source: &str) -> Result<PathBuf>
Ensures the directory for an alias exists and returns its path
Sourcepub fn llms_txt_path(&self, source: &str) -> Result<PathBuf>
pub fn llms_txt_path(&self, source: &str) -> Result<PathBuf>
Returns the path to the llms.txt file for a source
Sourcepub fn llms_json_path(&self, source: &str) -> Result<PathBuf>
pub fn llms_json_path(&self, source: &str) -> Result<PathBuf>
Returns the path to the llms.json file for a source
Sourcepub fn index_dir(&self, source: &str) -> Result<PathBuf>
pub fn index_dir(&self, source: &str) -> Result<PathBuf>
Returns the path to the search index directory for a source
Sourcepub fn archive_dir(&self, source: &str) -> Result<PathBuf>
pub fn archive_dir(&self, source: &str) -> Result<PathBuf>
Returns the path to the archive directory for a source
Sourcepub fn metadata_path(&self, source: &str) -> Result<PathBuf>
pub fn metadata_path(&self, source: &str) -> Result<PathBuf>
Returns the path to the metadata file for a source
Sourcepub fn anchors_map_path(&self, source: &str) -> Result<PathBuf>
pub fn anchors_map_path(&self, source: &str) -> Result<PathBuf>
Returns the path to the anchors mapping file for a source
Sourcepub fn save_llms_txt(&self, source: &str, content: &str) -> Result<()>
pub fn save_llms_txt(&self, source: &str, content: &str) -> Result<()>
Saves the llms.txt content for a source
Sourcepub fn load_llms_txt(&self, source: &str) -> Result<String>
pub fn load_llms_txt(&self, source: &str) -> Result<String>
Loads the llms.txt content for a source
Sourcepub fn save_llms_json(&self, source: &str, data: &LlmsJson) -> Result<()>
pub fn save_llms_json(&self, source: &str, data: &LlmsJson) -> Result<()>
Saves the parsed llms.json data for a source
Sourcepub fn load_llms_json(&self, source: &str) -> Result<LlmsJson>
pub fn load_llms_json(&self, source: &str) -> Result<LlmsJson>
Loads the parsed llms.json data for a source
Sourcepub fn save_source_metadata(
&self,
source: &str,
metadata: &Source,
) -> Result<()>
pub fn save_source_metadata( &self, source: &str, metadata: &Source, ) -> Result<()>
Saves source metadata for a source
Sourcepub fn save_anchors_map(&self, source: &str, map: &AnchorsMap) -> Result<()>
pub fn save_anchors_map(&self, source: &str, map: &AnchorsMap) -> Result<()>
Save anchors remap JSON for a source
Sourcepub fn load_source_metadata(&self, source: &str) -> Result<Option<Source>>
pub fn load_source_metadata(&self, source: &str) -> Result<Option<Source>>
Loads source metadata for a source if it exists
Sourcepub fn list_sources(&self) -> Vec<String>
pub fn list_sources(&self) -> Vec<String>
Lists all cached sources
Sourcepub fn clear_cache(&self) -> Result<()>
pub fn clear_cache(&self) -> Result<()>
Clears the entire cache directory, removing all sources and their data.
This is a destructive operation that cannot be undone. Use with caution.
§Errors
Returns an error if the cache directory cannot be removed or recreated.
Auto Trait Implementations§
impl Freeze for Storage
impl RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl UnwindSafe for Storage
Blanket Implementations§
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> 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> 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> 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 more