Update names in subscribe portion of sync protocol

This commit is contained in:
Lucien Greathouse
2019-11-11 17:52:09 -08:00
parent 94e1501329
commit 47614c3102
7 changed files with 23 additions and 32 deletions

View File

@@ -93,20 +93,19 @@ impl<F: VfsFetcher> ApiService<F> {
let api_messages = messages
.into_iter()
.map(|message| {
let removed_instances = message.removed;
let removed = message.removed;
let mut added_instances = HashMap::new();
let mut added = HashMap::new();
for id in message.added {
let instance = tree.get_instance(id).unwrap();
added_instances.insert(id, Instance::from_rojo_instance(instance));
added.insert(id, Instance::from_rojo_instance(instance));
for instance in tree.descendants(id) {
added_instances
.insert(instance.id(), Instance::from_rojo_instance(instance));
added.insert(instance.id(), Instance::from_rojo_instance(instance));
}
}
let updated_instances = message
let updated = message
.updated
.into_iter()
.map(|update| {
@@ -126,9 +125,9 @@ impl<F: VfsFetcher> ApiService<F> {
.collect();
SubscribeMessage {
removed_instances,
added_instances,
updated_instances,
removed,
added,
updated,
}
})
.collect();

View File

@@ -23,9 +23,9 @@ pub const PROTOCOL_VERSION: u64 = 3;
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SubscribeMessage<'a> {
pub removed_instances: Vec<RbxId>,
pub added_instances: HashMap<RbxId, Instance<'a>>,
pub updated_instances: Vec<InstanceUpdate>,
pub removed: Vec<RbxId>,
pub added: HashMap<RbxId, Instance<'a>>,
pub updated: Vec<InstanceUpdate>,
}
#[derive(Debug, Serialize, Deserialize)]