file_storage_integrity/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use hdi::prelude::*;

#[hdk_entry_helper]
pub struct FileChunk(SerializedBytes);

#[hdk_entry_helper]
pub struct FileMetadata {
    pub name: String,
    pub last_modified: Timestamp,
    pub size: usize, // Size in bytes
    pub file_type: String,
    pub chunks_hashes: Vec<EntryHash>,
}

#[cfg(feature = "externs")]
#[hdk_entry_types]
#[unit_enum(UnitEntryTypes)]
pub enum EntryTypes {
    FileMetadata(FileMetadata),
    FileChunk(FileChunk),
}