add some docs
This commit is contained in:
parent
4321530f7d
commit
667dc33249
3 changed files with 25 additions and 1 deletions
|
@ -38,35 +38,48 @@ pub async fn get_health(
|
||||||
|
|
||||||
#[derive(Enum, Copy, Clone, Eq, PartialEq)]
|
#[derive(Enum, Copy, Clone, Eq, PartialEq)]
|
||||||
enum UpDown {
|
enum UpDown {
|
||||||
|
/// The service is up and running
|
||||||
Up,
|
Up,
|
||||||
|
|
||||||
|
/// The service is down
|
||||||
Down,
|
Down,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Enum, Copy, Clone, Eq, PartialEq)]
|
#[derive(Enum, Copy, Clone, Eq, PartialEq)]
|
||||||
enum WebsocketState {
|
enum WebsocketState {
|
||||||
|
/// The Nanite Systems manifold is sending events, and the primary listener is processing data.
|
||||||
Primary,
|
Primary,
|
||||||
|
|
||||||
|
/// The Daybreak Games manifold is sending events, and the backup listener is processing data; the primary listener is down.
|
||||||
Backup,
|
Backup,
|
||||||
|
|
||||||
|
/// The entire event streaming system is down.
|
||||||
Down,
|
Down,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Health {}
|
pub struct Health {}
|
||||||
|
|
||||||
|
/// Reports on the health of Saerro Listening Post
|
||||||
#[Object]
|
#[Object]
|
||||||
impl Health {
|
impl Health {
|
||||||
|
/// Did a ping to Redis (our main datastore) succeed?
|
||||||
async fn redis(&self) -> UpDown {
|
async fn redis(&self) -> UpDown {
|
||||||
UpDown::Up
|
UpDown::Up
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// What is the state of the websocket listener cluster for PC?
|
||||||
#[graphql(name = "pc")]
|
#[graphql(name = "pc")]
|
||||||
async fn pc(&self) -> WebsocketState {
|
async fn pc(&self) -> WebsocketState {
|
||||||
WebsocketState::Primary
|
WebsocketState::Primary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// What is the state of the websocket listener cluster for PS4 US?
|
||||||
#[graphql(name = "ps4us")]
|
#[graphql(name = "ps4us")]
|
||||||
async fn ps4us(&self) -> WebsocketState {
|
async fn ps4us(&self) -> WebsocketState {
|
||||||
WebsocketState::Primary
|
WebsocketState::Primary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// What is the state of the websocket listener cluster for PS4 EU?
|
||||||
#[graphql(name = "ps4eu")]
|
#[graphql(name = "ps4eu")]
|
||||||
async fn ps4eu(&self) -> WebsocketState {
|
async fn ps4eu(&self) -> WebsocketState {
|
||||||
WebsocketState::Primary
|
WebsocketState::Primary
|
||||||
|
|
|
@ -6,18 +6,24 @@ pub struct Query;
|
||||||
|
|
||||||
#[Object]
|
#[Object]
|
||||||
impl Query {
|
impl Query {
|
||||||
|
/// Returns a graph for the world with the given ID.
|
||||||
|
/// If the world does not exist, this will not fail.
|
||||||
async fn world(&self, id: String) -> World {
|
async fn world(&self, id: String) -> World {
|
||||||
World { id: id.clone() }
|
World { id: id.clone() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a graph for the world specified by it's human name.
|
||||||
|
/// This is case-insensitive; but will not fail.
|
||||||
async fn world_by_name(&self, name: String) -> World {
|
async fn world_by_name(&self, name: String) -> World {
|
||||||
World::from_name(name)
|
World::from_name(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a graph of all known live play worlds.
|
||||||
async fn all_worlds(&self) -> Vec<World> {
|
async fn all_worlds(&self) -> Vec<World> {
|
||||||
World::all_worlds()
|
World::all_worlds()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Reports on the health of Saerro Listening Post
|
||||||
async fn health(&self) -> Health {
|
async fn health(&self) -> Health {
|
||||||
Health {}
|
Health {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ lazy_static! {
|
||||||
("2000", "Ceres"),
|
("2000", "Ceres"),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct World {
|
pub struct World {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
}
|
}
|
||||||
|
@ -48,6 +47,12 @@ impl World {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// **A PlanetSide 2 world.**
|
||||||
|
///
|
||||||
|
/// This can be fetched at the top level with `world(id: "1")` or `worldByName(name: "Connery")`.
|
||||||
|
/// ...or get all of them with `allWorlds`.
|
||||||
|
///
|
||||||
|
/// If World.id is not valid or known to the API, World.name will return "Unknown".
|
||||||
#[Object]
|
#[Object]
|
||||||
impl World {
|
impl World {
|
||||||
async fn id(&self) -> &str {
|
async fn id(&self) -> &str {
|
||||||
|
|
Loading…
Add table
Reference in a new issue