private static unsafe ClusterHealth FromNative(NativeTypes.FABRIC_CLUSTER_HEALTH *nativeClusterHealth) { var clusterHealth = new ClusterHealth(); clusterHealth.AggregatedHealthState = (HealthState)nativeClusterHealth->AggregatedHealthState; if (nativeClusterHealth->Reserved != IntPtr.Zero) { NativeTypes.FABRIC_CLUSTER_HEALTH_EX1 *nativeClusterHealthEx1 = (NativeTypes.FABRIC_CLUSTER_HEALTH_EX1 *)nativeClusterHealth->Reserved; clusterHealth.NodeHealthStates = NodeHealthState.FromNativeList(nativeClusterHealthEx1->NodeHealthStates); clusterHealth.ApplicationHealthStates = ApplicationHealthState.FromNativeList(nativeClusterHealthEx1->ApplicationHealthStates); clusterHealth.HealthEvents = HealthEvent.FromNativeList(nativeClusterHealthEx1->HealthEvents); if (nativeClusterHealthEx1->Reserved != IntPtr.Zero) { var nativeHealthEx2 = (NativeTypes.FABRIC_CLUSTER_HEALTH_EX2 *)nativeClusterHealthEx1->Reserved; clusterHealth.UnhealthyEvaluations = HealthEvaluation.FromNativeList(nativeHealthEx2->UnhealthyEvaluations); if (nativeHealthEx2->Reserved != IntPtr.Zero) { var nativeHealthEx3 = (NativeTypes.FABRIC_CLUSTER_HEALTH_EX3 *)nativeHealthEx2->Reserved; clusterHealth.HealthStatistics = HealthStatistics.CreateFromNative(nativeHealthEx3->HealthStatistics); } } } return(clusterHealth); }
internal ClusterHealth(System.Fabric.Health.ClusterHealth health) : base(health) { this.ApplicationHealthStates = health.ApplicationHealthStates .Select(state => new ApplicationHealthState( state.ApplicationName, state.AggregatedHealthState)); this.NodeHealthStates = health.NodeHealthStates .Select(state => new NodeHealthState( state.NodeName, state.AggregatedHealthState)); }