Skip to main content

terminus_store/layer/internal/
rollup.rs

1use super::*;
2use std::sync::Arc;
3
4#[derive(Clone)]
5pub struct RollupLayer {
6    pub(super) internal: Arc<InternalLayer>,
7    pub(super) original: [u32; 5],
8    pub(super) original_parent: Option<[u32; 5]>, // TODO something with a light delta structure for answering delta queries?
9}
10
11impl RollupLayer {
12    pub fn from_base_layer(
13        layer: Arc<InternalLayer>,
14        original: [u32; 5],
15        original_parent: Option<[u32; 5]>,
16    ) -> Self {
17        Self {
18            internal: layer,
19            original,
20            original_parent,
21        }
22    }
23
24    pub fn from_child_layer(
25        layer: Arc<InternalLayer>,
26        original: [u32; 5],
27        original_parent: [u32; 5],
28    ) -> Self {
29        Self {
30            internal: layer,
31            original,
32            original_parent: Some(original_parent),
33        }
34    }
35}