コード例 #1
0
        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var result = new BinaryOperationResult();
            var status = response.StatusCode;

            this.StatusCode = status;

            if (status == 0)
            {
                if (mode != MutationMode.Touch)
                {
                    var data = response.Data;
                    if (data.Count != 8)
                    {
                        return(result.Fail("Result must be 8 bytes long, received: " + data.Count, new InvalidOperationException()));
                    }

                    this.result = BinaryConverter.DecodeUInt64(data.Array, data.Offset);
                }

                return(result.Pass());
            }

            var message = ResultHelper.ProcessResponseData(response.Data);

            return(result.Fail(message));
        }
コード例 #2
0
 protected override IOperationResult ProcessResponse(BinaryResponse response)
 {
     return(new BinaryOperationResult()
     {
         Success = true
     });
 }
コード例 #3
0
        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var status = response.StatusCode;
            var result = new BinaryOperationResult();

            this.StatusCode = status;

            if (status == 0)
            {
                int flags = BinaryConverter.DecodeInt32(response.Extra, 0);
                this.result = new CacheItem((ushort)flags, response.Data);
                this.Cas = response.CAS;

            #if EVEN_MORE_LOGGING
                if (log.IsDebugEnabled)
                    log.DebugFormat("Get succeeded for key '{0}'.", this.Key);
            #endif

                return result.Pass();
            }

            this.Cas = 0;

            #if EVEN_MORE_LOGGING
            if (log.IsDebugEnabled)
                log.DebugFormat("Get failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
            #endif

            var message = ResultHelper.ProcessResponseData(response.Data);
            return result.Fail(message);
        }
コード例 #4
0
        protected internal override async Task <IOperationResult> ReadResponseAsync(PooledSocket socket, CancellationToken cancellationToken = default(CancellationToken))
        {
            var response   = new BinaryResponse();
            var serverData = new Dictionary <string, string>();
            var success    = false;

            while (await response.ReadAsync(socket, cancellationToken).ConfigureAwait(false) && response.KeyLength > 0)
            {
                success = true;

                var data  = response.Data;
                var key   = BinaryConverter.DecodeKey(data.Array, data.Offset, response.KeyLength);
                var value = BinaryConverter.DecodeKey(data.Array, data.Offset + response.KeyLength, data.Count - response.KeyLength);

                serverData[key] = value;
            }

            this._result    = serverData;
            this.StatusCode = response.StatusCode;

            var result = new BinaryOperationResult()
            {
                StatusCode = StatusCode
            };

            result.PassOrFail(success, "Failed to read response");
            return(result);
        }
コード例 #5
0
        protected internal override IOperationResult ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            var success  = response.Read(socket);

            this.Cas        = response.CAS;
            this.StatusCode = response.StatusCode;

            var result = new BinaryOperationResult()
            {
                Success    = success,
                Cas        = this.Cas,
                StatusCode = this.StatusCode
            };

            IOperationResult responseResult;

            if (!(responseResult = this.ProcessResponse(response)).Success)
            {
                result.InnerResult = responseResult;
                responseResult.Combine(result);
            }

            return(result);
        }
コード例 #6
0
        protected internal override IOperationResult ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            var retval   = response.Read(socket);

            this.Cas        = response.CAS;
            this.StatusCode = response.StatusCode;

            var result = new BinaryOperationResult()
            {
                Success    = retval,
                Cas        = this.Cas,
                StatusCode = this.StatusCode
            };

            IOperationResult responseResult;

            if (!(responseResult = this.ProcessResponse(response)).Success)
            {
                result.InnerResult = responseResult;
                result.Fail("Failed to process response, see StatusCode or InnerResult for details");
            }

            return(result);
        }
コード例 #7
0
        protected override bool ProcessResponse(BinaryResponse response)
        {
            if (response.StatusCode == 0)
            {
                int flags = BinaryConverter.DecodeInt32(response.Extra, 0);
                this.result = new CacheItem((ushort)flags, response.Data);
                this.Cas    = response.CAS;

#if EVEN_MORE_LOGGING
                if (log.IsDebugEnabled)
                {
                    log.DebugFormat("Get succeeded for key '{0}'.", this.Key);
                }
#endif

                return(true);
            }

            this.Cas = 0;

#if EVEN_MORE_LOGGING
            if (log.IsDebugEnabled)
            {
                log.DebugFormat("Get failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
            }
#endif

            return(false);
        }
コード例 #8
0
        protected override bool ProcessResponse(BinaryResponse response)
        {
            if (response.StatusCode == 0)
            {
                int flags = BinaryConverter.DecodeInt32(response.Extra, 0);
                this.result = new CacheItem((ushort)flags, response.Data);
                this.Cas = response.CAS;

            #if EVEN_MORE_LOGGING
                if (log.IsDebugEnabled)
                    log.DebugFormat("Get succeeded for key '{0}'.", this.Key);
            #endif

                return true;
            }

            this.Cas = 0;

            #if EVEN_MORE_LOGGING
            if (log.IsDebugEnabled)
                log.DebugFormat("Get failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
            #endif

            return false;
        }
コード例 #9
0
        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var status = response.StatusCode;
            var result = new BinaryOperationResult();

            this.StatusCode = status;

            if (status == 0)
            {
                int flags = BinaryConverter.DecodeInt32(response.Extra, 0);
                this.result = new CacheItem((ushort)flags, response.Data);
                this.Cas    = response.CAS;

#if EVEN_MORE_LOGGING
                if (_logger.IsEnabled(LogLevel.Debug))
                {
                    _logger.LogDebug("Get succeeded for key '{0}'.", this.Key);
                }
#endif

                return(result.Pass());
            }

            this.Cas = 0;

#if EVEN_MORE_LOGGING
            if (_logger.IsEnabled(LogLevel.Debug))
            {
                _logger.LogDebug("Get failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
            }
#endif

            var message = ResultHelper.ProcessResponseData(response.Data);
            return(result.Fail(message));
        }
コード例 #10
0
        protected internal override async ValueTask <IOperationResult> ReadResponseAsync(PooledSocket socket)
        {
            var response   = new BinaryResponse();
            var serverData = new Dictionary <string, string>();
            var retval     = false;

            while ((await response.ReadAsync(socket)) && response.KeyLength > 0)
            {
                retval = true;

                var data  = response.Data;
                var key   = BinaryConverter.DecodeKey(data.Array, data.Offset, response.KeyLength);
                var value = BinaryConverter.DecodeKey(data.Array, data.Offset + response.KeyLength, data.Count - response.KeyLength);

                serverData[key] = value;
            }

            this.result     = serverData;
            this.StatusCode = response.StatusCode;

            var result = new BinaryOperationResult()
            {
                StatusCode = StatusCode
            };

            result.PassOrFail(retval, "Failed to read response");
            return(result);
        }
コード例 #11
0
        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var result = new BinaryOperationResult();

#if EVEN_MORE_LOGGING
            if (log.IsDebugEnabled)
            {
                if (response.StatusCode == 0)
                {
                    log.DebugFormat("Store succeeded for key '{0}'.", this.Key);
                }
                else
                {
                    log.DebugFormat("Store failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
                }
            }
#endif
            this.StatusCode = response.StatusCode;
            if (response.StatusCode == 0)
            {
                return(result.Pass());
            }
            else
            {
                var message = ResultHelper.ProcessResponseData(response.Data);
                return(result.Fail(message));
            }
        }
コード例 #12
0
		protected internal override bool ReadResponse(PooledSocket socket)
		{
			this.result = new Dictionary<string, CacheItem>();
			this.Cas = new Dictionary<string, ulong>();

			var response = new BinaryResponse();

			while (response.Read(socket))
			{
				// found the noop, quit
				if (response.CorrelationId == this.noopId)
					return true;

				string key;

				// find the key to the response
				if (!this.idToKey.TryGetValue(response.CorrelationId, out key))
				{
					// we're not supposed to get here tho
					log.WarnFormat("Found response with CorrelationId {0}, but no key is matching it.", response.CorrelationId);
					continue;
				}

				if (log.IsDebugEnabled) log.DebugFormat("Reading item {0}", key);

				// deserialize the response
				int flags = BinaryConverter.DecodeInt32(response.Extra, 0);

				this.result[key] = new CacheItem((ushort)flags, response.Data);
				this.Cas[key] = response.CAS;
			}

			// finished reading but we did not find the NOOP
			return false;
		}
コード例 #13
0
ファイル: StatsOperation.cs プロジェクト: javithalion/NCache
		protected internal override IOperationResult ReadResponse(PooledSocket socket)
		{
			var response = new BinaryResponse();
			var serverData = new Dictionary<string, string>();
			var retval = false;

			while (response.Read(socket) && response.KeyLength > 0)
			{
				retval = true;

				var data = response.Data;
				var key = BinaryConverter.DecodeKey(data.Array, data.Offset, response.KeyLength);
				var value = BinaryConverter.DecodeKey(data.Array, data.Offset + response.KeyLength, data.Count - response.KeyLength);

				serverData[key] = value;
			}

			this.result = serverData;
			this.StatusCode = response.StatusCode;

			var result = new BinaryOperationResult()
			{
				StatusCode = StatusCode
			};

			result.PassOrFail(retval, "Failed to read response");
			return result;
		}
コード例 #14
0
        protected internal override async Task <IOperationResult> ReadResponseAsync(PooledSocket socket, CancellationToken cancellationToken = default(CancellationToken))
        {
            var response = new BinaryResponse();
            var success  = await response.ReadAsync(socket, cancellationToken).ConfigureAwait(false);

            this.Cas        = response.CAS;
            this.StatusCode = response.StatusCode;

            var result = new BinaryOperationResult()
            {
                Success    = success,
                Cas        = this.Cas,
                StatusCode = this.StatusCode
            };

            IOperationResult responseResult;

            if (!(responseResult = this.ProcessResponse(response)).Success)
            {
                result.InnerResult = responseResult;
                responseResult.Combine(result);
            }

            return(result);
        }
コード例 #15
0
        protected internal override async ValueTask <IOperationResult> ReadResponseAsync(PooledSocket socket)
        {
            var response = new BinaryResponse();
            var retval   = await response.ReadAsync(socket);

            this.Cas        = response.CAS;
            this.StatusCode = response.StatusCode;

            var result = new BinaryOperationResult()
            {
                Success    = retval,
                Cas        = this.Cas,
                StatusCode = this.StatusCode
            };

            IOperationResult responseResult;

            if (!(responseResult = this.ProcessResponse(response)).Success)
            {
                result.InnerResult = responseResult;
                responseResult.Combine(result);
            }

            return(result);
        }
コード例 #16
0
        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var result = new BinaryOperationResult();

            return(response.StatusCode == 0
                                ? result.Pass()
                                : result.Fail(OperationResultHelper.ProcessResponseData(response.Data)));
        }
コード例 #17
0
        protected internal override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            var retval = response.Read(socket);
            this.Cas = response.CAS;

            return retval & this.ProcessResponse(response);
        }
コード例 #18
0
        protected internal override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            var retval   = response.Read(socket);

            this.StatusCode = StatusCode;

            return(retval);
        }
コード例 #19
0
        protected internal override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            var retval   = response.Read(socket);

            this.Cas = response.CAS;

            return(retval & this.ProcessResponse(response));
        }
コード例 #20
0
        protected internal override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            var retval = response.Read(socket);

            this.StatusCode = StatusCode;

            return retval;
        }
コード例 #21
0
        protected override bool ProcessResponse(BinaryResponse response)
        {
            var r = base.ProcessResponse(response);

            if (this.locator != null &&
                !VBucketAwareOperationFactory.GuessResponseState(response, out this.state))
                return false;

            return r;
        }
コード例 #22
0
		protected internal override bool ReadResponse(PooledSocket socket)
		{
			var response = new BinaryResponse();

			var retval = response.Read(socket);

			this.StatusCode = response.StatusCode;
			this.Data = response.Data.Array;

			return retval;
		}
コード例 #23
0
		protected override bool ProcessResponse(BinaryResponse response)
		{
#if EVEN_MORE_LOGGING
			if (log.IsDebugEnabled)
				if (response.StatusCode == 0)
					log.DebugFormat("Delete succeeded for key '{0}'.", this.Key);
				else
					log.DebugFormat("Delete failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
#endif

			return true;
		}
コード例 #24
0
		protected internal override bool ReadResponseAsync(PooledSocket socket, Action<bool> next)
		{
			this.result = new Dictionary<string, CacheItem>();
			this.Cas = new Dictionary<string, ulong>();

			this.currentSocket = socket;
			this.asyncReader = new BinaryResponse();
			this.asyncLoopState = null;
			this.afterAsyncRead = next;

			return this.DoReadAsync();
		}
コード例 #25
0
        protected internal override bool ReadResponseAsync(PooledSocket socket, Action <bool> next)
        {
            this.result = new Dictionary <string, CacheItem>();
            this.Cas    = new Dictionary <string, ulong>();

            this.currentSocket  = socket;
            this.asyncReader    = new BinaryResponse();
            this.asyncLoopState = null;
            this.afterAsyncRead = next;

            return(this.DoReadAsync());
        }
コード例 #26
0
        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var r = base.ProcessResponse(response);
            var result = new BinaryOperationResult();

            if (this.locator != null &&
                !VBucketAwareOperationFactory.GuessResponseState(response, out this.state))
            {
                return result.Fail("Failed to process response");
            }

            return r;
        }
コード例 #27
0
        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var r = response.StatusCode == 0;
            var result = new BinaryOperationResult();

            if (this.locator != null &&
                !VBucketAwareOperationFactory.GuessResponseState(response, out this.state))
            {
                return result.Fail("Process response failed");
            }

            return result.PassOrFail(r, "Processing response failed");
        }
コード例 #28
0
        protected internal override async Task <IOperationResult> ReadResponseAsync(PooledSocket socket, CancellationToken cancellationToken = default(CancellationToken))
        {
            var response = new BinaryResponse();
            var success  = await response.ReadAsync(socket, cancellationToken).ConfigureAwait(false);

            this.StatusCode = StatusCode;
            var result = new BinaryOperationResult()
            {
                Success    = success,
                StatusCode = this.StatusCode
            };

            result.PassOrFail(success, "Failed to read response");
            return(result);
        }
コード例 #29
0
        protected override bool ProcessResponse(BinaryResponse response)
        {
            if (response.StatusCode == 0)
            {
                var data = response.Data;
                if (data.Count != 8)
                    throw new InvalidOperationException("result must be 8 bytes long, received: " + data.Count);

                this.result = BinaryConverter.DecodeUInt64(data.Array, data.Offset);

                return true;
            }

            return false;
        }
コード例 #30
0
        protected internal override IOperationResult ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            var retval   = response.Read(socket);

            this.StatusCode = StatusCode;
            var result = new BinaryOperationResult()
            {
                Success    = retval,
                StatusCode = this.StatusCode
            };

            result.PassOrFail(retval, "Failed to read response");
            return(result);
        }
コード例 #31
0
        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var result = new BinaryOperationResult();

            this.StatusCode = response.StatusCode;
            if (response.StatusCode == 0)
            {
                return(result.Pass());
            }
            else
            {
                var message = ResultHelper.ProcessResponseData(response.Data);
                return(result.Fail(message));
            }
        }
コード例 #32
0
        protected internal override IOperationResult ReadResponse(IPooledSocket socket)
        {
            var response = new BinaryResponse();
            var retval = response.Read(socket);

            this.StatusCode = StatusCode;
            var result = new BinaryOperationResult()
            {
                Success = retval,
                StatusCode = this.StatusCode
            };

            result.PassOrFail(retval, "Failed to read response");
            return result;
        }
コード例 #33
0
        protected internal override IOperationResult ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            var success  = response.Read(socket);

            this.StatusCode = response.StatusCode;
            this.Data       = response.Data.Array;

            var result = new BinaryOperationResult
            {
                StatusCode = this.StatusCode
            };

            result.PassOrFail(success, "Failed to read response");
            return(result);
        }
コード例 #34
0
        protected internal override async ValueTask <IOperationResult> ReadResponseAsync(PooledSocket socket)
        {
            var response = new BinaryResponse();

            var retval = await response.ReadAsync(socket);

            this.StatusCode = response.StatusCode;
            this.Data       = response.Data.Array;

            var result = new BinaryOperationResult
            {
                StatusCode = this.StatusCode
            };

            result.PassOrFail(retval, "Failed to read response");
            return(result);
        }
コード例 #35
0
        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var status = response.StatusCode;
            var result = new BinaryOperationResult();

            this.StatusCode = status;

            if (status == 0)
            {
                this.Cas = response.CAS;
                return result.Pass();
            }

            this.Cas = 0;
            var message = ResultHelper.ProcessResponseData(response.Data);
            return result.Fail(message);
        }
コード例 #36
0
ファイル: SaslStep.cs プロジェクト: javithalion/NCache
		protected internal override IOperationResult ReadResponse(PooledSocket socket)
		{
			var response = new BinaryResponse();

			var retval = response.Read(socket);

			this.StatusCode = response.StatusCode;
			this.Data = response.Data.Array;

			var result = new BinaryOperationResult
			{
				StatusCode = this.StatusCode
			};

			result.PassOrFail(retval, "Failed to read response");
			return result;
		}
コード例 #37
0
        protected override bool ProcessResponse(BinaryResponse response)
        {
            if (response.StatusCode == 0)
            {
                var data = response.Data;
                if (data.Count != 8)
                {
                    throw new InvalidOperationException("result must be 8 bytes long, received: " + data.Count);
                }

                this.result = BinaryConverter.DecodeUInt64(data.Array, data.Offset);

                return(true);
            }

            return(false);
        }
コード例 #38
0
        protected override bool ProcessResponse(BinaryResponse response)
        {
#if EVEN_MORE_LOGGING
            if (log.IsDebugEnabled)
            {
                if (response.StatusCode == 0)
                {
                    log.DebugFormat("Delete succeeded for key '{0}'.", this.Key);
                }
                else
                {
                    log.DebugFormat("Delete failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
                }
            }
#endif

            return(true);
        }
コード例 #39
0
        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var status = response.StatusCode;
            var result = new BinaryOperationResult();

            this.StatusCode = status;
            if (status == 0)
            {
                int flags = BinaryConverter.DecodeInt32(response.Extra, 0);
                this.result = new CacheItem((ushort)flags, response.Data);
                this.Cas    = response.CAS;

                return(result.Pass());
            }

            this.Cas = 0;
            return(result.Fail(OperationResultHelper.ProcessResponseData(response.Data)));
        }
コード例 #40
0
        protected internal override IOperationResult ReadResponse(PooledSocket socket)
        {
            this.result = new Dictionary <string, CacheItem>();
            this.Cas    = new Dictionary <string, ulong>();
            var result = new TextOperationResult();

            var response = new BinaryResponse();

            while (response.Read(socket))
            {
                this.StatusCode = response.StatusCode;

                // found the noop, quit
                if (response.CorrelationId == this.noopId)
                {
                    return(result.Pass());
                }

                string key;

                // find the key to the response
                if (!this.idToKey.TryGetValue(response.CorrelationId, out key))
                {
                    // we're not supposed to get here tho
                    log.WarnFormat("Found response with CorrelationId {0}, but no key is matching it.", response.CorrelationId);
                    continue;
                }

                if (log.IsDebugEnabled)
                {
                    log.DebugFormat("Reading item {0}", key);
                }

                // deserialize the response
                int flags = BinaryConverter.DecodeInt32(response.Extra, 0);

                this.result[key] = new CacheItem((ushort)flags, response.Data);
                this.Cas[key]    = response.CAS;
            }

            // finished reading but we did not find the NOOP
            return(result.Fail("Found response with CorrelationId {0}, but no key is matching it."));
        }
コード例 #41
0
 protected override IOperationResult ProcessResponse(BinaryResponse response)
 {
     var result = new BinaryOperationResult();
     #if EVEN_MORE_LOGGING
     if (log.IsDebugEnabled)
         if (response.StatusCode == 0)
             log.DebugFormat("Delete succeeded for key '{0}'.", this.Key);
         else
             log.DebugFormat("Delete failed for key '{0}'. Reason: {1}", this.Key, Encoding.ASCII.GetString(response.Data.Array, response.Data.Offset, response.Data.Count));
     #endif
     if (response.StatusCode == 0)
     {
         return result.Pass();
     }
     else
     {
         var message = ResultHelper.ProcessResponseData("Delete failed for key " + Key, response.Data);
         return result.Fail(message);
     }
 }
コード例 #42
0
        protected override IOperationResult ProcessResponse(BinaryResponse response)
        {
            var result = new BinaryOperationResult();
            var status = response.StatusCode;
            this.StatusCode = status;

            if (status == 0)
            {
                var data = response.Data;
                if (data.Count != 8)
                    return result.Fail("Result must be 8 bytes long, received: " + data.Count, new InvalidOperationException());

                this.result = BinaryConverter.DecodeUInt64(data.Array, data.Offset);

                return result.Pass();
            }

            var message = ResultHelper.ProcessResponseData("Mutate failed for key " + Key, response.Data);
            return result.Fail(message);
        }
コード例 #43
0
        protected internal override bool ReadResponse(PooledSocket socket)
        {
            var response   = new BinaryResponse();
            var serverData = new Dictionary <string, string>();
            var retval     = false;

            while (response.Read(socket) && response.KeyLength > 0)
            {
                retval = true;

                var data  = response.Data;
                var key   = BinaryConverter.DecodeKey(data.Array, data.Offset, response.KeyLength);
                var value = BinaryConverter.DecodeKey(data.Array, data.Offset + response.KeyLength, data.Count - response.KeyLength);

                serverData[key] = value;
            }

            this.result = serverData;

            return(retval);
        }
コード例 #44
0
		protected internal override bool ReadResponse(PooledSocket socket)
		{
			var response = new BinaryResponse();
			var serverData = new Dictionary<string, string>();
			var retval = false;

			while (response.Read(socket) && response.KeyLength > 0)
			{
				retval = true;

				var data = response.Data;
				var key = BinaryConverter.DecodeKey(data.Array, data.Offset, response.KeyLength);
				var value = BinaryConverter.DecodeKey(data.Array, data.Offset + response.KeyLength, data.Count - response.KeyLength);

				serverData[key] = value;
			}

			this.result = serverData;

			return retval;
		}
コード例 #45
0
		protected internal override IOperationResult ReadResponse(PooledSocket socket)
		{
			var response = new BinaryResponse();
			var retval = response.Read(socket);
			
			this.Cas = response.CAS;
			this.StatusCode = response.StatusCode;

			var result = new BinaryOperationResult()
			{
				Success = retval,
				Cas = this.Cas,
				StatusCode = this.StatusCode
			};

			IOperationResult responseResult;
			if (! (responseResult = this.ProcessResponse(response)).Success)
			{
				result.InnerResult = responseResult;
				responseResult.Combine(result);
			}
			
			return result;
		}
コード例 #46
0
        private void StoreResult(BinaryResponse reader)
        {
            string key;

            // find the key to the response
            if (!this.idToKey.TryGetValue(reader.CorrelationId, out key))
            {
                // we're not supposed to get here tho
                log.WarnFormat("Found response with CorrelationId {0}, but no key is matching it.", reader.CorrelationId);
            }
            else
            {
                if (log.IsDebugEnabled)
                {
                    log.DebugFormat("Reading item {0}", key);
                }

                // deserialize the response
                var flags = (ushort)BinaryConverter.DecodeInt32(reader.Extra, 0);

                this.result[key] = new CacheItem(flags, reader.Data);
                this.Cas[key]    = reader.CAS;
            }
        }
コード例 #47
0
        protected override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            if (response.Read(socket))
            {
                this.Result = DecodeResult(response.Data);

                return true;
            }

            return false;
        }
コード例 #48
0
		private void StoreResult(BinaryResponse reader)
		{
			string key;

			// find the key to the response
			if (!this.idToKey.TryGetValue(reader.CorrelationId, out key))
			{
				// we're not supposed to get here tho
				log.WarnFormat("Found response with CorrelationId {0}, but no key is matching it.", reader.CorrelationId);
			}
			else
			{
				if (log.IsDebugEnabled) log.DebugFormat("Reading item {0}", key);

				// deserialize the response
				var flags = (ushort)BinaryConverter.DecodeInt32(reader.Extra, 0);

				this.result[key] = new CacheItem(flags, reader.Data);
				this.Cas[key] = reader.CAS;
			}
		}
コード例 #49
0
        internal static bool GuessResponseState(BinaryResponse response, out OperationState state)
        {
            switch (response.StatusCode)
            {
                case 0: state = OperationState.Success;
                    return true;
                case 7: state = OperationState.InvalidVBucket;
                    break;
                default: state = OperationState.Failure;
                    break;
            }

            return false;
        }
コード例 #50
0
        protected internal override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();

            return(response.Read(socket));
        }
コード例 #51
0
        protected override IOperationResult ReadResponse(IPooledSocket socket)
        {
            var response = new BinaryResponse();
            var result = new BinaryOperationResult();

            if (response.Read(socket))
            {
                this.Result = DecodeResult(response.Data);

                result.Pass();
                return result;
            }

            result.Fail("Processing of response failed");
            return result;
        }
コード例 #52
0
 protected abstract bool ProcessResponse(BinaryResponse response);
コード例 #53
0
        protected override bool ReadResponseAsync(IPooledSocket socket, Action<bool> next)
        {
            var response = new BinaryResponse();

            bool ioPending;
            var retval = response.ReadAsync(socket, (readSuccess) =>
                            {
                                if (readSuccess) this.DecodeResult(response.Data);
                                next(readSuccess);
                            }, out ioPending);

            if (!ioPending && retval)
                this.Result = this.DecodeResult(response.Data);

            return retval;
        }
コード例 #54
0
            protected override bool ProcessResponse(BinaryResponse response)
            {
                base.ProcessResponse(response);

                if (!GuessResponseState(response, out this.state))
                    return false;

                return true;
            }
コード例 #55
0
            protected override IOperationResult ProcessResponse(BinaryResponse response)
            {
                base.ProcessResponse(response);
                var result = new BinaryOperationResult();

                if (!GuessResponseState(response, out this.state))
                {
                    var message = ResultHelper.ProcessResponseData(response.Data, "Failed to process response");
                    return result.Fail(message);
                }

                return result.Pass();
            }
コード例 #56
0
		protected abstract IOperationResult ProcessResponse(BinaryResponse response);
コード例 #57
0
 protected abstract IOperationResult ProcessResponse(BinaryResponse response);
コード例 #58
0
 protected override IOperationResult ProcessResponse(BinaryResponse response)
 {
     return new BinaryOperationResult() { Success = true };
 }
コード例 #59
0
		protected override bool ProcessResponse(BinaryResponse response)
		{
			return true;
		}
コード例 #60
0
 protected abstract bool ProcessResponse(BinaryResponse response);