Exemplo n.º 1
0
        /// <summary>
        /// Creates the <see cref="OperationBody"/> of the current operation in progress.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="operation"></param>
        /// <param name="state"></param>
        static void CreateBody <T>(IOperation <T> operation, OperationAsyncState state)
        {
            var buffer = state.Data.GetBuffer();

            operation.Body = new OperationBody
            {
                Extras = new ArraySegment <byte>(buffer, OperationBase <T> .HeaderLength, operation.Header.ExtrasLength).Array,
                Data   = new ArraySegment <byte>(buffer, 28, operation.Header.BodyLength).Array,
            };
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates an <see cref="OperationHeader"/> for the current operation in progress.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="operation"></param>
        /// <param name="state"></param>
        void CreateHeader <T>(IOperation <T> operation, OperationAsyncState state)
        {
            var buffer = state.Data.GetBuffer();

            if (buffer.Length > 0)
            {
                operation.Header = new OperationHeader
                {
                    Magic         = _converter.ToByte(buffer, HeaderIndexFor.Magic),
                    OperationCode = _converter.ToByte(buffer, HeaderIndexFor.Opcode).ToOpCode(),
                    KeyLength     = _converter.ToInt16(buffer, HeaderIndexFor.KeyLength),
                    ExtrasLength  = _converter.ToByte(buffer, HeaderIndexFor.ExtrasLength),
                    Status        = (ResponseStatus)_converter.ToInt16(buffer, HeaderIndexFor.Status),
                    BodyLength    = _converter.ToInt32(buffer, HeaderIndexFor.Body),
                    Opaque        = _converter.ToUInt32(buffer, HeaderIndexFor.Opaque),
                    Cas           = _converter.ToUInt64(buffer, HeaderIndexFor.Cas)
                };
            }
        }
Exemplo n.º 3
0
 public void Receive(byte[] buffer, int offset, int length, Strategies.Awaitable.OperationAsyncState state)
 {
     throw new NotImplementedException();
 }