Read() public method

public Read ( PooledSocket socket ) : bool
socket PooledSocket
return bool
Esempio n. 1
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);
        }
Esempio n. 2
0
		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;
		}
		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;
		}
        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);
        }
        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);
        }
        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));
        }
        protected internal override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            var retval   = response.Read(socket);

            this.StatusCode = StatusCode;

            return(retval);
        }
Esempio n. 8
0
        protected internal override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            var retval = response.Read(socket);

            this.StatusCode = StatusCode;

            return retval;
        }
Esempio n. 9
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;
		}
Esempio n. 10
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);
        }
        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;
        }
Esempio n. 12
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);
        }
Esempio n. 13
0
		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;
		}
Esempio n. 14
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."));
        }
		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;
		}
Esempio n. 16
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);
        }
		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;
		}
        protected internal override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();

            return response.Read(socket);
        }
Esempio n. 19
0
        protected override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();
            if (response.Read(socket))
            {
                this.Result = DecodeResult(response.Data);

                return true;
            }

            return false;
        }
        protected internal override bool ReadResponse(PooledSocket socket)
        {
            var response = new BinaryResponse();

            return(response.Read(socket));
        }
Esempio n. 21
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;
        }