Esempio n. 1
0
        internal static unsafe KeyValueStoreReplicaStatus CreateFromNative(IntPtr nativeKvs)
        {
            if (nativeKvs == IntPtr.Zero)
            {
                return(null);
            }

            var castedKvs = (NativeTypes.FABRIC_KEY_VALUE_STORE_STATUS_QUERY_RESULT *)nativeKvs;

            var managedKvs = new KeyValueStoreReplicaStatus();

            managedKvs.DatabaseRowCountEstimate         = castedKvs->DatabaseRowCountEstimate;
            managedKvs.DatabaseLogicalSizeEstimate      = castedKvs->DatabaseLogicalSizeEstimate;
            managedKvs.CopyNotificationCurrentKeyFilter = NativeTypes.FromNativeString(castedKvs->CopyNotificationCurrentKeyFilter);
            managedKvs.CopyNotificationCurrentProgress  = castedKvs->CopyNotificationCurrentProgress;
            managedKvs.StatusDetails = NativeTypes.FromNativeString(castedKvs->StatusDetails);

            if (castedKvs->Reserved != IntPtr.Zero)
            {
                var castedEx1 = (NativeTypes.FABRIC_KEY_VALUE_STORE_STATUS_QUERY_RESULT_EX1 *)castedKvs->Reserved;

                managedKvs.ProviderKind    = (KeyValueStoreProviderKind)castedEx1->ProviderKind;
                managedKvs.MigrationStatus = KeyValueStoreMigrationStatus.CreateFromNative(castedEx1->MigrationStatus);
            }

            return(managedKvs);
        }
        internal static unsafe KeyValueStoreMigrationStatus CreateFromNative(IntPtr nativeStatus)
        {
            if (nativeStatus == IntPtr.Zero)
            {
                return(null);
            }

            var castedStatus = (NativeTypes.FABRIC_KEY_VALUE_STORE_MIGRATION_QUERY_RESULT *)nativeStatus;

            var managedStatus = new KeyValueStoreMigrationStatus();

            managedStatus.CurrentPhase = (KeyValueStoreMigrationPhase)castedStatus->CurrentPhase;
            managedStatus.State        = (KeyValueStoreMigrationState)castedStatus->State;
            managedStatus.NextPhase    = (KeyValueStoreMigrationPhase)castedStatus->NextPhase;

            return(managedStatus);
        }