Exemple #1
0
 // Token: 0x060005BB RID: 1467 RVA: 0x000158A4 File Offset: 0x00013AA4
 public IDistributedStoreKey OpenKey(string subkeyName, DxStoreKeyAccessMode mode, bool isIgnoreIfNotExist, ReadWriteConstraints constraints)
 {
     return(this.BaseParameters.KeyFactory.RunOperationAndTranslateException <IDistributedStoreKey>(OperationCategory.OpenKey, Path.Combine(this.FullKeyName, subkeyName), delegate()
     {
         ReadOptions readOptions = this.GetReadOptions(constraints);
         WriteOptions writeOptions = this.GetWriteOptions(constraints);
         DxStoreAccessRequest.CheckKey checkKey = this.CreateRequest <DxStoreAccessRequest.CheckKey>();
         checkKey.IsCreateIfNotExist = (mode == DxStoreKeyAccessMode.CreateIfNotExist);
         checkKey.SubkeyName = subkeyName;
         checkKey.ReadOptions = readOptions;
         checkKey.WriteOptions = writeOptions;
         DxStoreAccessReply.CheckKey checkKey2 = this.BaseParameters.Client.CheckKey(checkKey, null);
         this.SetReadResult(constraints, checkKey2.ReadResult);
         this.SetWriteResult(constraints, checkKey2.WriteResult);
         IDistributedStoreKey result = null;
         if (!checkKey2.IsExist)
         {
             if (!isIgnoreIfNotExist)
             {
                 throw new DxStoreKeyNotFoundException(subkeyName);
             }
         }
         else
         {
             result = new DxStoreKey(Path.Combine(this.FullKeyName, subkeyName), mode, this.BaseParameters);
         }
         return result;
     }, false));
 }
Exemple #2
0
        private DxStoreAccessReply.CheckKey CheckKeyInternal(DxStoreAccessRequest.CheckKey request)
        {
            bool isStale = !this.EnsureInstanceReadyAndNotStale(request.ReadOptions);

            DxStoreAccessReply.CheckKey checkKey = this.CreateReply <DxStoreAccessReply.CheckKey>();
            string keyName = Utils.CombinePathNullSafe(request.FullKeyName, request.SubkeyName);

            checkKey.ReadResult = new ReadResult
            {
                IsStale = isStale
            };
            checkKey.IsExist = this.instance.LocalDataStore.IsKeyExist(keyName);
            if (!checkKey.IsExist && request.IsCreateIfNotExist)
            {
                checkKey.WriteResult = this.CreateKey(request.FullKeyName, request.SubkeyName, request.WriteOptions);
                checkKey.IsCreated   = true;
                checkKey.IsExist     = true;
            }
            return(this.FinishRequest <DxStoreAccessReply.CheckKey>(checkKey));
        }
 // Token: 0x060005E9 RID: 1513 RVA: 0x00016650 File Offset: 0x00014850
 public IDistributedStoreKey GetBaseKey(DxStoreKeyAccessMode mode, CachedChannelFactory <IDxStoreAccess> channelFactory = null, string nodeName = null, bool isPrivate = false)
 {
     return(this.RunOperationAndTranslateException <DxStoreKey>(OperationCategory.GetBaseKey, string.Empty, delegate()
     {
         channelFactory = (channelFactory ?? this.GetFactory(nodeName, null));
         IDxStoreAccessClient dxStoreAccessClient;
         if (this.GroupConfig.Settings.IsUseHttpTransportForClientCommunication)
         {
             dxStoreAccessClient = new HttpStoreAccessClient(this.GroupConfig.Self, HttpClient.TargetInfo.BuildFromNode(nodeName, this.GroupConfig), this.GroupConfig.Settings.StoreAccessHttpTimeoutInMSec);
         }
         else
         {
             dxStoreAccessClient = new WcfStoreAccessClient(channelFactory, null);
         }
         DxStoreAccessRequest.CheckKey checkKey = new DxStoreAccessRequest.CheckKey();
         checkKey.Initialize(string.Empty, isPrivate, this.ConfigProvider.Self);
         DxStoreAccessReply.CheckKey checkKey2 = dxStoreAccessClient.CheckKey(checkKey, null);
         if (checkKey2.ReadResult.IsStale)
         {
             throw new DxStoreInstanceStaleStoreException();
         }
         if (!checkKey2.IsExist)
         {
             throw new DxStoreKeyNotFoundException(string.Empty);
         }
         DxStoreKey.BaseKeyParameters baseParameters = new DxStoreKey.BaseKeyParameters
         {
             Client = dxStoreAccessClient,
             KeyFactory = this,
             Self = this.ConfigProvider.Self,
             IsPrivate = isPrivate,
             DefaultReadOptions = new ReadOptions(),
             DefaultWriteOptions = new WriteOptions()
         };
         return new DxStoreKey(string.Empty, mode, baseParameters);
     }, false));
 }
Exemple #4
0
 public DxStoreAccessReply.CheckKey CheckKey(DxStoreAccessRequest.CheckKey request)
 {
     return(this.RunServerOperationAndConvertToFaultException <DxStoreAccessRequest.CheckKey, DxStoreAccessReply.CheckKey>(request, (DxStoreAccessRequest.CheckKey req) => this.CheckKeyInternal(req)));
 }