internal IDistributedStoreKey GetClusterKey(AmClusterHandle clusterHandle, CachedChannelFactory <IDxStoreAccess> channelFactory = null, string nodeName = null, DxStoreKeyAccessMode mode = DxStoreKeyAccessMode.Read, bool isBestEffort = false)
        {
            IDistributedStoreKey result = null;

            try
            {
                if (this.StoreSettings.IsCompositeModeEnabled || RegistryParameters.DistributedStoreIsLogPerformanceForSingleStore)
                {
                    result = this.GetClusterCompositeKey(clusterHandle, channelFactory, nodeName, mode);
                }
                else
                {
                    DistributedStore.Context context = new DistributedStore.Context
                    {
                        ClusterHandle  = clusterHandle,
                        ChannelFactory = channelFactory,
                        NodeName       = nodeName
                    };
                    result = this.GetBaseKeyByStoreKind(mode, context, this.StoreSettings.Primary);
                }
            }
            catch (ClusterException)
            {
                if (!isBestEffort)
                {
                    throw;
                }
            }
            return(result);
        }
        public IDistributedStoreKey GetBaseKey(DxStoreKeyAccessMode mode, DistributedStore.Context context)
        {
            if (this.IsRestartProcessOnDxStoreModeChange)
            {
                this.StartProcessRestartTimer();
            }
            DistributedStoreKey compositeKey = new DistributedStoreKey(string.Empty, string.Empty, mode, context);

            compositeKey.IsBaseKey = true;
            try
            {
                this.ExecuteRequest(compositeKey, OperationCategory.GetBaseKey, OperationType.Read, string.Empty, delegate(IDistributedStoreKey key, bool isPrimary, StoreKind storeKind)
                {
                    this.SetKeyByRole(compositeKey, isPrimary, this.BaseKeyGenerator(mode, context, storeKind));
                });
            }
            finally
            {
                if (compositeKey.PrimaryStoreKey == null)
                {
                    compositeKey.CloseKey();
                    compositeKey = null;
                }
            }
            return(compositeKey);
        }
 private IDistributedStoreKey GetClusterCompositeKey(AmClusterHandle clusterHandle, CachedChannelFactory <IDxStoreAccess> channelFactory = null, string nodeName = null, DxStoreKeyAccessMode mode = DxStoreKeyAccessMode.Read)
 {
     DistributedStore.Context context = new DistributedStore.Context
     {
         ClusterHandle  = clusterHandle,
         ChannelFactory = channelFactory,
         NodeName       = nodeName
     };
     return(this.GetBaseKey(mode, context));
 }
        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);
        }
 // Token: 0x06000583 RID: 1411 RVA: 0x00014DC8 File Offset: 0x00012FC8
 public DistributedStoreKey(string parentKeyName, string subkeyName, DxStoreKeyAccessMode mode, DistributedStore.Context context = null)
 {
     this.InstanceId = Guid.NewGuid();
     if (string.IsNullOrEmpty(parentKeyName))
     {
         parentKeyName = string.Empty;
     }
     if (string.IsNullOrEmpty(subkeyName))
     {
         subkeyName = string.Empty;
     }
     this.FullKeyName = Path.Combine(parentKeyName, subkeyName);
     this.Mode        = mode;
     this.Context     = context;
 }