fuel_core/database/database_description/
off_chain.rs

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
use crate::{
    database::database_description::DatabaseDescription,
    fuel_core_graphql_api,
};
use fuel_core_types::fuel_types::BlockHeight;

#[derive(Copy, Clone, Debug)]
pub struct OffChain;

impl DatabaseDescription for OffChain {
    type Column = fuel_core_graphql_api::storage::Column;
    type Height = BlockHeight;

    fn version() -> u32 {
        0
    }

    fn name() -> String {
        "off_chain".to_string()
    }

    fn metadata_column() -> Self::Column {
        Self::Column::Metadata
    }

    fn prefix(column: &Self::Column) -> Option<usize> {
        match column {
            Self::Column::OwnedCoins
            | Self::Column::TransactionsByOwnerBlockIdx
            | Self::Column::OwnedMessageIds => {
                // prefix is address length
                Some(32)
            }
            _ => None,
        }
    }
}