public static byte[] BuildQuitResponse(QuitCommand command)
        {
            if (command.NoReply == true)
                return null;

            return BuildResposne(command.Opcode, BinaryResponseStatus.no_error, command.Opaque, 0, null, null, null);
        }
        void Build()
        {
            switch (_requestHeader.Opcode)
            {
                //Get command
                case Opcode.Get:
                //GetK command
                case Opcode.GetK:
                    CreateGetCommand(_requestHeader.Opcode, false);
                    break;

                //Set command
                case Opcode.Set:
                //Add command
                case Opcode.Add:
                //Replace command
                case Opcode.Replace:
                //Append command
                case Opcode.Append:
                //Prepend command
                case Opcode.Prepend:
                    CreateStorageCommand(_requestHeader.Opcode, false);
                    break;

                //Delete command
                case Opcode.Delete:
                    CreateDeleteCommand(_requestHeader.Opcode, false);
                    break;

                //Increment command
                case Opcode.Increment:
                //Decrement command
                case Opcode.Decrement:
                    CreateCounterCommand(_requestHeader.Opcode, false);
                    break;

                //Quit command
                case Opcode.Quit:
                    _command = new QuitCommand(_requestHeader.Opcode);
                    break;

                //Flush command
                case Opcode.Flush:
                    CreateFlushCommand(_requestHeader.Opcode,false);
                    break;

                //GetQ command
                case Opcode.GetQ:
                //GetKQ command
                case Opcode.GetKQ:
                    CreateGetCommand(_requestHeader.Opcode, true);
                    break;

                //No-op command
                case Opcode.No_op:
                    _command = new NoOperationCommand();
                    break;

                //Version command
                case Opcode.Version:
                    CreateVersionCommand();
                    break;

                //Stat command
                case Opcode.Stat:
                    CreateStatsCommand();
                    break;

                //SetQ command
                case Opcode.SetQ:
                //AddQ command
                case Opcode.AddQ:
                //ReplaceQ command
                case Opcode.ReplaceQ:
                //AppendQ command
                case Opcode.AppendQ:
                //PrependQ command
                case Opcode.PrependQ:
                    CreateStorageCommand(_requestHeader.Opcode, true);
                    break;

                //DeleteQ command
                case Opcode.DeleteQ:
                    CreateDeleteCommand(_requestHeader.Opcode,true);
                    break;

                //IncrementQ command
                case Opcode.IncrementQ:
                //DecrementQ command
                case Opcode.DecrementQ:
                    CreateCounterCommand(_requestHeader.Opcode, true);
                    break;

                //QuitQ command
                case Opcode.QuitQ:
                    _command = new QuitCommand(_requestHeader.Opcode);
                    _command.NoReply = true;
                    break;

                //FlushQ command
                case Opcode.FlushQ:
                    CreateFlushCommand(_requestHeader.Opcode, true);
                    break;

                default:
                    CreateInvalidCommand();
                    _command.Opcode = Opcode.unknown_command;
                    break;
            }

            _command.Opaque = _requestHeader.Opaque;

            this.State = ParserState.ReadyToDispatch;
        }
Example #3
0
 private void CreateQuitCommand()
 {
     _command = new QuitCommand(Opcode.Quit);
     this.State = ParserState.ReadyToDispatch;
 }