Esempio n. 1
0
 internal PartitionHealth(System.Fabric.Health.PartitionHealth health)
     : base(health)
 {
     this.PartitionId         = health.PartitionId;
     this.ReplicaHealthStates = health.ReplicaHealthStates
                                .Select(state => new ReplicaHealthState(
                                            state.PartitionId,
                                            state.Id,
                                            state.AggregatedHealthState));
 }
Esempio n. 2
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);
        }