Skip to main content

LocalWorkspace

Struct LocalWorkspace 

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

A local filesystem workspace implementation.

All operations are performed against the host filesystem under the configured root directory.

Implementations§

Source§

impl LocalWorkspace

Source

pub async fn write_upload_chunk( &self, path: &str, offset: u64, bytes: &[u8], ) -> Result<u64>

Source

pub fn new(root: PathBuf) -> Self

Source

pub fn new_with_host_exec(root: PathBuf, allow_host_exec: bool) -> Self

Explicitly opt into host command execution for trusted local/test use.

Source

pub fn capabilities(&self) -> WorkspaceCapabilities

Trait Implementations§

Source§

impl Clone for LocalWorkspace

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LocalWorkspace

Source§

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

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

impl Workspace for LocalWorkspace

Source§

fn description(&self) -> String

Source§

fn root(&self) -> PathBuf

Source§

fn capabilities(&self) -> WorkspaceCapabilities

Describe the data-plane features exposed by this workspace handle. Read more
Source§

fn read_file<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn read_file_bytes<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn write_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, content: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn write_file_bytes<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, content: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn file_revision<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return a content revision suitable for optimistic concurrency checks.
Source§

fn write_file_if_match<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, path: &'life1 str, content: &'life2 [u8], if_match: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Compatibility CAS facade. Adapters should override this so compare and write share their strongest available atomicity boundary.
Source§

fn create_dir_all<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Security-sensitive file operations have no shell-based compatibility fallback. Every adapter must implement them with its native file API.
Source§

fn remove_file<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn remove_file_if_match<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, if_match: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove a file only when its content revision still matches. Adapters should override this so the check and unlink share one atomic boundary.
Source§

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn is_dir<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn list_dir<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<DirEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn list_dir_with_options<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, options: FileVisibilityOptions, ) -> Pin<Box<dyn Future<Output = Result<Vec<DirEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn walk_tree<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, max_depth: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn walk_tree_with_options<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, max_depth: usize, options: FileVisibilityOptions, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn find_files<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, pattern: &'life1 str, path: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn grep<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, pattern: &'life1 str, path: &'life2 str, include: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<GrepMatch>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source§

fn exec<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, command: &'life1 str, cwd: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<CmdOutput>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn port_url<'life0, 'async_trait>( &'life0 self, port: u16, ) -> Pin<Box<dyn Future<Output = Result<PortUrl>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn resolved_backend_id(&self) -> Option<ResolvedBackendId>

Source§

fn supports_change_sets(&self) -> bool

Whether this handle is backed by Infra’s durable, atomic ChangeSet API.
Source§

fn apply_change_set<'life0, 'async_trait>( &'life0 self, _request: WorkspaceChangeSetRequest, ) -> Pin<Box<dyn Future<Output = Result<WorkspaceChangeSet, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Source§

fn get_change_set<'life0, 'life1, 'async_trait>( &'life0 self, _id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<WorkspaceChangeSet, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source§

fn revert_change_set<'life0, 'life1, 'async_trait>( &'life0 self, _id: &'life1 str, _conversation_id: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<WorkspaceChangeSet, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source§

fn read_file_tail<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, max_bytes: usize, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Read at most the final max_bytes of a UTF-8 text file. Read more
Source§

fn read_file_versioned<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<VersionedFile, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source§

fn write_file_chunk<'life0, 'life1, 'async_trait>( &'life0 self, _path: &'life1 str, _offset: u64, _content: Bytes, _final_chunk: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Write one resumable upload chunk at an exact byte offset.
Source§

fn file_size<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source§

fn find_files_with_options<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, pattern: &'life1 str, path: &'life2 str, _options: FileVisibilityOptions, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Source§

fn grep_with_options<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, pattern: &'life1 str, path: &'life2 str, include: Option<&'life3 str>, _options: FileVisibilityOptions, ) -> Pin<Box<dyn Future<Output = Result<Vec<GrepMatch>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Source§

fn resource_usage<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<WorkspaceResourceUsage, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Collect resource pressure from inside the workspace boundary. Read more
Source§

fn exec_detached<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, command: &'life1 str, cwd: Option<&'life2 str>, _timeout_secs: u64, ) -> Pin<Box<dyn Future<Output = Result<CmdOutput, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Start a command whose lifetime is independent from the request that launched it. Remote backends should override this when their synchronous exec transport owns or reaps descendant processes after returning.
Source§

fn port_url_with_ttl<'life0, 'async_trait>( &'life0 self, port: u16, _ttl_seconds: u64, ) -> Pin<Box<dyn Future<Output = Result<PortUrl, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Resolve a preview URL whose provider-side token remains valid for the requested lifetime. Backends without signed URLs can ignore the TTL.
Source§

fn start_static_preview<'life0, 'life1, 'async_trait>( &'life0 self, directory: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<StaticPreviewServer, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Start a managed, loopback-only static server rooted at directory. Read more
Source§

fn static_preview_ready<'life0, 'life1, 'async_trait>( &'life0 self, server: &'life1 StaticPreviewServer, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Check whether a previously started static Preview still owns its process and the port it published. Remote backends may override this when process identity is managed by the provider.
Source§

fn stop_static_preview<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source§

fn keep_alive<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Source§

fn init<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Source§

fn cleanup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Source§

impl WorkspaceUploadWriter for LocalWorkspace

Source§

fn write_upload_chunk<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, offset: u64, bytes: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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> WorkspaceCommands for T
where T: Workspace + ?Sized,

Source§

fn command_exec<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, command: &'life1 str, cwd: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<CmdOutput, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, T: 'async_trait,

Source§

impl<T> WorkspaceFiles for T
where T: Workspace + ?Sized,

Source§

fn file_read<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait,

Source§

fn file_write<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, path: &'life1 str, content: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, T: 'async_trait,

Source§

fn directory_create_all<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait,

Source§

fn file_remove<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait,

Source§

fn path_exists<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait,

Source§

fn directory_list<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<DirEntry>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait,

Source§

impl<T> WorkspaceSearch for T
where T: Workspace + ?Sized,

Source§

fn search_walk_tree<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 str, max_depth: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait,

Source§

fn search_find_files<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, pattern: &'life1 str, path: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, T: 'async_trait,

Source§

fn search_grep<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, pattern: &'life1 str, path: &'life2 str, include: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<GrepMatch>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, T: 'async_trait,