pub struct SourceCache { /* private fields */ }Expand description
Manages a local cache directory for externally-sourced definitions.
Cache layout:
~/.ta/cache/{kind}/
{name}.yaml — the cached YAML content
{name}.meta.json — sidecar with CachedItem metadataImplementations§
Source§impl SourceCache
impl SourceCache
Sourcepub fn new(kind: &str) -> Self
pub fn new(kind: &str) -> Self
Create a new cache rooted at ~/.ta/cache/{kind}/.
kind is typically "workflows" or "agents".
Sourcepub fn with_dir(dir: PathBuf) -> Self
pub fn with_dir(dir: PathBuf) -> Self
Create a cache rooted at a custom directory (useful for tests).
Sourcepub fn get(&self, name: &str) -> Option<CachedItem>
pub fn get(&self, name: &str) -> Option<CachedItem>
Return a cached item by name, or None if it is not cached.
Sourcepub fn store(
&self,
name: &str,
content: &str,
source: &ExternalSource,
version: &str,
) -> Result<CachedItem, SourceError>
pub fn store( &self, name: &str, content: &str, source: &ExternalSource, version: &str, ) -> Result<CachedItem, SourceError>
Store content in the cache. Returns the resulting CachedItem.
Sourcepub fn remove(&self, name: &str) -> Result<bool, SourceError>
pub fn remove(&self, name: &str) -> Result<bool, SourceError>
Remove a cached item. Returns true if it existed.
Sourcepub fn list(&self) -> Vec<CachedItem>
pub fn list(&self) -> Vec<CachedItem>
List all cached items.
Auto Trait Implementations§
impl Freeze for SourceCache
impl RefUnwindSafe for SourceCache
impl Send for SourceCache
impl Sync for SourceCache
impl Unpin for SourceCache
impl UnsafeUnpin for SourceCache
impl UnwindSafe for SourceCache
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
Mutably borrows from an owned value. Read more