Validator API storage fixes and adjustments
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::storage;
|
||||
use rocket::fairing::AdHoc;
|
||||
use std::path::PathBuf;
|
||||
use std::time::Duration;
|
||||
@@ -8,7 +9,6 @@ use std::time::Duration;
|
||||
pub(crate) mod local_guard;
|
||||
pub(crate) mod models;
|
||||
pub(crate) mod routes;
|
||||
pub(crate) mod storage;
|
||||
pub(crate) mod utils;
|
||||
|
||||
pub(crate) const FIFTEEN_MINUTES: Duration = Duration::from_secs(900);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2021 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use crate::node_status_api::utils::{NodeStatus, NodeUptimes};
|
||||
use crate::node_status_api::utils::NodeUptimes;
|
||||
use rocket::http::{ContentType, Status};
|
||||
use rocket::response::{self, Responder, Response};
|
||||
use rocket::Request;
|
||||
@@ -9,6 +9,7 @@ use serde::{Deserialize, Serialize};
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt::{self, Display, Formatter};
|
||||
use std::io::Cursor;
|
||||
use crate::storage::models::NodeStatus;
|
||||
|
||||
// todo: put into some error enum
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::node_status_api::models::{
|
||||
ErrorResponse, GatewayStatusReport, GatewayUptimeHistory, MixnodeStatusReport,
|
||||
MixnodeUptimeHistory,
|
||||
};
|
||||
use crate::node_status_api::storage::NodeStatusStorage;
|
||||
use crate::storage::NodeStatusStorage;
|
||||
use rocket::http::Status;
|
||||
use rocket::serde::json::Json;
|
||||
use rocket::State;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user