forked from lavina/lavina
wip
This commit is contained in:
parent
a740dc80fe
commit
baacea4b44
|
@ -20,8 +20,9 @@ pub struct ClusterConfig {
|
|||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
pub struct ClusterMetadata {
|
||||
/// The node id of the current node.
|
||||
pub node_id: u32,
|
||||
/// Owns all rooms and players in the cluster.
|
||||
/// Owns all rooms in the cluster except the ones specified in `rooms`.
|
||||
pub main_owner: u32,
|
||||
pub rooms: HashMap<String, u32>,
|
||||
}
|
||||
|
@ -46,7 +47,13 @@ impl LavinaClient {
|
|||
return Err(anyhow!("Unknown node"));
|
||||
};
|
||||
match self.client.post(format!("http://{}{}", address, path)).json(&req).send().await {
|
||||
Ok(_) => Ok(()),
|
||||
Ok(res) => {
|
||||
if res.status().is_server_error() || res.status().is_client_error() {
|
||||
tracing::error!("Cluster request failed: {:?}", res);
|
||||
return Err(anyhow!("Server error"));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => Err(e.into()),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ use lavina_core::repo::Storage;
|
|||
use lavina_core::room::RoomId;
|
||||
use lavina_core::LavinaCore;
|
||||
|
||||
// TODO move this into core
|
||||
|
||||
pub async fn route(
|
||||
core: &LavinaCore,
|
||||
storage: &Storage,
|
||||
|
|
Loading…
Reference in New Issue