From 0d25e1c196ef29da44f74819a07e1ea236a3ed07 Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Wed, 30 May 2018 22:44:06 -0700 Subject: [PATCH] Move partition info into root endpoint --- server/src/web.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/src/web.rs b/server/src/web.rs index f910c43d..60cb42f4 100644 --- a/server/src/web.rs +++ b/server/src/web.rs @@ -25,6 +25,7 @@ struct ServerInfoResponse<'a> { server_version: &'static str, protocol_version: u64, server_id: &'a str, + partitions: &'a HashMap, } #[derive(Debug, Serialize)] @@ -32,7 +33,6 @@ struct ServerInfoResponse<'a> { struct ReadAllResponse<'a> { server_id: &'a str, instances: &'a HashMap, - partitions: &'a HashMap, message_cursor: i32, } @@ -57,10 +57,17 @@ pub fn start(config: WebConfig) { (GET) (/) => { // 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 { server_version, protocol_version: 2, server_id: &server_id, + partitions: &partitions, }) }, @@ -124,16 +131,9 @@ pub fn start(config: WebConfig) { 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 { server_id: &server_id, message_cursor, - partitions: &partitions, instances: &rbx_session.instances, }) },