use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use crate::core::v_latest::model::merkle_tree::node::dir_node::DirNodeData;
use crate::core::v_latest::model::merkle_tree::node::vnode::VNodeData;
use crate::model::{MerkleHash, MerkleTreeNodeType};
#[derive(Deserialize, Serialize, Clone, PartialEq, Eq)]
pub struct VNodeDataPre025 {
pub hash: MerkleHash,
pub node_type: MerkleTreeNodeType,
}
impl From<VNodeDataPre025> for VNodeData {
fn from(legacy: VNodeDataPre025) -> Self {
VNodeData {
hash: legacy.hash,
node_type: legacy.node_type,
num_entries: 0,
}
}
}
#[derive(Deserialize, Serialize, Clone, PartialEq, Eq)]
pub struct DirNodeDataPre025 {
pub node_type: MerkleTreeNodeType,
pub name: String,
pub hash: MerkleHash,
pub num_bytes: u64,
pub last_commit_id: MerkleHash,
pub last_modified_seconds: i64,
pub last_modified_nanoseconds: u32,
pub data_type_counts: HashMap<String, u64>,
pub data_type_sizes: HashMap<String, u64>,
}
impl From<DirNodeDataPre025> for DirNodeData {
fn from(legacy: DirNodeDataPre025) -> Self {
DirNodeData {
node_type: legacy.node_type,
name: legacy.name,
hash: legacy.hash,
num_entries: 0,
num_bytes: legacy.num_bytes,
last_commit_id: legacy.last_commit_id,
last_modified_seconds: legacy.last_modified_seconds,
last_modified_nanoseconds: legacy.last_modified_nanoseconds,
data_type_counts: legacy.data_type_counts,
data_type_sizes: legacy.data_type_sizes,
}
}
}