Refactor service encoding to streamline properties handling

- Removed the encoding of attributes and tags from the `encodeService` function, consolidating their inclusion into the properties map as `Variant::Attributes(...)` and `Variant::Tags(...)`.
- Updated the `ServiceChunk` struct to reflect these changes, ensuring a more efficient serialization process during syncback operations.
- Adjusted related tests to align with the new structure, enhancing overall data management and consistency in service encoding.

These modifications improve the clarity and performance of the service encoding process.
This commit is contained in:
Joe 2026-02-18 08:00:49 -06:00
parent 8070129bca
commit e0fd9077e8
5 changed files with 15 additions and 125 deletions

View file

@ -28,7 +28,11 @@ pub(crate) const SERVER_VERSION: &str = env!("CARGO_PKG_VERSION");
pub const PROTOCOL_VERSION: u64 = 6;
/// A single service's children serialized as rbxm binary data, plus the
/// service's own properties, attributes, tags, and Ref property hints.
/// service's own properties and Ref property hints.
///
/// Attributes and Tags are included in the `properties` map as
/// `Variant::Attributes(...)` and `Variant::Tags(...)` respectively,
/// matching the encoding used by the existing `/api/write` path.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ServiceChunk {
@ -38,10 +42,6 @@ pub struct ServiceChunk {
#[serde(default)]
pub properties: HashMap<String, Variant>,
#[serde(default)]
pub attributes: HashMap<String, Variant>,
#[serde(default)]
pub tags: Vec<String>,
#[serde(default)]
pub refs: HashMap<String, ServiceRef>,
}