pub struct DiskFileSystem { /* private fields */ }Expand description
DiskFileSystem carries serializable fields (name, root,
denied_paths) inside DiskFileSystemInner alongside session-scoped
state (the notify watcher, invalidator maps, weak TurboTasksApi,
etc.) This is important to maintain invariants in a session and ensure invalidations work, so we
never evict this data.
Implementations§
Source§impl DiskFileSystem
impl DiskFileSystem
pub fn name(&self) -> &RcStr
pub fn root(&self) -> &RcStr
pub fn invalidate(&self)
pub fn invalidate_with_reason<R: InvalidationReason + Clone>( &self, reason: impl Fn(&Path) -> R + Sync, )
pub fn invalidate_path_and_children_with_reason<R: InvalidationReason + Clone>( &self, paths: impl IntoIterator<Item = PathBuf>, reason: impl Fn(&Path) -> R + Sync, )
pub async fn start_watching( &self, poll_interval: Option<Duration>, ) -> Result<()>
pub async fn start_watching_with_invalidation_reason( &self, poll_interval: Option<Duration>, ) -> Result<()>
pub async fn stop_watching(&self)
Sourcepub fn try_from_sys_path(
&self,
vc_self: ResolvedVc<DiskFileSystem>,
sys_path: &Path,
relative_to: Option<&FileSystemPath>,
) -> Option<FileSystemPath>
pub fn try_from_sys_path( &self, vc_self: ResolvedVc<DiskFileSystem>, sys_path: &Path, relative_to: Option<&FileSystemPath>, ) -> Option<FileSystemPath>
Try to convert Path to FileSystemPath. Return None if the file path leaves the
filesystem root. If no relative_to argument is given, it is assumed that the sys_path is
relative to the DiskFileSystem root.
Attempts to convert absolute paths to paths relative to the filesystem root, though we only attempt to do so lexically.
Assumes self is the DiskFileSystem contained in vc_self. This API is a bit awkward
because:
Path/PathBufshould not be stored in the filesystem cache, so the function cannot be aturbo_tasks::function.- It’s a little convenient for this function to be sync.
pub fn to_sys_path(&self, fs_path: &FileSystemPath) -> PathBuf
Source§impl DiskFileSystem
impl DiskFileSystem
Sourcepub fn new(name: RcStr, root: Vc<RcStr>) -> Vc<Self>
pub fn new(name: RcStr, root: Vc<RcStr>) -> Vc<Self>
Create a new instance of DiskFileSystem.
§Arguments
name- Name of the filesystem.root- Path to the given filesystem’s root. Should be canonicalized.
Sourcepub fn new_with_denied_paths(
name: RcStr,
root: Vc<RcStr>,
denied_paths: Vec<RcStr>,
) -> Vc<Self>
pub fn new_with_denied_paths( name: RcStr, root: Vc<RcStr>, denied_paths: Vec<RcStr>, ) -> Vc<Self>
Create a new instance of DiskFileSystem.
§Arguments
name- Name of the filesystem.root- Path to the given filesystem’s root. Should be canonicalized.denied_paths- Paths within this filesystem that are not allowed to be accessed or navigated into. These must be normalized, non-empty and relative to the fs root.
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for DiskFileSystem
impl<'__de, __Context> BorrowDecode<'__de, __Context> for DiskFileSystem
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl Clone for DiskFileSystem
impl Clone for DiskFileSystem
Source§fn clone(&self) -> DiskFileSystem
fn clone(&self) -> DiskFileSystem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DiskFileSystem
impl Debug for DiskFileSystem
Source§impl<__Context> Decode<__Context> for DiskFileSystem
impl<__Context> Decode<__Context> for DiskFileSystem
Source§impl Encode for DiskFileSystem
impl Encode for DiskFileSystem
Source§impl FileSystem for DiskFileSystem
impl FileSystem for DiskFileSystem
fn read(self: Vc<Self>, fs_path: FileSystemPath) -> Vc<FileContent>
fn raw_read_dir( self: Vc<Self>, fs_path: FileSystemPath, ) -> Vc<RawDirectoryContent>
fn read_link(self: Vc<Self>, fs_path: FileSystemPath) -> Vc<LinkContent>
fn write( self: Vc<Self>, fs_path: FileSystemPath, content: Vc<FileContent>, ) -> Vc<()>
Source§fn write_link(
self: Vc<Self>,
fs_path: FileSystemPath,
target: Vc<LinkContent>,
) -> Vc<()>
fn write_link( self: Vc<Self>, fs_path: FileSystemPath, target: Vc<LinkContent>, ) -> Vc<()>
fn metadata(self: Vc<Self>, fs_path: FileSystemPath) -> Vc<FileMeta>
Source§fn root(self: Vc<Self>) -> Vc<FileSystemPath>where
Self: Sized,
fn root(self: Vc<Self>) -> Vc<FileSystemPath>where
Self: Sized,
Source§impl ShrinkToFit for DiskFileSystem
impl ShrinkToFit for DiskFileSystem
fn shrink_to_fit(&mut self)
Source§impl TraceRawVcs for DiskFileSystem
impl TraceRawVcs for DiskFileSystem
fn trace_raw_vcs(&self, __context__: &mut TraceRawVcsContext)
fn get_raw_vcs(&self) -> Vec<RawVc>
Source§impl ValueDebug for DiskFileSystem
impl ValueDebug for DiskFileSystem
Source§impl ValueDebugFormat for DiskFileSystem
Available on debug-assertions enabled only.
impl ValueDebugFormat for DiskFileSystem
fn value_debug_format<'a>(&'a self, depth: usize) -> ValueDebugFormatString<'a>
Source§impl ValueToStringRef for DiskFileSystem
impl ValueToStringRef for DiskFileSystem
async fn to_string_ref(&self) -> Result<RcStr>
Source§impl VcValueType for DiskFileSystem
impl VcValueType for DiskFileSystem
Source§type Read = VcDefaultRead<DiskFileSystem>
type Read = VcDefaultRead<DiskFileSystem>
Source§type CellMode = VcCellNewMode<DiskFileSystem>
type CellMode = VcCellNewMode<DiskFileSystem>
Source§fn get_value_type_id() -> ValueTypeId
fn get_value_type_id() -> ValueTypeId
fn has_serialization() -> bool
impl NonLocalValue for DiskFileSystem
impl Upcast<Box<dyn FileSystem>> for DiskFileSystem
impl Upcast<Box<dyn ValueDebug>> for DiskFileSystem
impl Upcast<Box<dyn ValueToString>> for DiskFileSystem
impl UpcastStrict<Box<dyn FileSystem>> for DiskFileSystem
impl UpcastStrict<Box<dyn ValueDebug>> for DiskFileSystem
impl UpcastStrict<Box<dyn ValueToString>> for DiskFileSystem
Auto Trait Implementations§
impl Freeze for DiskFileSystem
impl !RefUnwindSafe for DiskFileSystem
impl Send for DiskFileSystem
impl Sync for DiskFileSystem
impl Unpin for DiskFileSystem
impl UnsafeUnpin for DiskFileSystem
impl !UnwindSafe for DiskFileSystem
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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> ⓘ
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> ⓘ
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