2024-01-03 10:24:52 +00:00
|
|
|
use async_trait::async_trait;
|
2024-06-29 09:08:02 +00:00
|
|
|
use storage::log_store::MineLoadChunk;
|
|
|
|
use storage_async::Store;
|
2024-01-03 10:24:52 +00:00
|
|
|
|
|
|
|
#[async_trait]
|
|
|
|
pub trait PoraLoader: Send + Sync {
|
|
|
|
async fn load_sealed_data(&self, index: u64) -> Option<MineLoadChunk>;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[async_trait]
|
2024-06-29 09:08:02 +00:00
|
|
|
impl PoraLoader for Store {
|
2024-01-03 10:24:52 +00:00
|
|
|
async fn load_sealed_data(&self, chunk_index: u64) -> Option<MineLoadChunk> {
|
2024-06-29 09:08:02 +00:00
|
|
|
match self.load_sealed_data(chunk_index).await {
|
2024-01-03 10:24:52 +00:00
|
|
|
Ok(Some(chunk)) => Some(chunk),
|
|
|
|
_ => None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|