mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 12:01:38 +00:00
Support nested partitions and partitions directly targeting services (#122)
* Do the nested partition thing * Tidy up touched code * Add nested partition test project, not fully functional * Clean up variable names, move path_metadata mutation strictly into snapshot_reconciler * Remove path_metadata, snapshotting is now pure * Factor out snapshot metadata storage to fix a missing case * Pull instance_name out of per_path_metadata, closer to what we need * Refactor to make metadata make more sense, part one * All appears to be well * Cull 'metadata_per_path' in favor of 'instances_per_path' * Remove SnapshotContext * InstanceMetadata -> PublicInstanceMetadata in web module * Build in snapshot testing system for testing... snapshots? * Remove pretty_assertions to see if it fixes a snapshot comparison bug * Reintroduce pretty assertions, it's not the cause of inequality * Fix snapshot tests with custom relative path serializer
This commit is contained in:
parent
38e3c198f2
commit
ecb9b5e28f
37 changed files with 999 additions and 396 deletions
|
|
@ -27,13 +27,13 @@ static HOME_CONTENT: &str = include_str!("../assets/index.html");
|
|||
/// Contains the instance metadata relevant to Rojo clients.
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct InstanceMetadata {
|
||||
pub struct PublicInstanceMetadata {
|
||||
ignore_unknown_instances: bool,
|
||||
}
|
||||
|
||||
impl InstanceMetadata {
|
||||
pub fn from_session_metadata(meta: &MetadataPerInstance) -> InstanceMetadata {
|
||||
InstanceMetadata {
|
||||
impl PublicInstanceMetadata {
|
||||
pub fn from_session_metadata(meta: &MetadataPerInstance) -> PublicInstanceMetadata {
|
||||
PublicInstanceMetadata {
|
||||
ignore_unknown_instances: meta.ignore_unknown_instances,
|
||||
}
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ pub struct InstanceWithMetadata<'a> {
|
|||
pub instance: Cow<'a, RbxInstance>,
|
||||
|
||||
#[serde(rename = "Metadata")]
|
||||
pub metadata: Option<InstanceMetadata>,
|
||||
pub metadata: Option<PublicInstanceMetadata>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
|
|
@ -120,9 +120,6 @@ impl Server {
|
|||
(GET) (/visualize/imfs) => {
|
||||
self.handle_visualize_imfs()
|
||||
},
|
||||
(GET) (/visualize/path_metadata) => {
|
||||
self.handle_visualize_path_metadata()
|
||||
},
|
||||
_ => Response::empty_404()
|
||||
)
|
||||
}
|
||||
|
|
@ -209,7 +206,7 @@ impl Server {
|
|||
for &requested_id in &requested_ids {
|
||||
if let Some(instance) = tree.get_instance(requested_id) {
|
||||
let metadata = rbx_session.get_instance_metadata(requested_id)
|
||||
.map(InstanceMetadata::from_session_metadata);
|
||||
.map(PublicInstanceMetadata::from_session_metadata);
|
||||
|
||||
instances.insert(instance.get_id(), InstanceWithMetadata {
|
||||
instance: Cow::Borrowed(instance),
|
||||
|
|
@ -218,7 +215,7 @@ impl Server {
|
|||
|
||||
for descendant in tree.descendants(requested_id) {
|
||||
let descendant_meta = rbx_session.get_instance_metadata(descendant.get_id())
|
||||
.map(InstanceMetadata::from_session_metadata);
|
||||
.map(PublicInstanceMetadata::from_session_metadata);
|
||||
|
||||
instances.insert(descendant.get_id(), InstanceWithMetadata {
|
||||
instance: Cow::Borrowed(descendant),
|
||||
|
|
@ -254,9 +251,4 @@ impl Server {
|
|||
None => Response::text(dot_source),
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_visualize_path_metadata(&self) -> Response {
|
||||
let rbx_session = self.live_session.rbx_session.lock().unwrap();
|
||||
Response::json(&rbx_session.debug_get_metadata_per_path())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue