miden_node_store/state/
replica.rs1use std::sync::Arc;
2
3use miden_node_utils::block_cache::BlockOrderedCache;
4use miden_protocol::block::BlockNumber;
5
6#[derive(Clone, Debug)]
11pub struct BlockNotification(Arc<Block>);
12
13impl BlockNotification {
14 pub fn new(block_num: BlockNumber, block_bytes: Vec<u8>) -> Self {
15 Self(Arc::new(Block { block_num, block_bytes }))
16 }
17
18 pub fn block_num(&self) -> BlockNumber {
19 self.0.block_num
20 }
21
22 pub fn block_bytes(&self) -> &[u8] {
23 &self.0.block_bytes
24 }
25}
26
27#[derive(Clone, Debug)]
28struct Block {
29 pub block_num: BlockNumber,
30 pub block_bytes: Vec<u8>,
31}
32
33#[derive(Clone, Debug)]
38pub struct ProofNotification(Arc<Proof>);
39
40impl ProofNotification {
41 pub fn new(block_num: BlockNumber, proof_bytes: Vec<u8>) -> Self {
42 Self(Arc::new(Proof { block_num, proof_bytes }))
43 }
44
45 pub fn block_num(&self) -> BlockNumber {
46 self.0.block_num
47 }
48
49 pub fn proof_bytes(&self) -> &[u8] {
50 &self.0.proof_bytes
51 }
52}
53
54#[derive(Clone, Debug)]
55struct Proof {
56 block_num: BlockNumber,
57 proof_bytes: Vec<u8>,
58}
59
60pub type BlockCache = BlockOrderedCache<BlockNotification>;
65
66pub type ProofCache = BlockOrderedCache<ProofNotification>;