internal static unsafe PartitionHealthStateChunk FromNative(NativeTypes.FABRIC_PARTITION_HEALTH_STATE_CHUNK nativePartitionHealthStateChunk)
        {
            var managedPartitionHealthStateChunk = new PartitionHealthStateChunk();

            managedPartitionHealthStateChunk.PartitionId = nativePartitionHealthStateChunk.PartitionId;
            managedPartitionHealthStateChunk.HealthState = (HealthState)nativePartitionHealthStateChunk.HealthState;
            managedPartitionHealthStateChunk.ReplicaHealthStateChunks = ReplicaHealthStateChunkList.CreateFromNativeList(nativePartitionHealthStateChunk.ReplicaHealthStateChunks);

            return(managedPartitionHealthStateChunk);
        }
Beispiel #2
0
        internal static unsafe ReplicaHealthStateChunkList CreateFromNativeList(IntPtr nativeListPtr)
        {
            var retval = new ReplicaHealthStateChunkList();

            if (nativeListPtr != IntPtr.Zero)
            {
                var nativeList = (NativeTypes.FABRIC_REPLICA_HEALTH_STATE_CHUNK_LIST *)nativeListPtr;

                var nativeItemArray = (NativeTypes.FABRIC_REPLICA_HEALTH_STATE_CHUNK *)nativeList->Items;
                for (int i = 0; i < nativeList->Count; ++i)
                {
                    var nativeItem = *(nativeItemArray + i);
                    retval.Add(ReplicaHealthStateChunk.FromNative(nativeItem));
                }

                retval.TotalCount = (long)nativeList->TotalCount;
            }

            return(retval);
        }