Restore typed data to serialized PODs (#318)
This commit is contained in:
parent
3306f360f7
commit
6aa4acac4a
1 changed files with 9 additions and 1 deletions
|
|
@ -1,10 +1,14 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::Error;
|
use super::Error;
|
||||||
use crate::{
|
use crate::{
|
||||||
frontend::{MainPod, SignedPod},
|
frontend::{MainPod, SignedPod},
|
||||||
middleware::{deserialize_pod, deserialize_signed_pod, Params, PodId, VDSet},
|
middleware::{
|
||||||
|
deserialize_pod, deserialize_signed_pod, Key, Params, PodId, Statement, VDSet, Value,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, JsonSchema)]
|
#[derive(Serialize, Deserialize, JsonSchema)]
|
||||||
|
|
@ -19,6 +23,7 @@ pub enum SignedPodType {
|
||||||
pub struct SerializedSignedPod {
|
pub struct SerializedSignedPod {
|
||||||
pod_type: (usize, String),
|
pod_type: (usize, String),
|
||||||
id: PodId,
|
id: PodId,
|
||||||
|
entries: HashMap<Key, Value>,
|
||||||
data: serde_json::Value,
|
data: serde_json::Value,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -30,6 +35,7 @@ pub struct SerializedMainPod {
|
||||||
pod_type: (usize, String),
|
pod_type: (usize, String),
|
||||||
id: PodId,
|
id: PodId,
|
||||||
vd_set: VDSet,
|
vd_set: VDSet,
|
||||||
|
public_statements: Vec<Statement>,
|
||||||
data: serde_json::Value,
|
data: serde_json::Value,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -40,6 +46,7 @@ impl From<SignedPod> for SerializedSignedPod {
|
||||||
SerializedSignedPod {
|
SerializedSignedPod {
|
||||||
pod_type: (pod_type, pod_type_name_str.to_string()),
|
pod_type: (pod_type, pod_type_name_str.to_string()),
|
||||||
id: pod.id(),
|
id: pod.id(),
|
||||||
|
entries: pod.kvs().clone(),
|
||||||
data,
|
data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -64,6 +71,7 @@ impl From<MainPod> for SerializedMainPod {
|
||||||
id: pod.id(),
|
id: pod.id(),
|
||||||
vd_set: pod.pod.vd_set().clone(),
|
vd_set: pod.pod.vd_set().clone(),
|
||||||
params: pod.params.clone(),
|
params: pod.params.clone(),
|
||||||
|
public_statements: pod.pod.pub_statements(),
|
||||||
data,
|
data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue