Skip to main content

LocalProvider

Struct LocalProvider 

Source
pub struct LocalProvider { /* private fields */ }
Expand description

Local filesystem VFS provider with path-traversal protection.

All operations are scoped to root. Relative paths are resolved from the current working directory (cwd), which itself must stay inside root.

Implementations§

Source§

impl LocalProvider

Source

pub fn new(root: impl Into<PathBuf>) -> Result<Self, VfsError>

Create a new provider rooted at root.

§Errors

Returns an error if root does not exist or is not a directory.

Trait Implementations§

Source§

impl Debug for LocalProvider

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Vfs for LocalProvider

Source§

fn ls( &self, path: &str, _opts: LsOptions, ) -> BoxFuture<'_, Result<Vec<DirEntry>, VfsError>>

List directory contents. ls [opts] <path> Read more
Source§

fn read(&self, path: &str) -> BoxFuture<'_, Result<FileContent, VfsError>>

Read entire file contents. cat <path>
Source§

fn write( &self, path: &str, content: &[u8], ) -> BoxFuture<'_, Result<WriteResult, VfsError>>

Write bytes to a file (creates or overwrites). >
Source§

fn edit( &self, path: &str, old: &str, new: &str, ) -> BoxFuture<'_, Result<EditResult, VfsError>>

Edit a file by replacing old with new (first occurrence). sed-like.
Source§

fn grep( &self, pattern: &str, opts: GrepOptions, ) -> BoxFuture<'_, Result<Vec<GrepMatch>, VfsError>>

Search file contents. grep [opts] <pattern>
Source§

fn glob(&self, pattern: &str) -> BoxFuture<'_, Result<Vec<GlobEntry>, VfsError>>

Glob for file paths matching a pattern.
Source§

fn upload( &self, from: &str, to: &str, ) -> BoxFuture<'_, Result<TransferResult, VfsError>>

Upload a file from from (local path) to to (VFS path).
Source§

fn download( &self, from: &str, to: &str, ) -> BoxFuture<'_, Result<TransferResult, VfsError>>

Download a file from from (VFS path) to to (local path).
Source§

fn pwd(&self) -> BoxFuture<'_, Result<String, VfsError>>

Return the current working directory. pwd
Source§

fn cd(&self, path: &str) -> BoxFuture<'_, Result<(), VfsError>>

Change the current working directory. cd <path>
Source§

fn rm( &self, path: &str, _opts: RmOptions, ) -> BoxFuture<'_, Result<(), VfsError>>

Remove a file or directory. rm [opts] <path> Read more
Source§

fn cp( &self, from: &str, to: &str, _opts: CpOptions, ) -> BoxFuture<'_, Result<TransferResult, VfsError>>

Copy from to to. cp [opts] <from> <to> Read more
Source§

fn mv_file( &self, from: &str, to: &str, ) -> BoxFuture<'_, Result<TransferResult, VfsError>>

Move / rename from to to. mv <from> <to>
Source§

fn watch(&self, path: &str) -> BoxFuture<'_, Result<(), VfsError>>

Begin watching a path for external modifications. Read more
Source§

fn check_stale(&self, path: &str) -> BoxFuture<'_, Result<(), VfsError>>

Check whether a previously-read file has been modified externally. Read more
Source§

fn find( &self, path: &str, opts: FindOptions, ) -> BoxFuture<'_, Result<Vec<FindEntry>, VfsError>>

Search for files by criteria. find [opts] <path> Read more
Source§

fn capabilities(&self) -> VfsCapabilities

Return the capabilities supported by this provider.
Source§

fn provider_name(&self) -> &'static str

Human-readable provider type name (e.g. "LocalProvider", "MemoryProvider"). Read more
Source§

fn tree( &self, path: &str, opts: TreeOptions, ) -> Pin<Box<dyn Future<Output = Result<TreeEntry, VfsError>> + Send + '_>>

Recursive directory tree. tree [opts] <path> Read more
Source§

fn read_range( &self, path: &str, range: ReadRange, ) -> Pin<Box<dyn Future<Output = Result<String, VfsError>> + Send + '_>>

Read a sub-range of a file by line numbers or byte offsets. Read more
Source§

fn head( &self, path: &str, opts: HeadTailOptions, ) -> Pin<Box<dyn Future<Output = Result<String, VfsError>> + Send + '_>>

Read the first N lines or bytes. head [opts] <path> Read more
Source§

fn tail( &self, path: &str, opts: HeadTailOptions, ) -> Pin<Box<dyn Future<Output = Result<String, VfsError>> + Send + '_>>

Read the last N lines or bytes. tail [opts] <path> Read more
Source§

fn stat( &self, path: &str, ) -> Pin<Box<dyn Future<Output = Result<FileInfo, VfsError>> + Send + '_>>

File metadata. stat <path>
Source§

fn wc( &self, path: &str, ) -> Pin<Box<dyn Future<Output = Result<WordCount, VfsError>> + Send + '_>>

Line, word, and byte counts. wc <path>
Source§

fn du( &self, path: &str, opts: DuOptions, ) -> Pin<Box<dyn Future<Output = Result<DiskUsage, VfsError>> + Send + '_>>

Disk usage. du [opts] <path> Read more
Source§

fn append( &self, path: &str, content: &[u8], ) -> Pin<Box<dyn Future<Output = Result<WriteResult, VfsError>> + Send + '_>>

Append bytes to a file (creates if absent). >>
Source§

fn mkdir( &self, path: &str, opts: MkdirOptions, ) -> Pin<Box<dyn Future<Output = Result<(), VfsError>> + Send + '_>>

Create a directory. mkdir [opts] <path> Read more
Source§

fn touch( &self, path: &str, ) -> Pin<Box<dyn Future<Output = Result<(), VfsError>> + Send + '_>>

Create an empty file or update its timestamp. touch <path>
Source§

fn diff( &self, a: &str, b: &str, opts: DiffOptions, ) -> Pin<Box<dyn Future<Output = Result<DiffResult, VfsError>> + Send + '_>>

Compare two files. diff [opts] <a> <b> Read more
Source§

fn ln( &self, target: &str, link: &str, symbolic: bool, ) -> Pin<Box<dyn Future<Output = Result<(), VfsError>> + Send + '_>>

Create a link. ln [-s] <target> <link>
Source§

fn chmod( &self, path: &str, mode: u32, ) -> Pin<Box<dyn Future<Output = Result<(), VfsError>> + Send + '_>>

Change file permissions. chmod <mode> <path>
Source§

fn index( &self, path: &str, opts: IndexOptions, ) -> Pin<Box<dyn Future<Output = Result<IndexHandle, VfsError>> + Send + '_>>

Start indexing a directory for semantic search. Read more
Source§

fn index_status( &self, index_id: &str, ) -> Pin<Box<dyn Future<Output = Result<IndexStatus, VfsError>> + Send + '_>>

Check the status of an indexing operation.
Semantic search across indexed content. Read more
Hybrid BM25 + vector search across indexed content. Read more
Source§

fn skeleton<'a>( &'a self, path: &'a str, ) -> Pin<Box<dyn Future<Output = Result<String, VfsError>> + Send + 'a>>

Return only the function and method signatures of a source file, stripping all body content. Read more
Source§

fn list_communities( &self, ) -> Pin<Box<dyn Future<Output = Result<Vec<CommunityEntry>, VfsError>> + Send + '_>>

List all detected communities with their member counts. Read more
Source§

fn community_members( &self, community_id: u64, ) -> Pin<Box<dyn Future<Output = Result<CommunityMembersResult, VfsError>> + Send + '_>>

List the symbol members of a specific community. Read more
Search for communities whose member names match query. Read more
Source§

fn community_summary( &self, community_id: u64, ) -> Pin<Box<dyn Future<Output = Result<CommunitySummaryResult, VfsError>> + Send + '_>>

Get (or generate) a natural-language summary for a community. Read more
Source§

fn mount_info(&self) -> Vec<MountInfo>

Return mount information for this provider. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more