forked from rojo-rbx/rojo
Document snapshot pipeline
This commit is contained in:
@@ -1,8 +1,32 @@
|
||||
//! This module defines the instance snapshot subsystem of Rojo.
|
||||
//!
|
||||
//! It defines a way to define the instance tree of a project as a pure function
|
||||
//! of the filesystem by providing a lightweight instance 'snapshot' type, a
|
||||
//! method to generate minimal patches, and a method that applies those patches.
|
||||
//! Snapshots define a way to define the instance tree of a project as a pure
|
||||
//! function of the filesystem by providing a lightweight instance 'snapshot'
|
||||
//! type, a method to generate minimal patches, and a method that applies those
|
||||
//! patches.
|
||||
//!
|
||||
//! Changes in Rojo go through a pipeline of transformations once they hit the
|
||||
//! snapshot subsystem.
|
||||
//!
|
||||
//! 1. Instance snapshots are generated by Rojo's snapshot middleware,
|
||||
//! representing a set of instances and their metadata. These will
|
||||
//! usually contain data that hasn't actually changed, and how coarsely
|
||||
//! the snapshots happen is defined outside this part of the code.
|
||||
//!
|
||||
//! 2. Input snapshots are turned into `PatchSet` objects by Rojo's diffing
|
||||
//! algorithm via `compute_patch_set`. This operation doesn't mutate the
|
||||
//! instance tree, so work at this point can be thrown away.
|
||||
//!
|
||||
//! `PatchSet` prescribe what changes need to be applied to the current
|
||||
//! tree to get the next tree. It isn't useful for describing those
|
||||
//! changes after the fact, since Rojo needs to assign IDs to created
|
||||
//! instances, which happens during patch application, not generation!
|
||||
//!
|
||||
//! 3. Patch sets are applied to the tree with `apply_patch_set`, which
|
||||
//! mutates the relevant instances. `apply_patch_set` returns a new
|
||||
//! object, `AppliedPatchSet`. Applied patch sets describe the transform
|
||||
//! that was applied, and are suitable for cases where another tree needs
|
||||
//! to be synchronized with Rojo's, like the Rojo Studio plugin.
|
||||
//!
|
||||
//! The aim with this approach is to reduce the number of bugs that arise from
|
||||
//! attempting to manually update instances in response to filesystem updates.
|
||||
@@ -26,7 +50,7 @@ mod patch_compute;
|
||||
mod tree;
|
||||
|
||||
pub use instance_snapshot::InstanceSnapshot;
|
||||
pub use metadata::*;
|
||||
pub use metadata::InstanceMetadata;
|
||||
pub use patch::*;
|
||||
pub use patch_apply::apply_patch_set;
|
||||
pub use patch_compute::compute_patch_set;
|
||||
|
||||
Reference in New Issue
Block a user