Skip to main content

canic_core/dto/
memory.rs

1use crate::dto::prelude::*;
2
3///
4/// MemoryLedgerResponse
5///
6
7#[derive(CandidType, Clone, Debug, Deserialize)]
8pub struct MemoryLedgerResponse {
9    pub magic: u64,
10    pub format_id: u32,
11    pub schema_version: u32,
12    pub layout_epoch: u32,
13    pub header_len: u32,
14    pub header_checksum: u64,
15    pub current_generation: u64,
16    pub authorities: Vec<MemoryRangeAuthorityEntry>,
17    pub ranges: Vec<MemoryRangeEntry>,
18    pub entries: Vec<MemoryRegistryEntry>,
19}
20
21///
22/// MemoryRangeAuthorityEntry
23///
24
25#[derive(CandidType, Clone, Debug, Deserialize)]
26pub struct MemoryRangeAuthorityEntry {
27    pub owner: String,
28    pub start: u8,
29    pub end: u8,
30    pub purpose: String,
31}
32
33///
34/// MemoryRangeEntry
35///
36
37#[derive(CandidType, Clone, Debug, Deserialize)]
38pub struct MemoryRangeEntry {
39    pub owner: String,
40    pub start: u8,
41    pub end: u8,
42}
43
44///
45/// MemoryRegistryResponse
46///
47
48#[derive(CandidType, Clone, Debug, Deserialize)]
49pub struct MemoryRegistryResponse {
50    pub entries: Vec<MemoryRegistryEntry>,
51}
52
53///
54/// MemoryRegistryEntry
55///
56
57#[derive(CandidType, Clone, Debug, Deserialize)]
58pub struct MemoryRegistryEntry {
59    pub id: u8,
60    pub crate_name: String,
61    pub label: String,
62    pub stable_key: String,
63    pub schema_version: Option<u32>,
64    pub schema_fingerprint: Option<String>,
65}