Esempio n. 1
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 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");
        }
        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. 4
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;
		}