pub struct PageCache<FS: FileSystem>(pub Arc<PageCacheInner<FS>>);Expand description
A reference-counted handle to the page cache.
PageCache wraps an [Arc] around PageCacheInner, allowing
safe sharing across multiple threads. It provides methods to
construct a cache and to read pages with read-ahead support.
Tuple Fields§
§0: Arc<PageCacheInner<FS>>Implementations§
Source§impl<FS: FileSystem> PageCache<FS>
impl<FS: FileSystem> PageCache<FS>
Sourcepub fn new(fs: FS) -> Self
pub fn new(fs: FS) -> Self
Create a new page cache associated with the given file system.
Spawns a background thread to service read-ahead requests.
Sourcepub fn read(
&self,
file: &RegularFile,
fba: FileBlockNumber,
buf: &mut [u8; 4096],
) -> Result<bool, KernelError>
pub fn read( &self, file: &RegularFile, fba: FileBlockNumber, buf: &mut [u8; 4096], ) -> Result<bool, KernelError>
Read a page from the cache or underlying file system.
A read-ahead request for subsequent pages is issued to the background thread.
Trait Implementations§
Source§impl<FS: FileSystem> Clone for PageCache<FS>
impl<FS: FileSystem> Clone for PageCache<FS>
Source§impl<FS: FileSystem + 'static> FileSystem for PageCache<FS>
impl<FS: FileSystem + 'static> FileSystem for PageCache<FS>
Auto Trait Implementations§
impl<FS> Freeze for PageCache<FS>
impl<FS> !RefUnwindSafe for PageCache<FS>
impl<FS> Send for PageCache<FS>
impl<FS> Sync for PageCache<FS>
impl<FS> Unpin for PageCache<FS>
impl<FS> !UnwindSafe for PageCache<FS>
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)