internal static unsafe DeployedServiceReplicaDetail CreateFromNative(
            NativeTypes.FABRIC_DEPLOYED_STATELESS_SERVICE_INSTANCE_DETAIL_QUERY_RESULT_ITEM nativeResultItem)
        {
            DeployedStatelessServiceInstance deployedReplicaInstance = new DeployedStatelessServiceInstance();

            if (nativeResultItem.Reserved != IntPtr.Zero)
            {
                var extended1 = (NativeTypes.FABRIC_DEPLOYED_STATELESS_SERVICE_INSTANCE_DETAIL_QUERY_RESULT_ITEM_EX1 *)nativeResultItem.Reserved;

                var deployedServiceReplica = *(NativeTypes.FABRIC_DEPLOYED_STATELESS_SERVICE_INSTANCE_QUERY_RESULT_ITEM *)extended1->DeployedServiceReplica;
                deployedReplicaInstance = DeployedStatelessServiceInstance.FromNative(deployedServiceReplica);
            }

            var rv = new DeployedStatelessServiceInstanceDetail
            {
                CurrentServiceOperation             = (ServiceOperationName)nativeResultItem.CurrentServiceOperation,
                CurrentServiceOperationStartTimeUtc = NativeTypes.FromNativeFILETIME(nativeResultItem.CurrentServiceOperationStartTimeUtc),
                InstanceId   = nativeResultItem.InstanceId,
                PartitionId  = nativeResultItem.PartitionId,
                ReportedLoad = LoadMetricReport.CreateFromNativeList((NativeTypes.FABRIC_LOAD_METRIC_REPORT_LIST *)nativeResultItem.ReportedLoad),
                ServiceName  = new Uri(NativeTypes.FromNativeString(nativeResultItem.ServiceName)),
                DeployedServiceReplicaInstance = deployedReplicaInstance,
            };

            return(rv);
        }
Beispiel #2
0
 internal static unsafe DeployedServiceReplicaDetail FromNative(
     NativeTypes.FABRIC_DEPLOYED_SERVICE_REPLICA_DETAIL_QUERY_RESULT_ITEM nativeResultItem)
 {
     if ((ServiceKind)nativeResultItem.Kind == ServiceKind.Stateless)
     {
         var nativeStatelessInstanceQueryResult =
             *(NativeTypes.FABRIC_DEPLOYED_STATELESS_SERVICE_INSTANCE_DETAIL_QUERY_RESULT_ITEM *)nativeResultItem.Value;
         return(DeployedStatelessServiceInstanceDetail.CreateFromNative(nativeStatelessInstanceQueryResult));
     }
     else if ((ServiceKind)nativeResultItem.Kind == ServiceKind.Stateful)
     {
         var nativeStatefulServiceQueryResult =
             *(NativeTypes.FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_DETAIL_QUERY_RESULT_ITEM *)nativeResultItem.Value;
         return(DeployedStatefulServiceReplicaDetail.CreateFromNative(nativeStatefulServiceQueryResult));
     }
     else
     {
         AppTrace.TraceSource.WriteNoise(
             "DeployedServiceReplica.CreateFromNative",
             "Ignoring the result with unsupported ServiceKind value {0}",
             (int)nativeResultItem.Kind);
         return(null);
     }
 }