pub struct TieredStorage { /* private fields */ }
Expand description
The implementation of AccountsFile for tiered-storage.
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>(
&self,
accounts: &impl StorableAccounts<'a>,
skip: usize,
format: &TieredStorageFormat,
) -> TieredStorageResult<StoredAccountsInfo>
pub fn write_accounts<'a>( &self, accounts: &impl StorableAccounts<'a>, skip: usize, format: &TieredStorageFormat, ) -> TieredStorageResult<StoredAccountsInfo>
Writes the specified accounts into this TieredStorage.
Note that this function can only be called once per a TieredStorage instance. Otherwise, it will trigger panic.
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.
pub fn capacity(&self) -> u64
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