Validator API storage fixes and adjustments

This commit is contained in:
Jędrzej Stuczyński
2021-07-22 15:15:08 +01:00
parent 432e1e6065
commit c81454e00b
14 changed files with 1273 additions and 1206 deletions
+2 -14
View File
@@ -3,24 +3,12 @@
use crate::node_status_api::models::Uptime;
use crate::node_status_api::{FIFTEEN_MINUTES, ONE_HOUR};
use crate::storage::models::NodeStatus;
use sqlx::types::time::OffsetDateTime;
// Internally used struct to catch results from the database to calculate uptimes for given mixnode/gateway
pub(crate) struct NodeStatus {
pub(crate) timestamp: i64,
pub(crate) up: bool,
}
// Internally used struct to catch results from the database to find active mixnodes/gateways
pub(crate) struct ActiveNode {
pub(crate) id: i64,
pub(crate) pub_key: String,
pub(crate) owner: String,
}
// A temporary helper struct used to produce reports for active nodes.
pub(crate) struct ActiveNodeDayStatuses {
pub(crate) pub_key: String,
pub(crate) identity: String,
pub(crate) owner: String,
pub(crate) node_id: i64,