/*
 * Copyright (c) 2014-2015 Spotify AB
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.spotify.folsom;

import java.io.IOException;

public enum MemcacheStatus {
  OK,
  KEY_NOT_FOUND,
  KEY_EXISTS,
  VALUE_TOO_LARGE,
  INVALID_ARGUMENTS,
  ITEM_NOT_STORED;

  public static MemcacheStatus fromInt(final int status) throws IOException {
    switch (status) {
      case 0: return OK;
      case 1: return KEY_NOT_FOUND;
      case 2: return KEY_EXISTS;
      case 3: return VALUE_TOO_LARGE;
      case 4: return INVALID_ARGUMENTS;
      case 5: return ITEM_NOT_STORED;
      default: throw new IOException(String.format("Unknown status code: 0x%2x", status));
    }
  }
}

@@ -655,131 +655,481 @@
 n;%0A%0A
-public enum MemcacheStatus %7B%0A  OK,%0A  KEY_NOT_FOUND,%0A  KEY_EXISTS,%0A  VALUE_TOO_LARGE,%0A  INVALID_ARGUMENTS,%0A  ITEM_NOT_STORED
+/**%0A * Response status codes from%0A * https://github.com/memcached/memcached/wiki/BinaryProtocolRevamped#response-status%0A */%0Apublic enum MemcacheStatus %7B%0A  OK,%0A  KEY_NOT_FOUND,%0A  KEY_EXISTS,%0A  VALUE_TOO_LARGE,%0A  INVALID_ARGUMENTS,%0A  ITEM_NOT_STORED,%0A  INCR_DECR_ON_NON_NUMERIC_VALUE,%0A  THE_VBUCKET_BELONGS_TO_ANOTHER_SERVER,%0A  AUTHENTICATION_ERROR,%0A  AUTHENTICATION_CONTINUE,%0A  UNKNOWN_COMMAND,%0A  OUT_OF_MEMORY,%0A  NOT_SUPPORTED,%0A  INTERNAL_ERROR,%0A  BUSY,%0A  TEMPORARY_FAILURE
 ;%0A%0A 
@@ -1238,16 +1238,19 @@
    case 
+0x0
 0: retur
@@ -1266,16 +1266,19 @@
    case 
+0x0
 1: retur
@@ -1305,16 +1305,19 @@
    case 
+0x0
 2: retur
@@ -1341,16 +1341,19 @@
    case 
+0x0
 3: retur
@@ -1382,16 +1382,19 @@
    case 
+0x0
 4: retur
@@ -1425,16 +1425,19 @@
    case 
+0x0
 5: retur
@@ -1455,16 +1455,462 @@
 STORED;%0A
+      case 0x06: return INCR_DECR_ON_NON_NUMERIC_VALUE;%0A      case 0x07: return THE_VBUCKET_BELONGS_TO_ANOTHER_SERVER;%0A      case 0x08: return AUTHENTICATION_ERROR;%0A      case 0x09: return AUTHENTICATION_CONTINUE;%0A      case 0x81: return UNKNOWN_COMMAND;%0A      case 0x82: return OUT_OF_MEMORY;%0A      case 0x83: return NOT_SUPPORTED;%0A      case 0x84: return INTERNAL_ERROR;%0A      case 0x85: return BUSY;%0A      case 0x86: return TEMPORARY_FAILURE;%0A
       de

Add additional response status codes