Skip to main content

PolicyFilesystemCtxView

Struct PolicyFilesystemCtxView 

Source
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: PolicyMode

Configured 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<'_>

Source§

fn get_directories(&mut self) -> Result<Vec<(Resource<Descriptor>, String)>>

Return the set of preopened directories, and their paths.
Source§

impl Host for PolicyFilesystemCtxView<'_>

Source§

fn convert_error_code(&mut self, err: FsError) -> Result<ErrorCode>

Source§

fn filesystem_error_code( &mut self, err: Resource<Error>, ) -> Result<Option<ErrorCode>>

Attempts to extract a filesystem-related error-code from the stream error provided. Read more
Source§

impl Host for PolicyFilesystemCtxView<'_>

Source§

fn get_directories(&mut self) -> Result<Vec<(Resource<Descriptor>, String)>>

Return the set of preopened directories, and their paths.
Source§

impl HostDescriptor for PolicyFilesystemCtxView<'_>

Source§

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<()>

Synchronize the data of a file to disk. Read more
Source§

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>

Get the dynamic type of a descriptor. Read more
Source§

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<()>

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)>

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>

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>>

Read directory entries from a directory. Read more
Source§

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<()>

Create a directory. Read more
Source§

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>

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<()>

Adjust the timestamps of a file or directory. Read more
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>>

Open a file or directory. Read more
Source§

fn drop(&mut self, fd: Resource<Descriptor>) -> Result<()>

Read the contents of a symbolic link. Read more
Source§

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<()>

Rename a filesystem object. Read more
Create a symbolic link (also known as a “symlink”). Read more
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>>

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>>

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>>

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>

Test whether two descriptors refer to the same filesystem object. Read more
Source§

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>

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<'_>

Source§

async fn read_directory_entry( &mut self, stream: Resource<DirectoryEntryStream>, ) -> FsResult<Option<DirectoryEntry>>

Read a single directory entry from a directory-entry-stream.
Source§

fn drop(&mut self, stream: Resource<DirectoryEntryStream>) -> Result<()>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

Source§

type Error = <Target as OctetsFrom<Source>>::Error

Source§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
Source§

fn octets_into(self) -> Target
where Self::Error: Into<!>,

Performs an infallible conversion.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more