internal static unsafe DeployedServiceReplicaDetail CreateFromNative( NativeTypes.FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_DETAIL_QUERY_RESULT_ITEM nativeResultItem) { var rv = new DeployedStatefulServiceReplicaDetail { CurrentReplicatorOperation = (ReplicatorOperationName)nativeResultItem.CurrentReplicatorOperation, CurrentServiceOperation = (ServiceOperationName)nativeResultItem.CurrentServiceOperation, CurrentServiceOperationStartTimeUtc = NativeTypes.FromNativeFILETIME(nativeResultItem.CurrentServiceOperationStartTimeUtc), PartitionId = nativeResultItem.PartitionId, ReadStatus = (PartitionAccessStatus)nativeResultItem.ReadStatus, ReplicaId = nativeResultItem.ReplicaId, ReportedLoad = LoadMetricReport.CreateFromNativeList((NativeTypes.FABRIC_LOAD_METRIC_REPORT_LIST *)nativeResultItem.ReportedLoad), ServiceName = new Uri(NativeTypes.FromNativeString(nativeResultItem.ServiceName)), WriteStatus = (PartitionAccessStatus)nativeResultItem.WriteStatus }; if (nativeResultItem.ReplicatorStatus != IntPtr.Zero) { rv.ReplicatorStatus = ReplicatorStatus.FromNative((NativeTypes.FABRIC_REPLICATOR_STATUS_QUERY_RESULT *)nativeResultItem.ReplicatorStatus); } if (nativeResultItem.Reserved != IntPtr.Zero) { var ex1 = (NativeTypes.FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_DETAIL_QUERY_RESULT_ITEM_EX1 *)nativeResultItem.Reserved; var replicaStatus = (NativeTypes.FABRIC_REPLICA_STATUS_QUERY_RESULT *)ex1->ReplicaStatus; if (replicaStatus != null && replicaStatus->Kind == NativeTypes.FABRIC_SERVICE_REPLICA_KIND.FABRIC_SERVICE_REPLICA_KIND_KEY_VALUE_STORE) { rv.ReplicaStatus = KeyValueStoreReplicaStatus.CreateFromNative(replicaStatus->Value); } if (ex1->Reserved != IntPtr.Zero) { var extended2 = (NativeTypes.FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_DETAIL_QUERY_RESULT_ITEM_EX2 *)ex1->Reserved; var deployedServiceReplica = *(NativeTypes.FABRIC_DEPLOYED_STATEFUL_SERVICE_REPLICA_QUERY_RESULT_ITEM *)extended2->DeployedServiceReplica; rv.DeployedServiceReplica = DeployedStatefulServiceReplica.FromNative(deployedServiceReplica); } } return(rv); }
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); } }