示例#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);
        }
示例#2
0
        private static unsafe DeployedServicePackageHealth FromNative(NativeTypes.FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH *nativeHealth)
        {
            var managedHealth = new DeployedServicePackageHealth();

            managedHealth.AggregatedHealthState = (HealthState)nativeHealth->AggregatedHealthState;
            managedHealth.HealthEvents          = HealthEvent.FromNativeList(nativeHealth->HealthEvents);
            managedHealth.ApplicationName       = NativeTypes.FromNativeUri(nativeHealth->ApplicationName);
            managedHealth.ServiceManifestName   = NativeTypes.FromNativeString(nativeHealth->ServiceManifestName);
            managedHealth.NodeName = NativeTypes.FromNativeString(nativeHealth->NodeName);

            if (nativeHealth->Reserved == IntPtr.Zero)
            {
                return(managedHealth);
            }

            var nativeHealthEx1 = (NativeTypes.FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_EX1 *)nativeHealth->Reserved;

            managedHealth.UnhealthyEvaluations = HealthEvaluation.FromNativeList(nativeHealthEx1->UnhealthyEvaluations);

            if (nativeHealthEx1->Reserved == IntPtr.Zero)
            {
                return(managedHealth);
            }

            var nativeHealthEx2 = (NativeTypes.FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_EX2 *)nativeHealthEx1->Reserved;

            managedHealth.ServicePackageActivationId = NativeTypes.FromNativeString(nativeHealthEx2->ServicePackageActivationId);

            return(managedHealth);
        }
示例#3
0
        private static unsafe NodeHealth FromNative(NativeTypes.FABRIC_NODE_HEALTH *nativeHealth)
        {
            var managedHealth = new NodeHealth();

            managedHealth.AggregatedHealthState = (HealthState)nativeHealth->AggregatedHealthState;
            managedHealth.HealthEvents          = HealthEvent.FromNativeList(nativeHealth->HealthEvents);
            managedHealth.NodeName = NativeTypes.FromNativeString(nativeHealth->NodeName);

            if (nativeHealth->Reserved != IntPtr.Zero)
            {
                var nativeHealthEx1 = (NativeTypes.FABRIC_NODE_HEALTH_EX1 *)nativeHealth->Reserved;
                managedHealth.UnhealthyEvaluations = HealthEvaluation.FromNativeList(nativeHealthEx1->UnhealthyEvaluations);
            }

            return(managedHealth);
        }
示例#4
0
        internal static unsafe StatelessServiceInstanceHealth FromNative(NativeTypes.FABRIC_STATELESS_SERVICE_INSTANCE_HEALTH *nativeHealth)
        {
            var managedHealth = new StatelessServiceInstanceHealth();

            managedHealth.AggregatedHealthState = (HealthState)nativeHealth->AggregatedHealthState;
            managedHealth.HealthEvents          = HealthEvent.FromNativeList(nativeHealth->HealthEvents);
            managedHealth.PartitionId           = nativeHealth->PartitionId;
            managedHealth.Id = nativeHealth->InstanceId;

            if (nativeHealth->Reserved != IntPtr.Zero)
            {
                var nativeHealthEx1 = (NativeTypes.FABRIC_STATELESS_SERVICE_INSTANCE_HEALTH_EX1 *)nativeHealth->Reserved;
                managedHealth.UnhealthyEvaluations = HealthEvaluation.FromNativeList(nativeHealthEx1->UnhealthyEvaluations);
            }

            return(managedHealth);
        }
示例#5
0
        private static unsafe PartitionHealth FromNative(NativeTypes.FABRIC_PARTITION_HEALTH *nativeHealth)
        {
            var managedHealth = new PartitionHealth();

            managedHealth.AggregatedHealthState = (HealthState)nativeHealth->AggregatedHealthState;
            managedHealth.HealthEvents          = HealthEvent.FromNativeList(nativeHealth->HealthEvents);
            managedHealth.PartitionId           = nativeHealth->PartitionId;
            managedHealth.ReplicaHealthStates   = ReplicaHealthState.FromNativeList(nativeHealth->ReplicaHealthStates);

            if (nativeHealth->Reserved != IntPtr.Zero)
            {
                var nativeHealthEx1 = (NativeTypes.FABRIC_PARTITION_HEALTH_EX1 *)nativeHealth->Reserved;
                managedHealth.UnhealthyEvaluations = HealthEvaluation.FromNativeList(nativeHealthEx1->UnhealthyEvaluations);

                if (nativeHealthEx1->Reserved != IntPtr.Zero)
                {
                    var nativeHealthEx2 = (NativeTypes.FABRIC_PARTITION_HEALTH_EX2 *)nativeHealthEx1->Reserved;
                    managedHealth.HealthStatistics = HealthStatistics.CreateFromNative(nativeHealthEx2->HealthStatistics);
                }
            }

            return(managedHealth);
        }
示例#6
0
        private static unsafe ServiceHealth FromNative(NativeTypes.FABRIC_SERVICE_HEALTH *nativeHealth)
        {
            var managedHealth = new ServiceHealth();

            managedHealth.AggregatedHealthState = (HealthState)nativeHealth->AggregatedHealthState;
            managedHealth.HealthEvents          = HealthEvent.FromNativeList(nativeHealth->HealthEvents);
            managedHealth.ServiceName           = NativeTypes.FromNativeUri(nativeHealth->ServiceName);
            managedHealth.PartitionHealthStates = PartitionHealthState.FromNativeList(nativeHealth->PartitionHealthStates);

            if (nativeHealth->Reserved != IntPtr.Zero)
            {
                var nativeHealthEx1 = (NativeTypes.FABRIC_SERVICE_HEALTH_EX1 *)nativeHealth->Reserved;
                managedHealth.UnhealthyEvaluations = HealthEvaluation.FromNativeList(nativeHealthEx1->UnhealthyEvaluations);

                if (nativeHealthEx1->Reserved != IntPtr.Zero)
                {
                    var nativeHealthEx2 = (NativeTypes.FABRIC_SERVICE_HEALTH_EX2 *)nativeHealthEx1->Reserved;
                    managedHealth.HealthStatistics = HealthStatistics.CreateFromNative(nativeHealthEx2->HealthStatistics);
                }
            }

            return(managedHealth);
        }
        private static unsafe DeployedApplicationHealth FromNative(NativeTypes.FABRIC_DEPLOYED_APPLICATION_HEALTH *nativeHealth)
        {
            var managedHealth = new DeployedApplicationHealth();

            managedHealth.AggregatedHealthState = (HealthState)nativeHealth->AggregatedHealthState;
            managedHealth.HealthEvents          = HealthEvent.FromNativeList(nativeHealth->HealthEvents);
            managedHealth.ApplicationName       = NativeTypes.FromNativeUri(nativeHealth->ApplicationName);
            managedHealth.NodeName = NativeTypes.FromNativeString(nativeHealth->NodeName);
            managedHealth.DeployedServicePackageHealthStates = DeployedServicePackageHealthState.FromNativeList(nativeHealth->DeployedServicePackageHealthStates);

            if (nativeHealth->Reserved != IntPtr.Zero)
            {
                var nativeHealthEx1 = (NativeTypes.FABRIC_DEPLOYED_APPLICATION_HEALTH_EX1 *)nativeHealth->Reserved;
                managedHealth.UnhealthyEvaluations = HealthEvaluation.FromNativeList(nativeHealthEx1->UnhealthyEvaluations);

                if (nativeHealthEx1->Reserved != IntPtr.Zero)
                {
                    var nativeHealthEx2 = (NativeTypes.FABRIC_DEPLOYED_APPLICATION_HEALTH_EX2 *)nativeHealthEx1->Reserved;
                    managedHealth.HealthStatistics = HealthStatistics.CreateFromNative(nativeHealthEx2->HealthStatistics);
                }
            }

            return(managedHealth);
        }