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
impl LocalWorkspace
pub async fn write_upload_chunk( &self, path: &str, offset: u64, bytes: &[u8], ) -> Result<u64>
pub fn new(root: PathBuf) -> Self
Sourcepub fn new_with_host_exec(root: PathBuf, allow_host_exec: bool) -> Self
pub fn new_with_host_exec(root: PathBuf, allow_host_exec: bool) -> Self
Explicitly opt into host command execution for trusted local/test use.
pub fn capabilities(&self) -> WorkspaceCapabilities
Trait Implementations§
Source§impl Clone for LocalWorkspace
impl Clone for LocalWorkspace
Source§impl Debug for LocalWorkspace
impl Debug for LocalWorkspace
Source§impl Workspace for LocalWorkspace
impl Workspace for LocalWorkspace
fn description(&self) -> String
fn root(&self) -> PathBuf
Source§fn capabilities(&self) -> WorkspaceCapabilities
fn capabilities(&self) -> WorkspaceCapabilities
Describe the data-plane features exposed by this workspace handle. Read more
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,
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,
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,
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,
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,
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,
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.
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,
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.
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
fn resolved_backend_id(&self) -> Option<ResolvedBackendId>
Source§fn supports_change_sets(&self) -> bool
fn supports_change_sets(&self) -> bool
Whether this handle is backed by Infra’s durable, atomic ChangeSet API.
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,
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,
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,
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 morefn 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,
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.
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,
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,
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,
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,
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,
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,
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 moreSource§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,
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.
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,
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,
fn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn cleanup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations§
impl Freeze for LocalWorkspace
impl RefUnwindSafe for LocalWorkspace
impl Send for LocalWorkspace
impl Sync for LocalWorkspace
impl Unpin for LocalWorkspace
impl UnsafeUnpin for LocalWorkspace
impl UnwindSafe for LocalWorkspace
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