mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Send partition information in read_all endpoint
This commit is contained in:
parent
bf6766919e
commit
8df0565e0e
2 changed files with 12 additions and 1 deletions
|
|
@ -38,7 +38,7 @@ pub fn serve(project_path: &PathBuf, port: Option<u64>) {
|
|||
}
|
||||
|
||||
let config = SessionConfig {
|
||||
partitions
|
||||
partitions: partitions.clone(),
|
||||
};
|
||||
|
||||
println!("Using session config {:#?}", config);
|
||||
|
|
@ -51,6 +51,7 @@ pub fn serve(project_path: &PathBuf, port: Option<u64>) {
|
|||
server_id,
|
||||
rbx_session: session.get_rbx_session(),
|
||||
message_session: session.get_message_session(),
|
||||
partitions,
|
||||
};
|
||||
|
||||
println!("Server listening on port {}", web_config.port);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use id::Id;
|
|||
use rbx::RbxInstance;
|
||||
use rbx_session::RbxSession;
|
||||
use message_session::{MessageSession, Message};
|
||||
use partition::Partition;
|
||||
|
||||
/// The set of configuration the web server needs to start.
|
||||
pub struct WebConfig {
|
||||
|
|
@ -15,6 +16,7 @@ pub struct WebConfig {
|
|||
pub server_id: u64,
|
||||
pub rbx_session: Arc<RwLock<RbxSession>>,
|
||||
pub message_session: MessageSession,
|
||||
pub partitions: HashMap<String, Partition>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
|
|
@ -30,6 +32,7 @@ struct ServerInfoResponse<'a> {
|
|||
struct ReadAllResponse<'a> {
|
||||
server_id: &'a str,
|
||||
instances: &'a HashMap<Id, RbxInstance>,
|
||||
partitions: &'a HashMap<String, &'a [String]>,
|
||||
message_cursor: i32,
|
||||
}
|
||||
|
||||
|
|
@ -121,9 +124,16 @@ 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,
|
||||
})
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue