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§
Trait Implementations§
Source§impl Debug for LocalProvider
impl Debug for LocalProvider
Source§impl Vfs for LocalProvider
impl Vfs for LocalProvider
Source§fn ls(
&self,
path: &str,
_opts: LsOptions,
) -> BoxFuture<'_, Result<Vec<DirEntry>, VfsError>>
fn ls( &self, path: &str, _opts: LsOptions, ) -> BoxFuture<'_, Result<Vec<DirEntry>, VfsError>>
List directory contents.
ls [opts] <path> Read moreSource§fn read(&self, path: &str) -> BoxFuture<'_, Result<FileContent, VfsError>>
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>>
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>>
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>>
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>>
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>>
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>>
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>>
fn pwd(&self) -> BoxFuture<'_, Result<String, VfsError>>
Return the current working directory.
pwdSource§fn cd(&self, path: &str) -> BoxFuture<'_, Result<(), VfsError>>
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>>
fn rm( &self, path: &str, _opts: RmOptions, ) -> BoxFuture<'_, Result<(), VfsError>>
Remove a file or directory.
rm [opts] <path> Read moreSource§fn cp(
&self,
from: &str,
to: &str,
_opts: CpOptions,
) -> BoxFuture<'_, Result<TransferResult, VfsError>>
fn cp( &self, from: &str, to: &str, _opts: CpOptions, ) -> BoxFuture<'_, Result<TransferResult, VfsError>>
Source§fn mv_file(
&self,
from: &str,
to: &str,
) -> BoxFuture<'_, Result<TransferResult, VfsError>>
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>>
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>>
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>>
fn find( &self, path: &str, opts: FindOptions, ) -> BoxFuture<'_, Result<Vec<FindEntry>, VfsError>>
Search for files by criteria.
find [opts] <path> Read moreSource§fn capabilities(&self) -> VfsCapabilities
fn capabilities(&self) -> VfsCapabilities
Return the capabilities supported by this provider.
Source§fn provider_name(&self) -> &'static str
fn provider_name(&self) -> &'static str
Source§fn tree(
&self,
path: &str,
opts: TreeOptions,
) -> Pin<Box<dyn Future<Output = Result<TreeEntry, VfsError>> + Send + '_>>
fn tree( &self, path: &str, opts: TreeOptions, ) -> Pin<Box<dyn Future<Output = Result<TreeEntry, VfsError>> + Send + '_>>
Recursive directory tree.
tree [opts] <path> Read moreSource§fn read_range(
&self,
path: &str,
range: ReadRange,
) -> Pin<Box<dyn Future<Output = Result<String, VfsError>> + Send + '_>>
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 + '_>>
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 moreSource§fn tail(
&self,
path: &str,
opts: HeadTailOptions,
) -> Pin<Box<dyn Future<Output = Result<String, VfsError>> + Send + '_>>
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 moreSource§fn stat(
&self,
path: &str,
) -> Pin<Box<dyn Future<Output = Result<FileInfo, VfsError>> + Send + '_>>
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 + '_>>
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 + '_>>
fn du( &self, path: &str, opts: DuOptions, ) -> Pin<Box<dyn Future<Output = Result<DiskUsage, VfsError>> + Send + '_>>
Disk usage.
du [opts] <path> Read moreSource§fn append(
&self,
path: &str,
content: &[u8],
) -> Pin<Box<dyn Future<Output = Result<WriteResult, VfsError>> + Send + '_>>
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 + '_>>
fn mkdir( &self, path: &str, opts: MkdirOptions, ) -> Pin<Box<dyn Future<Output = Result<(), VfsError>> + Send + '_>>
Create a directory.
mkdir [opts] <path> Read moreSource§fn touch(
&self,
path: &str,
) -> Pin<Box<dyn Future<Output = Result<(), VfsError>> + Send + '_>>
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 + '_>>
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 moreSource§fn ln(
&self,
target: &str,
link: &str,
symbolic: bool,
) -> Pin<Box<dyn Future<Output = Result<(), VfsError>> + Send + '_>>
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 + '_>>
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 + '_>>
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 + '_>>
fn index_status( &self, index_id: &str, ) -> Pin<Box<dyn Future<Output = Result<IndexStatus, VfsError>> + Send + '_>>
Check the status of an indexing operation.
Source§fn semantic_search(
&self,
query: &str,
opts: SemanticSearchOptions,
) -> Pin<Box<dyn Future<Output = Result<Vec<SemanticSearchResult>, VfsError>> + Send + '_>>
fn semantic_search( &self, query: &str, opts: SemanticSearchOptions, ) -> Pin<Box<dyn Future<Output = Result<Vec<SemanticSearchResult>, VfsError>> + Send + '_>>
Semantic search across indexed content. Read more
Source§fn hybrid_search(
&self,
query: &str,
opts: HybridSearchOptions,
) -> Pin<Box<dyn Future<Output = Result<Vec<HybridSearchResult>, VfsError>> + Send + '_>>
fn hybrid_search( &self, query: &str, opts: HybridSearchOptions, ) -> Pin<Box<dyn Future<Output = Result<Vec<HybridSearchResult>, VfsError>> + Send + '_>>
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>>
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 + '_>>
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 + '_>>
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
Source§fn community_search(
&self,
query: &str,
opts: CommunitySearchOptions,
) -> Pin<Box<dyn Future<Output = Result<Vec<CommunitySearchResult>, VfsError>> + Send + '_>>
fn community_search( &self, query: &str, opts: CommunitySearchOptions, ) -> Pin<Box<dyn Future<Output = Result<Vec<CommunitySearchResult>, VfsError>> + Send + '_>>
Search for communities whose member names match
query. Read moreAuto Trait Implementations§
impl !Freeze for LocalProvider
impl RefUnwindSafe for LocalProvider
impl Send for LocalProvider
impl Sync for LocalProvider
impl Unpin for LocalProvider
impl UnsafeUnpin for LocalProvider
impl UnwindSafe for LocalProvider
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