Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        internal static unsafe ApplicationHealthState FromNative(NativeTypes.FABRIC_APPLICATION_HEALTH_STATE nativeState)
        {
            var applicationHealthState = new ApplicationHealthState();

            applicationHealthState.ApplicationName       = NativeTypes.FromNativeUri(nativeState.ApplicationName);
            applicationHealthState.AggregatedHealthState = (HealthState)nativeState.AggregatedHealthState;

            return(applicationHealthState);
        }