in crates/libs/core/src/types/client/service.rs [299:354]
fn build_raw(&self) -> StatelessServiceDescriptionRaw {
let ex4 = Box::new(FABRIC_STATELESS_SERVICE_DESCRIPTION_EX4 {
ServiceScalingPolicies: std::ptr::null_mut(), // TODO: support scaling policies
ScalingPolicyCount: 0,
Reserved: std::ptr::null_mut(),
});
let ex3 = Box::new(FABRIC_STATELESS_SERVICE_DESCRIPTION_EX3 {
ServiceDnsName: windows_core::PCWSTR::null(), // TODO: FABRIC_SERVICE_DNS_NAME
ServicePackageActivationMode: self.service_package_activation_mode.clone().into(),
Reserved: ex4.as_ref() as *const _ as *mut c_void,
});
let ex2 = Box::new(FABRIC_STATELESS_SERVICE_DESCRIPTION_EX2 {
IsDefaultMoveCostSpecified: self.default_move_cost.is_some(),
DefaultMoveCost: self
.default_move_cost
.clone()
.unwrap_or(MoveCost::Zero)
.into(),
Reserved: ex3.as_ref() as *const _ as *mut c_void,
});
let ex1 = Box::new(FABRIC_STATELESS_SERVICE_DESCRIPTION_EX1 {
PolicyList: std::ptr::null_mut(), // TODO:
Reserved: ex2.as_ref() as *const _ as *mut c_void,
});
let (init_data, init_data_len) = self
.initialization_data
.as_ref()
.map(|v| (v.as_ptr() as *mut u8, v.len() as u32))
.unwrap_or((std::ptr::null_mut(), 0));
let internal = Box::new(FABRIC_STATELESS_SERVICE_DESCRIPTION {
ApplicationName: FABRIC_URI(self.application_name.as_ptr() as *mut u16),
ServiceName: FABRIC_URI(self.service_name.as_ptr() as *mut u16),
ServiceTypeName: self.service_type_name.as_pcwstr(),
InitializationDataSize: init_data_len,
InitializationData: init_data,
PartitionScheme: self.partition_scheme_description.as_raw().0,
PartitionSchemeDescription: self.partition_scheme_description.as_raw().1,
InstanceCount: self.instance_count,
PlacementConstraints: self.placement_contraints.as_pcwstr(), // TODO:
CorrelationCount: 0,
Correlations: std::ptr::null_mut(), // TODO: FABRIC_SERVICE_CORRELATION_DESCRIPTION
Metrics: std::ptr::null_mut(), // TODO:
MetricCount: 0,
Reserved: ex1.as_ref() as *const _ as *mut c_void,
});
StatelessServiceDescriptionRaw {
internal,
_internal_ex1: ex1,
_internal_ex2: ex2,
_internal_ex3: ex3,
_internal_ex4: ex4,
phantom: PhantomData,
}
}