mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-24 06:34:09 +00:00
Move partition info into root endpoint
This commit is contained in:
parent
8df0565e0e
commit
0d25e1c196
1 changed files with 8 additions and 8 deletions
|
|
@ -25,6 +25,7 @@ struct ServerInfoResponse<'a> {
|
||||||
server_version: &'static str,
|
server_version: &'static str,
|
||||||
protocol_version: u64,
|
protocol_version: u64,
|
||||||
server_id: &'a str,
|
server_id: &'a str,
|
||||||
|
partitions: &'a HashMap<String, &'a [String]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
|
|
@ -32,7 +33,6 @@ struct ServerInfoResponse<'a> {
|
||||||
struct ReadAllResponse<'a> {
|
struct ReadAllResponse<'a> {
|
||||||
server_id: &'a str,
|
server_id: &'a str,
|
||||||
instances: &'a HashMap<Id, RbxInstance>,
|
instances: &'a HashMap<Id, RbxInstance>,
|
||||||
partitions: &'a HashMap<String, &'a [String]>,
|
|
||||||
message_cursor: i32,
|
message_cursor: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,10 +57,17 @@ pub fn start(config: WebConfig) {
|
||||||
(GET) (/) => {
|
(GET) (/) => {
|
||||||
// Get a summary of information about the server.
|
// Get a summary of information about the server.
|
||||||
|
|
||||||
|
let mut partitions = HashMap::new();
|
||||||
|
|
||||||
|
for partition in config.partitions.values() {
|
||||||
|
partitions.insert(partition.name.clone(), partition.target.as_slice());
|
||||||
|
}
|
||||||
|
|
||||||
json_response(ServerInfoResponse {
|
json_response(ServerInfoResponse {
|
||||||
server_version,
|
server_version,
|
||||||
protocol_version: 2,
|
protocol_version: 2,
|
||||||
server_id: &server_id,
|
server_id: &server_id,
|
||||||
|
partitions: &partitions,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -124,16 +131,9 @@ pub fn start(config: WebConfig) {
|
||||||
messages.len() as i32 - 1
|
messages.len() as i32 - 1
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut partitions = HashMap::new();
|
|
||||||
|
|
||||||
for partition in config.partitions.values() {
|
|
||||||
partitions.insert(partition.name.clone(), partition.target.as_slice());
|
|
||||||
}
|
|
||||||
|
|
||||||
json_response(ReadAllResponse {
|
json_response(ReadAllResponse {
|
||||||
server_id: &server_id,
|
server_id: &server_id,
|
||||||
message_cursor,
|
message_cursor,
|
||||||
partitions: &partitions,
|
|
||||||
instances: &rbx_session.instances,
|
instances: &rbx_session.instances,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue