1 // Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
2 //  This source code is licensed under both the GPLv2 (found in the
3 //  COPYING file in the root directory) and Apache 2.0 License
4 //  (found in the LICENSE.Apache file in the root directory).
5 
6 package org.rocksdb;
7 
8 public enum WalProcessingOption {
9   /**
10    * Continue processing as usual.
11    */
12   CONTINUE_PROCESSING((byte)0x0),
13 
14   /**
15    * Ignore the current record but continue processing of log(s).
16    */
17   IGNORE_CURRENT_RECORD((byte)0x1),
18 
19   /**
20    * Stop replay of logs and discard logs.
21    * Logs won't be replayed on subsequent recovery.
22    */
23   STOP_REPLAY((byte)0x2),
24 
25   /**
26    * Corrupted record detected by filter.
27    */
28   CORRUPTED_RECORD((byte)0x3);
29 
30   private final byte value;
31 
WalProcessingOption(final byte value)32   WalProcessingOption(final byte value) {
33     this.value = value;
34   }
35 
36   /**
37    * Get the internal representation.
38    *
39    * @return the internal representation.
40    */
getValue()41   byte getValue() {
42     return value;
43   }
44 
fromValue(final byte value)45   public static WalProcessingOption fromValue(final byte value) {
46     for (final WalProcessingOption walProcessingOption : WalProcessingOption.values()) {
47       if (walProcessingOption.value == value) {
48         return walProcessingOption;
49       }
50     }
51     throw new IllegalArgumentException(
52         "Illegal value provided for WalProcessingOption: " + value);
53   }
54 }
55