1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use crate::{
common::fuel_storage::{
StorageAsMut,
StorageMutate,
},
db::{
KvStoreError,
Messages,
},
model::{
BlockHeight,
CheckedMessage,
DaBlockHeight,
SealedFuelBlock,
},
};
use async_trait::async_trait;
use std::sync::Arc;
#[async_trait]
pub trait RelayerDb: StorageMutate<Messages, Error = KvStoreError> + Send + Sync {
async fn insert_message(&mut self, message: &CheckedMessage) {
let _ = self
.storage::<Messages>()
.insert(message.id(), message.as_ref());
}
async fn get_chain_height(&self) -> BlockHeight;
async fn get_sealed_block(&self, height: BlockHeight)
-> Option<Arc<SealedFuelBlock>>;
async fn set_finalized_da_height(&self, block: DaBlockHeight);
async fn get_finalized_da_height(&self) -> Option<DaBlockHeight>;
async fn get_last_published_fuel_height(&self) -> Option<BlockHeight>;
async fn set_last_published_fuel_height(&self, block_height: BlockHeight);
}