From ee0babed4a4d4f76c282ad7e850c3a523bc7cedc Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Thu, 2 Jan 2025 21:06:39 +0530 Subject: [PATCH] Implemented health api --- crates/libs/core/src/runtime/stateful_proxy.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/libs/core/src/runtime/stateful_proxy.rs b/crates/libs/core/src/runtime/stateful_proxy.rs index 57dcb02c..7b4b3bb4 100644 --- a/crates/libs/core/src/runtime/stateful_proxy.rs +++ b/crates/libs/core/src/runtime/stateful_proxy.rs @@ -20,8 +20,8 @@ use crate::{ strings::WStringWrap, sync::{fabric_begin_end_proxy2, CancellationToken}, types::{ - FaultType, LoadMetric, LoadMetricListRef, MoveCost, ReplicaRole, - ServicePartitionAccessStatus, ServicePartitionInformation, + HealthInformation, FaultType, LoadMetric, LoadMetricListRef, MoveCost, + ReplicaRole, ServicePartitionAccessStatus, ServicePartitionInformation, }, }; @@ -380,16 +380,16 @@ impl StatefulServicePartition { /// by batching reports per a configured duration (Default: 30 seconds). If the report has high priority, /// you can specify send options to send it immediately. - /// TODO: not yet implemented - /// Reports current partition health. - pub fn report_partition_health(&self) -> crate::Result<()> { - Err(FabricErrorCode::E_NOTIMPL.into()) + /// Reports current partition health. + pub fn report_partition_health(&self, partitionhealthinfo: &HealthInformation) -> crate::Result<()> { + let healthinfo = &partitionhealthinfo.into(); + unsafe { self.com_impl.ReportPartitionHealth(healthinfo) } } - /// TODO: not yet implemented /// Reports health on the current stateful service replica of the partition. - pub fn report_replica_health(&self) -> crate::Result<()> { - Err(FabricErrorCode::E_NOTIMPL.into()) + pub fn report_replica_health(&self, replicahealthinfo: &HealthInformation) -> crate::Result<()> { + let healthinfo = &replicahealthinfo.into(); + unsafe {self.com_impl.ReportReplicaHealth(healthinfo)} } }