Struct solana_accounts_db::tiered_storage::file::TieredStorageFile
source · pub struct TieredStorageFile(pub File);
Tuple Fields§
§0: File
Implementations§
source§impl TieredStorageFile
impl TieredStorageFile
pub fn new_readonly(file_path: impl AsRef<Path>) -> Self
pub fn new_writable(file_path: impl AsRef<Path>) -> IoResult<Self>
sourcepub fn write_pod<T: NoUninit>(&self, value: &T) -> IoResult<usize>
pub fn write_pod<T: NoUninit>(&self, value: &T) -> IoResult<usize>
Writes value
to the file.
value
must be plain ol’ data.
sourcepub unsafe fn write_type<T>(&self, value: &T) -> IoResult<usize>
pub unsafe fn write_type<T>(&self, value: &T) -> IoResult<usize>
Writes value
to the file.
Prefer write_pod
when possible, because write_value
may cause
undefined behavior if value
contains uninitialized bytes.
§Safety
Caller must ensure casting T to bytes is safe. Refer to the Safety sections in std::slice::from_raw_parts() and bytemuck’s Pod and NoUninit for more information.
sourcepub fn read_pod<T: NoUninit + AnyBitPattern>(
&self,
value: &mut T
) -> IoResult<()>
pub fn read_pod<T: NoUninit + AnyBitPattern>( &self, value: &mut T ) -> IoResult<()>
Reads a value of type T
from the file.
Type T must be plain ol’ data.
sourcepub unsafe fn read_type<T>(&self, value: &mut T) -> IoResult<()>
pub unsafe fn read_type<T>(&self, value: &mut T) -> IoResult<()>
Reads a value of type T
from the file.
Prefer read_pod()
when possible, because read_type()
may cause
undefined behavior.
§Safety
Caller must ensure casting bytes to T is safe. Refer to the Safety sections in std::slice::from_raw_parts() and bytemuck’s Pod and AnyBitPattern for more information.
pub fn seek(&self, offset: u64) -> IoResult<u64>
pub fn seek_from_end(&self, offset: i64) -> IoResult<u64>
pub fn write_bytes(&self, bytes: &[u8]) -> IoResult<usize>
pub fn read_bytes(&self, buffer: &mut [u8]) -> IoResult<()>
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for TieredStorageFile
impl Send for TieredStorageFile
impl Sync for TieredStorageFile
impl Unpin for TieredStorageFile
impl UnwindSafe for TieredStorageFile
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