Example #1
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);
        }
Example #2
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);
        }
Example #3
0
        internal static unsafe SystemApplicationHealthEvaluation FromNative(IntPtr nativeHealthEvaluationValuePtr)
        {
            ReleaseAssert.AssertIf(nativeHealthEvaluationValuePtr == IntPtr.Zero, string.Format(CultureInfo.CurrentCulture, StringResources.Error_NativeDataNull_Formatted, "nativeHealthEvaluationValue"));
            var nativeHealthEvaluation = *(NativeTypes.FABRIC_SYSTEM_APPLICATION_HEALTH_EVALUATION *)nativeHealthEvaluationValuePtr;

            var managedHealthEvaluation = new SystemApplicationHealthEvaluation();

            managedHealthEvaluation.Description           = NativeTypes.FromNativeString(nativeHealthEvaluation.Description);
            managedHealthEvaluation.AggregatedHealthState = (HealthState)nativeHealthEvaluation.AggregatedHealthState;
            managedHealthEvaluation.UnhealthyEvaluations  = HealthEvaluation.FromNativeList(nativeHealthEvaluation.UnhealthyEvaluations);

            return(managedHealthEvaluation);
        }
        internal static unsafe DeployedServicePackagesHealthEvaluation FromNative(IntPtr nativeHealthEvaluationValuePtr)
        {
            ReleaseAssert.AssertIf(nativeHealthEvaluationValuePtr == IntPtr.Zero, string.Format(CultureInfo.CurrentCulture, StringResources.Error_NativeDataNull_Formatted, "nativeHealthEvaluationValue"));
            var nativeHealthEvaluation = *(NativeTypes.FABRIC_DEPLOYED_SERVICE_PACKAGES_HEALTH_EVALUATION *)nativeHealthEvaluationValuePtr;

            var managedHealthEvaluation = new DeployedServicePackagesHealthEvaluation();

            managedHealthEvaluation.Description           = NativeTypes.FromNativeString(nativeHealthEvaluation.Description);
            managedHealthEvaluation.AggregatedHealthState = (HealthState)nativeHealthEvaluation.AggregatedHealthState;
            managedHealthEvaluation.UnhealthyEvaluations  = HealthEvaluation.FromNativeList(nativeHealthEvaluation.UnhealthyEvaluations);
            managedHealthEvaluation.TotalCount            = (long)nativeHealthEvaluation.TotalCount;

            return(managedHealthEvaluation);
        }
        internal static unsafe NodesHealthEvaluation FromNative(IntPtr nativeHealthEvaluationValuePtr)
        {
            ReleaseAssert.AssertIf(nativeHealthEvaluationValuePtr == IntPtr.Zero, string.Format(CultureInfo.CurrentCulture, StringResources.Error_NativeDataNull_Formatted, "nativeHealthEvaluationValue"));
            var nativeHealthEvaluation = *(NativeTypes.FABRIC_NODES_HEALTH_EVALUATION *)nativeHealthEvaluationValuePtr;

            var managedHealthEvaluation = new NodesHealthEvaluation();

            managedHealthEvaluation.Description              = NativeTypes.FromNativeString(nativeHealthEvaluation.Description);
            managedHealthEvaluation.AggregatedHealthState    = (HealthState)nativeHealthEvaluation.AggregatedHealthState;
            managedHealthEvaluation.UnhealthyEvaluations     = HealthEvaluation.FromNativeList(nativeHealthEvaluation.UnhealthyEvaluations);
            managedHealthEvaluation.TotalCount               = (long)nativeHealthEvaluation.TotalCount;
            managedHealthEvaluation.MaxPercentUnhealthyNodes = nativeHealthEvaluation.MaxPercentUnhealthyNodes;

            return(managedHealthEvaluation);
        }
Example #6
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);
        }
        internal static unsafe UpgradeDomainDeployedApplicationsHealthEvaluation FromNative(IntPtr nativeHealthEvaluationValuePtr)
        {
            ReleaseAssert.AssertIf(nativeHealthEvaluationValuePtr == IntPtr.Zero, string.Format(CultureInfo.CurrentCulture, StringResources.Error_NativeDataNull_Formatted, "nativeHealthEvaluationValue"));
            var nativeHealthEvaluation = *(NativeTypes.FABRIC_UPGRADE_DOMAIN_DEPLOYED_APPLICATIONS_HEALTH_EVALUATION *)nativeHealthEvaluationValuePtr;

            var managedHealthEvaluation = new UpgradeDomainDeployedApplicationsHealthEvaluation();

            managedHealthEvaluation.Description           = NativeTypes.FromNativeString(nativeHealthEvaluation.Description);
            managedHealthEvaluation.AggregatedHealthState = (HealthState)nativeHealthEvaluation.AggregatedHealthState;
            managedHealthEvaluation.UpgradeDomainName     = NativeTypes.FromNativeString(nativeHealthEvaluation.UpgradeDomainName);
            managedHealthEvaluation.UnhealthyEvaluations  = HealthEvaluation.FromNativeList(nativeHealthEvaluation.UnhealthyEvaluations);
            managedHealthEvaluation.TotalCount            = (long)nativeHealthEvaluation.TotalCount;
            managedHealthEvaluation.MaxPercentUnhealthyDeployedApplications = nativeHealthEvaluation.MaxPercentUnhealthyDeployedApplications;

            return(managedHealthEvaluation);
        }
Example #8
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);
        }
Example #9
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);
        }
Example #10
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);
        }
        internal static unsafe DeployedServicePackageHealthEvaluation FromNative(IntPtr nativeHealthEvaluationValuePtr)
        {
            ReleaseAssert.AssertIf(nativeHealthEvaluationValuePtr == IntPtr.Zero, string.Format(CultureInfo.CurrentCulture, StringResources.Error_NativeDataNull_Formatted, "nativeHealthEvaluationValue"));
            var nativeHealthEvaluation = *(NativeTypes.FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_EVALUATION *)nativeHealthEvaluationValuePtr;

            var managedHealthEvaluation = new DeployedServicePackageHealthEvaluation();

            managedHealthEvaluation.Description           = NativeTypes.FromNativeString(nativeHealthEvaluation.Description);
            managedHealthEvaluation.AggregatedHealthState = (HealthState)nativeHealthEvaluation.AggregatedHealthState;
            managedHealthEvaluation.UnhealthyEvaluations  = HealthEvaluation.FromNativeList(nativeHealthEvaluation.UnhealthyEvaluations);
            managedHealthEvaluation.ApplicationName       = NativeTypes.FromNativeUri(nativeHealthEvaluation.ApplicationName);
            managedHealthEvaluation.NodeName            = NativeTypes.FromNativeString(nativeHealthEvaluation.NodeName);
            managedHealthEvaluation.ServiceManifestName = NativeTypes.FromNativeString(nativeHealthEvaluation.ServiceManifestName);

            if (nativeHealthEvaluation.Reserved != IntPtr.Zero)
            {
                var nativeResultItemEx1 =
                    (NativeTypes.FABRIC_DEPLOYED_SERVICE_PACKAGE_HEALTH_EVALUATION_EX1 *)nativeHealthEvaluation.Reserved;

                managedHealthEvaluation.ServicePackageActivationId = NativeTypes.FromNativeString(nativeResultItemEx1->ServicePackageActivationId);
            }

            return(managedHealthEvaluation);
        }
        internal static unsafe UpgradeDomainDeltaNodesCheckHealthEvaluation FromNative(IntPtr nativeUpgradeDomainDeltaNodesCheckHealthEvaluationPtr)
        {
            ReleaseAssert.AssertIf(nativeUpgradeDomainDeltaNodesCheckHealthEvaluationPtr == IntPtr.Zero, string.Format(CultureInfo.CurrentCulture, StringResources.Error_NativeDataNull_Formatted, "UpgradeDomainDeltaNodesCheckHealthEvaluation"));
            var nativeUpgradeDomainDeltaNodesCheckHealthEvaluation = *(NativeTypes.FABRIC_UPGRADE_DOMAIN_DELTA_NODES_CHECK_HEALTH_EVALUATION *)nativeUpgradeDomainDeltaNodesCheckHealthEvaluationPtr;

            var managedUpgradeDomainDeltaNodesCheckHealthEvaluation = new UpgradeDomainDeltaNodesCheckHealthEvaluation();

            managedUpgradeDomainDeltaNodesCheckHealthEvaluation.Description           = NativeTypes.FromNativeString(nativeUpgradeDomainDeltaNodesCheckHealthEvaluation.Description);
            managedUpgradeDomainDeltaNodesCheckHealthEvaluation.AggregatedHealthState = (HealthState)nativeUpgradeDomainDeltaNodesCheckHealthEvaluation.AggregatedHealthState;
            managedUpgradeDomainDeltaNodesCheckHealthEvaluation.UpgradeDomainName     = NativeTypes.FromNativeString(nativeUpgradeDomainDeltaNodesCheckHealthEvaluation.UpgradeDomainName);
            managedUpgradeDomainDeltaNodesCheckHealthEvaluation.BaselineErrorCount    = (long)nativeUpgradeDomainDeltaNodesCheckHealthEvaluation.BaselineErrorCount;
            managedUpgradeDomainDeltaNodesCheckHealthEvaluation.BaselineTotalCount    = (long)nativeUpgradeDomainDeltaNodesCheckHealthEvaluation.BaselineTotalCount;
            managedUpgradeDomainDeltaNodesCheckHealthEvaluation.TotalCount            = (long)nativeUpgradeDomainDeltaNodesCheckHealthEvaluation.TotalCount;
            managedUpgradeDomainDeltaNodesCheckHealthEvaluation.MaxPercentUpgradeDomainDeltaUnhealthyNodes = nativeUpgradeDomainDeltaNodesCheckHealthEvaluation.MaxPercentUpgradeDomainDeltaUnhealthyNodes;
            managedUpgradeDomainDeltaNodesCheckHealthEvaluation.UnhealthyEvaluations = HealthEvaluation.FromNativeList(nativeUpgradeDomainDeltaNodesCheckHealthEvaluation.UnhealthyEvaluations);

            return(managedUpgradeDomainDeltaNodesCheckHealthEvaluation);
        }