pub struct TieredStorage { /* private fields */ }
Implementations§
source§impl TieredStorage
impl TieredStorage
sourcepub fn new_writable(path: impl Into<PathBuf>) -> Self
pub fn new_writable(path: impl Into<PathBuf>) -> Self
Creates a new writable instance of TieredStorage based on the specified path and TieredStorageFormat.
Note that the actual file will not be created until write_accounts is called.
sourcepub fn new_readonly(path: impl Into<PathBuf>) -> TieredStorageResult<Self>
pub fn new_readonly(path: impl Into<PathBuf>) -> TieredStorageResult<Self>
Creates a new read-only instance of TieredStorage from the specified path.
sourcepub fn write_accounts<'a, 'b, T: ReadableAccount + Sync, U: StorableAccounts<'a, T>, V: Borrow<AccountHash>>(
&self,
accounts: &StorableAccountsWithHashesAndWriteVersions<'a, 'b, T, U, V>,
skip: usize,
format: &TieredStorageFormat,
) -> TieredStorageResult<Vec<StoredAccountInfo>>
pub fn write_accounts<'a, 'b, T: ReadableAccount + Sync, U: StorableAccounts<'a, T>, V: Borrow<AccountHash>>( &self, accounts: &StorableAccountsWithHashesAndWriteVersions<'a, 'b, T, U, V>, skip: usize, format: &TieredStorageFormat, ) -> TieredStorageResult<Vec<StoredAccountInfo>>
Writes the specified accounts into this TieredStorage.
Note that this function can only be called once per a TieredStorage instance. TieredStorageError::AttemptToUpdateReadOnly will be returned if this function is invoked more than once on the same TieredStorage instance.
sourcepub fn reader(&self) -> Option<&TieredStorageReader>
pub fn reader(&self) -> Option<&TieredStorageReader>
Returns the underlying reader of the TieredStorage. None will be returned if it’s is_read_only() returns false.
sourcepub fn is_read_only(&self) -> bool
pub fn is_read_only(&self) -> bool
Returns true if the TieredStorage instance is read-only.
sourcepub fn file_size(&self) -> TieredStorageResult<u64>
pub fn file_size(&self) -> TieredStorageResult<u64>
Returns the size of the underlying accounts file.
Trait Implementations§
source§impl Debug for TieredStorage
impl Debug for TieredStorage
Auto Trait Implementations§
impl !Freeze for TieredStorage
impl RefUnwindSafe for TieredStorage
impl Send for TieredStorage
impl Sync for TieredStorage
impl Unpin for TieredStorage
impl UnwindSafe for TieredStorage
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
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 more