// Token: 0x06000536 RID: 1334 RVA: 0x0001393C File Offset: 0x00011B3C
        private IDistributedStoreKey OpenKeyInternal(string subKeyName, DxStoreKeyAccessMode mode, bool isIgnoreIfNotExist)
        {
            AmClusterRegkeyHandle amClusterRegkeyHandle = null;
            AmClusterRegkeyHandle keyHandle             = this.KeyHandle;
            RegSAM regSam = ClusterDbKey.GetRegSam(mode);
            int    num    = ClusapiMethods.ClusterRegOpenKey(keyHandle, subKeyName, regSam, out amClusterRegkeyHandle);

            if (mode == DxStoreKeyAccessMode.CreateIfNotExist && (num == 2 || num == 3))
            {
                uint num2;
                num = ClusapiMethods.ClusterRegCreateKey(keyHandle, subKeyName, 0U, regSam, IntPtr.Zero, out amClusterRegkeyHandle, out num2);
            }
            if (num == 0)
            {
                return(new ClusterDbKey(amClusterRegkeyHandle, this.ClusterHandle));
            }
            if (amClusterRegkeyHandle != null && !amClusterRegkeyHandle.IsInvalid)
            {
                amClusterRegkeyHandle.Dispose();
            }
            amClusterRegkeyHandle = null;
            if (!isIgnoreIfNotExist)
            {
                throw new ClusterApiException("ClusterRegOpenKey", new Win32Exception(num));
            }
            return(null);
        }
        // Token: 0x06000542 RID: 1346 RVA: 0x00013C98 File Offset: 0x00011E98
        public XElement GetXElementSnapshot(string keyName = null)
        {
            bool flag = false;

            if (this.clusterHandle == null || this.clusterHandle.IsInvalid)
            {
                this.clusterHandle = ClusapiMethods.OpenCluster(null);
                flag = true;
            }
            XElement xelementSnapshotInternal;

            try
            {
                using (IDistributedStoreKey distributedStoreKey = ClusterDbKey.GetBaseKey(this.clusterHandle, DxStoreKeyAccessMode.Read))
                {
                    this.baseKey             = distributedStoreKey;
                    xelementSnapshotInternal = this.GetXElementSnapshotInternal(keyName);
                }
            }
            finally
            {
                if (flag && this.clusterHandle != null && !this.clusterHandle.IsInvalid)
                {
                    this.clusterHandle.Close();
                    this.clusterHandle = null;
                }
            }
            return(xelementSnapshotInternal);
        }
        // Token: 0x06000533 RID: 1331 RVA: 0x000138B8 File Offset: 0x00011AB8
        internal static IDistributedStoreKey GetBaseKey(AmClusterHandle clusterHandle, DxStoreKeyAccessMode mode)
        {
            RegSAM regSam = ClusterDbKey.GetRegSam(mode);
            AmClusterRegkeyHandle clusterKey = ClusapiMethods.GetClusterKey(clusterHandle, regSam);

            if (clusterKey == null || clusterKey.IsInvalid)
            {
                throw AmExceptionHelper.ConstructClusterApiExceptionNoErr("GetClusterKey", new object[0]);
            }
            return(new ClusterDbKey(clusterKey, clusterHandle));
        }
        // Token: 0x060004F6 RID: 1270 RVA: 0x00012E40 File Offset: 0x00011040
        public ClusdbBatchRequest(ClusterDbKey containerKey)
        {
            AmClusterBatchHandle amClusterBatchHandle = null;
            int num = ClusapiMethods.ClusterRegCreateBatch(containerKey.KeyHandle, out amClusterBatchHandle);

            if (num != 0 || amClusterBatchHandle.IsInvalid)
            {
                throw AmExceptionHelper.ConstructClusterApiException(num, "ClusterRegCreateBatch()", new object[0]);
            }
            this.batchHandle  = amClusterBatchHandle;
            this.ContainerKey = containerKey;
        }
Esempio n. 5
0
        public IDistributedStoreKey GetBaseKeyByStoreKind(DxStoreKeyAccessMode mode, DistributedStore.Context context, StoreKind storeKind)
        {
            IDistributedStoreKey result;

            switch (storeKind)
            {
            case StoreKind.Clusdb:
                result = ClusterDbKey.GetBaseKey(context.ClusterHandle, mode);
                break;

            case StoreKind.DxStore:
                result = this.DxStoreKeyFactoryInstance.GetBaseKey(mode, context.ChannelFactory, context.NodeName, false);
                break;

            default:
                result = null;
                break;
            }
            return(result);
        }