pub struct BlueprintProfiles {
pub blueprint_name: String,
pub profiled_at: String,
pub jobs: HashMap<u32, JobProfile>,
}Expand description
Complete blueprint profiling output
This structure is written to target/blueprint-profiles.json and read by
the Blueprint Manager to make deployment decisions.
Fields§
§blueprint_name: StringName of the blueprint
profiled_at: StringTimestamp when profiles were generated (ISO 8601)
jobs: HashMap<u32, JobProfile>Job profiles indexed by job ID
Implementations§
Source§impl BlueprintProfiles
impl BlueprintProfiles
Sourcepub fn add_job(&mut self, job_id: u32, profile: JobProfile)
pub fn add_job(&mut self, job_id: u32, profile: JobProfile)
Add a job profile
Sourcepub fn save_to_file(&self, path: impl AsRef<Path>) -> Result<(), ProfilingError>
pub fn save_to_file(&self, path: impl AsRef<Path>) -> Result<(), ProfilingError>
Save profiles to a JSON file
Typically saved to target/blueprint-profiles.json in the blueprint workspace.
Sourcepub fn load_from_file(path: impl AsRef<Path>) -> Result<Self, ProfilingError>
pub fn load_from_file(path: impl AsRef<Path>) -> Result<Self, ProfilingError>
Load profiles from a JSON file
Sourcepub fn to_compressed_bytes(&self) -> Result<Vec<u8>, ProfilingError>
pub fn to_compressed_bytes(&self) -> Result<Vec<u8>, ProfilingError>
Serialize and compress profiles to bytes (for on-chain storage)
Uses gzip compression to minimize on-chain storage costs. Typical sizes: 1 job ~80 bytes, 10 jobs ~577 bytes, 50 jobs ~2.7KB
Sourcepub fn from_compressed_bytes(compressed: &[u8]) -> Result<Self, ProfilingError>
pub fn from_compressed_bytes(compressed: &[u8]) -> Result<Self, ProfilingError>
Deserialize and decompress profiles from bytes (for on-chain retrieval)
Sourcepub fn to_base64_string(&self) -> Result<String, ProfilingError>
pub fn to_base64_string(&self) -> Result<String, ProfilingError>
Encode profiles as base64-encoded compressed data for on-chain storage
This is the format used in ServiceMetadata.profiling_data field.
Format: base64(gzip(JSON))
Sourcepub fn from_base64_string(encoded: &str) -> Result<Self, ProfilingError>
pub fn from_base64_string(encoded: &str) -> Result<Self, ProfilingError>
Decode profiles from base64-encoded compressed data
This is the format used in ServiceMetadata.profiling_data field.
Format: base64(gzip(JSON))
Sourcepub fn to_description_field(&self) -> Result<String, ProfilingError>
pub fn to_description_field(&self) -> Result<String, ProfilingError>
Encode profiles for storage in description field (temporary solution)
Uses a special marker prefix so we can distinguish profiling data
from regular descriptions. This is a temporary approach until the
dedicated profiling_data field is added to the chain.
Format: [PROFILING_DATA_V1]base64(gzip(JSON))
Total size: marker (20 bytes) + base64 data (~260-468 bytes for 1-10 jobs)
Sourcepub fn from_description_field(
description: &str,
) -> Option<Result<Self, ProfilingError>>
pub fn from_description_field( description: &str, ) -> Option<Result<Self, ProfilingError>>
Extract profiles from description field if it contains profiling data
Returns None if the description doesn’t contain profiling data marker. Returns Some(Err) if the description has the marker but decoding fails.
Trait Implementations§
Source§impl Clone for BlueprintProfiles
impl Clone for BlueprintProfiles
Source§fn clone(&self) -> BlueprintProfiles
fn clone(&self) -> BlueprintProfiles
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more