Пример #1
0
        internal static unsafe StatelessServiceInstanceHealthState FromNative(NativeTypes.FABRIC_STATELESS_SERVICE_INSTANCE_HEALTH_STATE nativeState)
        {
            var statelessServiceInstanceState = new StatelessServiceInstanceHealthState();

            statelessServiceInstanceState.Id                    = nativeState.InstanceId;
            statelessServiceInstanceState.PartitionId           = nativeState.PartitionId;
            statelessServiceInstanceState.AggregatedHealthState = (HealthState)nativeState.AggregatedHealthState;

            return(statelessServiceInstanceState);
        }
Пример #2
0
 internal static unsafe ReplicaHealthState FromNative(NativeTypes.FABRIC_REPLICA_HEALTH_STATE nativeState)
 {
     if (nativeState.Kind == NativeTypes.FABRIC_SERVICE_KIND.FABRIC_SERVICE_KIND_STATELESS)
     {
         return(StatelessServiceInstanceHealthState.FromNative(*(NativeTypes.FABRIC_STATELESS_SERVICE_INSTANCE_HEALTH_STATE *)nativeState.Value));
     }
     else if (nativeState.Kind == NativeTypes.FABRIC_SERVICE_KIND.FABRIC_SERVICE_KIND_STATEFUL)
     {
         return(StatefulServiceReplicaHealthState.FromNative(*(NativeTypes.FABRIC_STATEFUL_SERVICE_REPLICA_HEALTH_STATE *)nativeState.Value));
     }
     else
     {
         AppTrace.TraceSource.WriteError("ReplicaHealthState.FromNative", "Unknown service kind: {0}", nativeState.Kind);
         ReleaseAssert.Failfast(string.Format(CultureInfo.CurrentCulture, StringResources.Error_ServiceKindInvalid_Formatted, nativeState.Kind));
         return(null);
     }
 }