pub struct PolicyFilesystemCtxView<'a> {
pub ctx: &'a mut WasiFilesystemCtx,
pub table: &'a mut ResourceTable,
pub ceiling: &'a Arc<dyn CompiledCeiling>,
pub fd_paths: &'a mut FdPathMap,
pub mode: PolicyMode,
pub prompter: Arc<dyn ConsentPrompter>,
pub cache: Arc<DecisionCache>,
}Expand description
Per-call view bundling all state the policy wrapper needs.
Fields§
§ctx: &'a mut WasiFilesystemCtx§table: &'a mut ResourceTable§ceiling: &'a Arc<dyn CompiledCeiling>§fd_paths: &'a mut FdPathMap§mode: PolicyModeConfigured mode; drives the p3 preopens kill-switch. p3 path-taking
ops can’t be gated (upstream Dir::open_at is pub(crate)), so when
mode is anything but Open we return zero preopens from p3 and p3
guests can’t acquire a Descriptor::Dir handle at all.
prompter: Arc<dyn ConsentPrompter>Interactive-consent prompter, consulted when the ceiling returns
Decision::Ask. Shared across the store.
cache: Arc<DecisionCache>Per-session memory of ask decisions, keyed by (cap-id, path).
Trait Implementations§
Source§impl Host for PolicyFilesystemCtxView<'_>
impl Host for PolicyFilesystemCtxView<'_>
Source§fn get_directories(&mut self) -> Result<Vec<(Resource<Descriptor>, String)>>
fn get_directories(&mut self) -> Result<Vec<(Resource<Descriptor>, String)>>
Return the set of preopened directories, and their paths.
Source§impl Host for PolicyFilesystemCtxView<'_>
impl Host for PolicyFilesystemCtxView<'_>
Source§impl Host for PolicyFilesystemCtxView<'_>
impl Host for PolicyFilesystemCtxView<'_>
Source§fn get_directories(&mut self) -> Result<Vec<(Resource<Descriptor>, String)>>
fn get_directories(&mut self) -> Result<Vec<(Resource<Descriptor>, String)>>
Return the set of preopened directories, and their paths.
Source§impl HostDescriptor for PolicyFilesystemCtxView<'_>
impl HostDescriptor for PolicyFilesystemCtxView<'_>
Source§async fn advise(
&mut self,
fd: Resource<Descriptor>,
offset: Filesize,
len: Filesize,
advice: Advice,
) -> FsResult<()>
async fn advise( &mut self, fd: Resource<Descriptor>, offset: Filesize, len: Filesize, advice: Advice, ) -> FsResult<()>
Provide file advisory information on a descriptor. Read more
Source§async fn sync_data(&mut self, fd: Resource<Descriptor>) -> FsResult<()>
async fn sync_data(&mut self, fd: Resource<Descriptor>) -> FsResult<()>
Synchronize the data of a file to disk. Read more
Source§async fn get_flags(
&mut self,
fd: Resource<Descriptor>,
) -> FsResult<DescriptorFlags>
async fn get_flags( &mut self, fd: Resource<Descriptor>, ) -> FsResult<DescriptorFlags>
Get flags associated with a descriptor. Read more
Source§async fn get_type(
&mut self,
fd: Resource<Descriptor>,
) -> FsResult<DescriptorType>
async fn get_type( &mut self, fd: Resource<Descriptor>, ) -> FsResult<DescriptorType>
Get the dynamic type of a descriptor. Read more
Source§async fn set_size(
&mut self,
fd: Resource<Descriptor>,
size: Filesize,
) -> FsResult<()>
async fn set_size( &mut self, fd: Resource<Descriptor>, size: Filesize, ) -> FsResult<()>
Adjust the size of an open file. If this increases the file’s size, the
extra bytes are filled with zeros. Read more
Source§async fn set_times(
&mut self,
fd: Resource<Descriptor>,
atim: NewTimestamp,
mtim: NewTimestamp,
) -> FsResult<()>
async fn set_times( &mut self, fd: Resource<Descriptor>, atim: NewTimestamp, mtim: NewTimestamp, ) -> FsResult<()>
Adjust the timestamps of an open file or directory. Read more
Source§async fn read(
&mut self,
fd: Resource<Descriptor>,
len: Filesize,
offset: Filesize,
) -> FsResult<(Vec<u8>, bool)>
async fn read( &mut self, fd: Resource<Descriptor>, len: Filesize, offset: Filesize, ) -> FsResult<(Vec<u8>, bool)>
Read from a descriptor, without using and updating the descriptor’s offset. Read more
Source§async fn write(
&mut self,
fd: Resource<Descriptor>,
buf: Vec<u8>,
offset: Filesize,
) -> FsResult<Filesize>
async fn write( &mut self, fd: Resource<Descriptor>, buf: Vec<u8>, offset: Filesize, ) -> FsResult<Filesize>
Write to a descriptor, without using and updating the descriptor’s offset. Read more
Source§async fn read_directory(
&mut self,
fd: Resource<Descriptor>,
) -> FsResult<Resource<DirectoryEntryStream>>
async fn read_directory( &mut self, fd: Resource<Descriptor>, ) -> FsResult<Resource<DirectoryEntryStream>>
Read directory entries from a directory. Read more
Source§async fn sync(&mut self, fd: Resource<Descriptor>) -> FsResult<()>
async fn sync(&mut self, fd: Resource<Descriptor>) -> FsResult<()>
Synchronize the data and metadata of a file to disk. Read more
Source§async fn create_directory_at(
&mut self,
fd: Resource<Descriptor>,
path: String,
) -> FsResult<()>
async fn create_directory_at( &mut self, fd: Resource<Descriptor>, path: String, ) -> FsResult<()>
Create a directory. Read more
Source§async fn stat(&mut self, fd: Resource<Descriptor>) -> FsResult<DescriptorStat>
async fn stat(&mut self, fd: Resource<Descriptor>) -> FsResult<DescriptorStat>
Return the attributes of an open file or directory. Read more
Source§async fn stat_at(
&mut self,
fd: Resource<Descriptor>,
path_flags: PathFlags,
path: String,
) -> FsResult<DescriptorStat>
async fn stat_at( &mut self, fd: Resource<Descriptor>, path_flags: PathFlags, path: String, ) -> FsResult<DescriptorStat>
Return the attributes of a file or directory. Read more
Source§async fn set_times_at(
&mut self,
fd: Resource<Descriptor>,
path_flags: PathFlags,
path: String,
atim: NewTimestamp,
mtim: NewTimestamp,
) -> FsResult<()>
async fn set_times_at( &mut self, fd: Resource<Descriptor>, path_flags: PathFlags, path: String, atim: NewTimestamp, mtim: NewTimestamp, ) -> FsResult<()>
Adjust the timestamps of a file or directory. Read more
Source§async fn link_at(
&mut self,
fd: Resource<Descriptor>,
old_path_flags: PathFlags,
old_path: String,
new_descriptor: Resource<Descriptor>,
new_path: String,
) -> FsResult<()>
async fn link_at( &mut self, fd: Resource<Descriptor>, old_path_flags: PathFlags, old_path: String, new_descriptor: Resource<Descriptor>, new_path: String, ) -> FsResult<()>
Create a hard link. Read more
Source§async fn open_at(
&mut self,
fd: Resource<Descriptor>,
path_flags: PathFlags,
path: String,
oflags: OpenFlags,
flags: DescriptorFlags,
) -> FsResult<Resource<Descriptor>>
async fn open_at( &mut self, fd: Resource<Descriptor>, path_flags: PathFlags, path: String, oflags: OpenFlags, flags: DescriptorFlags, ) -> FsResult<Resource<Descriptor>>
Open a file or directory. Read more
fn drop(&mut self, fd: Resource<Descriptor>) -> Result<()>
Source§async fn readlink_at(
&mut self,
fd: Resource<Descriptor>,
path: String,
) -> FsResult<String>
async fn readlink_at( &mut self, fd: Resource<Descriptor>, path: String, ) -> FsResult<String>
Read the contents of a symbolic link. Read more
Source§async fn remove_directory_at(
&mut self,
fd: Resource<Descriptor>,
path: String,
) -> FsResult<()>
async fn remove_directory_at( &mut self, fd: Resource<Descriptor>, path: String, ) -> FsResult<()>
Remove a directory. Read more
Source§async fn rename_at(
&mut self,
fd: Resource<Descriptor>,
old_path: String,
new_fd: Resource<Descriptor>,
new_path: String,
) -> FsResult<()>
async fn rename_at( &mut self, fd: Resource<Descriptor>, old_path: String, new_fd: Resource<Descriptor>, new_path: String, ) -> FsResult<()>
Rename a filesystem object. Read more
Source§async fn symlink_at(
&mut self,
fd: Resource<Descriptor>,
src_path: String,
dest_path: String,
) -> FsResult<()>
async fn symlink_at( &mut self, fd: Resource<Descriptor>, src_path: String, dest_path: String, ) -> FsResult<()>
Create a symbolic link (also known as a “symlink”). Read more
Source§async fn unlink_file_at(
&mut self,
fd: Resource<Descriptor>,
path: String,
) -> FsResult<()>
async fn unlink_file_at( &mut self, fd: Resource<Descriptor>, path: String, ) -> FsResult<()>
Unlink a filesystem object that is not a directory. Read more
Source§fn read_via_stream(
&mut self,
fd: Resource<Descriptor>,
offset: Filesize,
) -> FsResult<Resource<DynInputStream>>
fn read_via_stream( &mut self, fd: Resource<Descriptor>, offset: Filesize, ) -> FsResult<Resource<DynInputStream>>
Return a stream for reading from a file, if available. Read more
Source§fn write_via_stream(
&mut self,
fd: Resource<Descriptor>,
offset: Filesize,
) -> FsResult<Resource<DynOutputStream>>
fn write_via_stream( &mut self, fd: Resource<Descriptor>, offset: Filesize, ) -> FsResult<Resource<DynOutputStream>>
Return a stream for writing to a file, if available. Read more
Source§fn append_via_stream(
&mut self,
fd: Resource<Descriptor>,
) -> FsResult<Resource<DynOutputStream>>
fn append_via_stream( &mut self, fd: Resource<Descriptor>, ) -> FsResult<Resource<DynOutputStream>>
Return a stream for appending to a file, if available. Read more
Source§async fn is_same_object(
&mut self,
a: Resource<Descriptor>,
b: Resource<Descriptor>,
) -> Result<bool>
async fn is_same_object( &mut self, a: Resource<Descriptor>, b: Resource<Descriptor>, ) -> Result<bool>
Test whether two descriptors refer to the same filesystem object. Read more
Source§async fn metadata_hash(
&mut self,
fd: Resource<Descriptor>,
) -> FsResult<MetadataHashValue>
async fn metadata_hash( &mut self, fd: Resource<Descriptor>, ) -> FsResult<MetadataHashValue>
Return a hash of the metadata associated with a filesystem object referred
to by a descriptor. Read more
Source§async fn metadata_hash_at(
&mut self,
fd: Resource<Descriptor>,
path_flags: PathFlags,
path: String,
) -> FsResult<MetadataHashValue>
async fn metadata_hash_at( &mut self, fd: Resource<Descriptor>, path_flags: PathFlags, path: String, ) -> FsResult<MetadataHashValue>
Return a hash of the metadata associated with a filesystem object referred
to by a directory descriptor and a relative path. Read more
Source§impl HostDirectoryEntryStream for PolicyFilesystemCtxView<'_>
impl HostDirectoryEntryStream for PolicyFilesystemCtxView<'_>
Source§async fn read_directory_entry(
&mut self,
stream: Resource<DirectoryEntryStream>,
) -> FsResult<Option<DirectoryEntry>>
async fn read_directory_entry( &mut self, stream: Resource<DirectoryEntryStream>, ) -> FsResult<Option<DirectoryEntry>>
Read a single directory entry from a
directory-entry-stream.fn drop(&mut self, stream: Resource<DirectoryEntryStream>) -> Result<()>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for PolicyFilesystemCtxView<'a>
impl<'a> !Sync for PolicyFilesystemCtxView<'a>
impl<'a> !UnwindSafe for PolicyFilesystemCtxView<'a>
impl<'a> Freeze for PolicyFilesystemCtxView<'a>
impl<'a> Send for PolicyFilesystemCtxView<'a>
impl<'a> Unpin for PolicyFilesystemCtxView<'a>
impl<'a> UnsafeUnpin for PolicyFilesystemCtxView<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
Source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.