Skip to main content

BlueprintProfiles

Struct BlueprintProfiles 

Source
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: String

Name of the blueprint

§profiled_at: String

Timestamp when profiles were generated (ISO 8601)

§jobs: HashMap<u32, JobProfile>

Job profiles indexed by job ID

Implementations§

Source§

impl BlueprintProfiles

Source

pub fn new(blueprint_name: impl Into<String>) -> Self

Create a new blueprint profiles output

Source

pub fn add_job(&mut self, job_id: u32, profile: JobProfile)

Add a job profile

Source

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.

Source

pub fn load_from_file(path: impl AsRef<Path>) -> Result<Self, ProfilingError>

Load profiles from a JSON file

Source

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

Source

pub fn from_compressed_bytes(compressed: &[u8]) -> Result<Self, ProfilingError>

Deserialize and decompress profiles from bytes (for on-chain retrieval)

Source

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))

Source

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))

Source

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)

Source

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

Source§

fn clone(&self) -> BlueprintProfiles

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BlueprintProfiles

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for BlueprintProfiles

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for BlueprintProfiles

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,