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);
        }
コード例 #2
0
        internal static unsafe PartitionLoadInformation CreateFromNative(
            NativeTypes.FABRIC_PARTITION_LOAD_INFORMATION nativeLoadInformation)
        {
            IList <LoadMetricReport> primaryLoadsList;
            IList <LoadMetricReport> secondaryLoadsList;

            if (nativeLoadInformation.PrimaryLoadMetricReports == IntPtr.Zero)
            {
                primaryLoadsList = new List <LoadMetricReport>();
            }
            else
            {
                primaryLoadsList =
                    LoadMetricReport.CreateFromNativeList((NativeTypes.FABRIC_LOAD_METRIC_REPORT_LIST *)nativeLoadInformation.PrimaryLoadMetricReports);
            }

            if (nativeLoadInformation.SecondaryLoadMetricReports == IntPtr.Zero)
            {
                secondaryLoadsList = new List <LoadMetricReport>();
            }
            else
            {
                secondaryLoadsList =
                    LoadMetricReport.CreateFromNativeList((NativeTypes.FABRIC_LOAD_METRIC_REPORT_LIST *)nativeLoadInformation.SecondaryLoadMetricReports);
            }

            return(new PartitionLoadInformation(nativeLoadInformation.PartitionId)
            {
                PrimaryLoadMetricReports = primaryLoadsList,
                SecondaryLoadMetricReports = secondaryLoadsList
            });
        }
コード例 #3
0
        internal static unsafe IList <LoadMetricReport> CreateFromNativeList(NativeTypes.FABRIC_LOAD_METRIC_REPORT_LIST *list)
        {
            var rv = new List <LoadMetricReport>();

            var nativeArray = (NativeTypes.FABRIC_LOAD_METRIC_REPORT *)list->Items;

            for (int i = 0; i < list->Count; i++)
            {
                var nativeItem = *(nativeArray + i);
                rv.Add(LoadMetricReport.CreateFromNative(nativeItem));
            }

            return(rv);
        }
        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);
        }
コード例 #5
0
        internal static unsafe ReplicaLoadInformation CreateFromNative(
            NativeTypes.FABRIC_REPLICA_LOAD_INFORMATION nativeLoadInformation)
        {
            IList <LoadMetricReport> LoadsList;

            if (nativeLoadInformation.LoadMetricReports == IntPtr.Zero)
            {
                LoadsList = new List <LoadMetricReport>();
            }
            else
            {
                LoadsList =
                    LoadMetricReport.CreateFromNativeList((NativeTypes.FABRIC_LOAD_METRIC_REPORT_LIST *)nativeLoadInformation.LoadMetricReports);
            }

            return(new ReplicaLoadInformation(nativeLoadInformation.PartitionId, nativeLoadInformation.ReplicaOrInstanceId)
            {
                LoadMetricReports = LoadsList
            });
        }