Introduce %ttl% (#253)

This commit is contained in:
Mike Voronov
2022-04-21 11:44:18 +03:00
committed by GitHub
parent 490791b177
commit 7e0c87d72a
30 changed files with 1155 additions and 845 deletions

View File

@ -33,14 +33,18 @@ pub struct RunParameters {
/// Unix timestamp from a particle in milliseconds.
/// It represents time when this particle was sent from the init peer id.
pub timestamp: u64,
/// TTL set by init peer id in milliseconds.
pub ttl: u32,
}
impl RunParameters {
pub fn new(init_peer_id: String, current_peer_id: String, timestamp: u64) -> Self {
pub fn new(init_peer_id: String, current_peer_id: String, timestamp: u64, ttl: u32) -> Self {
Self {
init_peer_id,
current_peer_id,
timestamp,
ttl,
}
}
@ -49,6 +53,7 @@ impl RunParameters {
IValue::String(self.init_peer_id),
IValue::String(self.current_peer_id),
IValue::U64(self.timestamp),
IValue::U32(self.ttl),
];
// unwrap is safe here because run_parameters is non-empty array
let run_parameters = NEVec::new(run_parameters).unwrap();