pub struct FileBlockStorage { /* private fields */ }
Expand description
File-based implementation of block storage
Stores blocks and processing state in JSON files within a configured directory structure.
Implementations§
Trait Implementations§
Source§impl BlockStorage for FileBlockStorage
impl BlockStorage for FileBlockStorage
Source§fn get_last_processed_block<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_last_processed_block<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves the last processed block from a network-specific file
The file is named “{network_id}_last_block.txt”
Source§fn save_last_processed_block<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
block: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_last_processed_block<'life0, 'life1, 'async_trait>(
&'life0 self,
network_id: &'life1 str,
block: u64,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Saves the last processed block to a network-specific file
§Note
Overwrites any existing last block file for the network
Source§fn save_blocks<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
network_slug: &'life1 str,
blocks: &'life2 [BlockType],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_blocks<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
network_slug: &'life1 str,
blocks: &'life2 [BlockType],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Saves blocks to a timestamped JSON file
§Note
Creates a new file for each save operation, named: “{network_id}blocks{timestamp}.json”
Source§fn delete_blocks<'life0, 'life1, 'async_trait>(
&'life0 self,
network_slug: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_blocks<'life0, 'life1, 'async_trait>(
&'life0 self,
network_slug: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes all block files for a network
§Note
Uses glob pattern matching to find and delete all files matching: “{network_id}blocks*.json”
Source§impl Clone for FileBlockStorage
impl Clone for FileBlockStorage
Source§fn clone(&self) -> FileBlockStorage
fn clone(&self) -> FileBlockStorage
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for FileBlockStorage
impl RefUnwindSafe for FileBlockStorage
impl Send for FileBlockStorage
impl Sync for FileBlockStorage
impl Unpin for FileBlockStorage
impl UnwindSafe for FileBlockStorage
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
§impl<T> Chain<T> for T
impl<T> Chain<T> for 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> 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