public override BucketConfig GetValue() { BucketConfig bucketConfig = null; if (Success && Data != null) { try { var buffer = Data.ToArray(); ReadExtras(buffer); var offset = Header.BodyOffset; var length = TotalLength - Header.BodyOffset; var json = Transcoder.Decode <string>(buffer, offset, length, Flags, OperationCode); if (_endpoint != null) { json = json.Replace("$HOST", _endpoint.Address.ToString()); } bucketConfig = JsonConvert.DeserializeObject <BucketConfig>(json); } catch (Exception e) { Exception = e; HandleClientError(e.Message, ResponseStatus.ClientFailure); } } return(bucketConfig); }
public virtual T GetValue() { var result = default(T); if (Data.Length > 0) { try { var buffer = Data; ReadExtras(buffer.Span); var offset = Header.BodyOffset; var length = Header.TotalLength - Header.BodyOffset; if ((Header.DataType & DataType.Snappy) != DataType.None) { using var decompressed = OperationCompressor.Decompress(buffer.Slice(offset, length), Span); result = Transcoder.Decode <T>(decompressed.Memory, Flags, OpCode); } else { result = Transcoder.Decode <T>(buffer.Slice(offset, length), Flags, OpCode); } } catch (Exception e) { Exception = e; HandleClientError(e.Message, ResponseStatus.ClientFailure); } } return(result); }
public virtual IBucketConfig GetConfig() { IBucketConfig config = null; if (GetResponseStatus() == ResponseStatus.VBucketBelongsToAnotherServer) { var offset = HeaderLength + Header.ExtrasLength; var length = Header.BodyLength - Header.ExtrasLength; //Override any flags settings since the body of the response has changed to a config config = Transcoder.Decode <BucketConfig>(Data.ToArray(), offset, length, new Flags { Compression = Compression.None, DataFormat = DataFormat.Json, TypeCode = TypeCode.Object }); } return(config); }
public override uint?GetValue() { if (Data.Length > 0) { try { var buffer = Data; ReadExtras(buffer.Span); return(Transcoder.Decode <uint>(buffer.Slice(31, 4), Flags, OpCode.GetCidByName)); } catch (Exception e) { Exception = e; HandleClientError(e.Message, ResponseStatus.ClientFailure); } } return(0u); }
public virtual T GetValue() { var result = default(T); if (Success && Data != null) { try { var buffer = Data.ToArray(); ReadExtras(buffer); result = Transcoder.Decode <T>(buffer, BodyOffset, TotalLength - BodyOffset, Flags); } catch (Exception e) { Exception = e; HandleClientError(e.Message); } } return(result); }
public virtual T GetValue() { var result = default(T); if (Success && Data != null && Data.Length > 0) { try { var buffer = Data.ToArray(); ReadExtras(buffer); var offset = 24 + Header.KeyLength + Header.ExtrasLength; result = Transcoder.Decode <T>(buffer, offset, TotalLength - offset, Flags, OperationCode); } catch (Exception e) { Exception = e; HandleClientError(e.Message, ResponseStatus.ClientFailure); } } return(result); }
public virtual T GetValue() { var result = default(T); if (Data.Length > 0) { try { var buffer = Data; ReadExtras(buffer.Span); var offset = Header.BodyOffset; var length = Header.TotalLength - Header.BodyOffset; result = Transcoder.Decode <T>(buffer.Slice(offset, length), Flags, OpCode); } catch (Exception e) { Exception = e; HandleClientError(e.Message, ResponseStatus.ClientFailure); } } return(result); }
public override BucketConfig GetValue() { BucketConfig bucketConfig = null; if (Success && Data.Length > 0) { try { var buffer = Data; ReadExtras(buffer.Span); var offset = Header.BodyOffset; var length = TotalLength - Header.BodyOffset; bucketConfig = Transcoder.Decode <BucketConfig>(buffer.Slice(offset, length), Flags, OpCode); } catch (Exception e) { Exception = e; HandleClientError(e.Message, ResponseStatus.ClientFailure); } } return(bucketConfig); }