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 header_len: u32,
13    pub header_checksum: u64,
14    pub current_generation: u64,
15    pub authorities: Vec<MemoryRangeAuthorityEntry>,
16    pub ranges: Vec<MemoryRangeEntry>,
17    pub entries: Vec<MemoryRegistryEntry>,
18}
19
20///
21/// MemoryRangeAuthorityEntry
22///
23
24#[derive(CandidType, Clone, Debug, Deserialize)]
25pub struct MemoryRangeAuthorityEntry {
26    pub owner: String,
27    pub start: u8,
28    pub end: u8,
29    pub purpose: String,
30}
31
32///
33/// MemoryRangeEntry
34///
35
36#[derive(CandidType, Clone, Debug, Deserialize)]
37pub struct MemoryRangeEntry {
38    pub owner: String,
39    pub start: u8,
40    pub end: u8,
41}
42
43///
44/// MemoryRegistryResponse
45///
46
47#[derive(CandidType, Clone, Debug, Deserialize)]
48pub struct MemoryRegistryResponse {
49    pub entries: Vec<MemoryRegistryEntry>,
50}
51
52///
53/// MemoryRegistryEntry
54///
55
56#[derive(CandidType, Clone, Debug, Deserialize)]
57pub struct MemoryRegistryEntry {
58    pub id: u8,
59    pub crate_name: String,
60    pub label: String,
61    pub stable_key: String,
62    pub schema_version: Option<u32>,
63    pub schema_fingerprint: Option<String>,
64}