Beispiel #1
0
 internal ServiceHealth(System.Fabric.Health.ServiceHealth health)
     : base(health)
 {
     this.ServiceName           = health.ServiceName;
     this.PartitionHealthStates = health.PartitionHealthStates
                                  .Select(state => new PartitionHealthState(
                                              state.PartitionId,
                                              state.AggregatedHealthState));
 }
Beispiel #2
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);
        }