pub struct WriteBlocklistFileStore { /* private fields */ }Expand description
Reject writes into vendored / build directories at any depth.
Reads, listings, stats, and greps pass through; only mutating operations
(write_file, delete_file, create_directory, seed_initial_file,
write_file_if_content_matches) check the blocklist.
Implementations§
Source§impl WriteBlocklistFileStore
impl WriteBlocklistFileStore
Sourcepub fn new(inner: Arc<dyn SessionFileSystem>) -> Self
pub fn new(inner: Arc<dyn SessionFileSystem>) -> Self
Wrap inner with the DEFAULT_WRITE_BLOCKLIST.
Sourcepub fn with_blocklist(
inner: Arc<dyn SessionFileSystem>,
blocklist: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_blocklist( inner: Arc<dyn SessionFileSystem>, blocklist: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Wrap inner with a custom blocklist (replaces the default entirely).
Trait Implementations§
Source§impl SessionFileSystem for WriteBlocklistFileStore
impl SessionFileSystem for WriteBlocklistFileStore
Source§fn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SessionFile>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SessionFile>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read a file by path
Source§fn write_file<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
content: &'life2 str,
encoding: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<SessionFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn write_file<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
content: &'life2 str,
encoding: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<SessionFile>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Write/create a file
Source§fn write_file_if_content_matches<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
expected_content: &'life2 str,
expected_encoding: &'life3 str,
content: &'life4 str,
encoding: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SessionFile>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
fn write_file_if_content_matches<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
expected_content: &'life2 str,
expected_encoding: &'life3 str,
content: &'life4 str,
encoding: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<Option<SessionFile>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Write a file only if its current content snapshot still matches. Read more
Source§fn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
recursive: bool,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
recursive: bool,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a file or directory
Source§fn list_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FileInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FileInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List files in a directory
Source§fn stat_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<FileStat>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stat_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<FileStat>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get file metadata
Source§fn grep_files<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: SessionId,
pattern: &'life1 str,
path_pattern: Option<&'life2 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,
fn grep_files<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: SessionId,
pattern: &'life1 str,
path_pattern: Option<&'life2 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,
Search files by pattern (grep)
Source§fn create_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<FileInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_directory<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: SessionId,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<FileInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a directory
Source§fn seed_initial_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: SessionId,
file: &'life1 InitialFile,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn seed_initial_file<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: SessionId,
file: &'life1 InitialFile,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Seed a starter file into a session workspace.
Auto Trait Implementations§
impl Freeze for WriteBlocklistFileStore
impl !RefUnwindSafe for WriteBlocklistFileStore
impl Send for WriteBlocklistFileStore
impl Sync for WriteBlocklistFileStore
impl Unpin for WriteBlocklistFileStore
impl UnsafeUnpin for WriteBlocklistFileStore
impl !UnwindSafe for WriteBlocklistFileStore
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request