All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xiaomi.infra.galaxy.sds.thrift.ConsistencyLevel Maven / Gradle / Ivy

/**
 * Autogenerated by Thrift Compiler (0.9.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.xiaomi.infra.galaxy.sds.thrift;


import java.util.Map;
import java.util.HashMap;
import libthrift091.TEnum;

/**
 * 数据一致性级别
 */
public enum ConsistencyLevel implements libthrift091.TEnum {
  /**
   * 强一致性
   * 系统保证数据写入返回成功之后,一定能立即读到一致的数据
   */
  STRONG(0),
  /**
   * 最终一致性
   * 系统保证数据在写入成功一定时间之后,可以读到一致的数据
   */
  EVENTUAL(1),
  /**
   * 弱一致性
   * 系统本身不保证严格的一致性,即调用失败时写入的数据(例如主数据和索引)状态可能是不一致的,需要客户端在调用返回失败时重试(需要由开发者保证操作的幂等性)
   * 可采用WEAK+IMMUTABLE+失败客户端重试组合保证数据写入的高效性和强一致性)
   */
  WEAK(2);

  private final int value;

  private ConsistencyLevel(int value) {
    this.value = value;
  }

  /**
   * Get the integer value of this enum value, as defined in the Thrift IDL.
   */
  public int getValue() {
    return value;
  }

  /**
   * Find a the enum type by its integer value, as defined in the Thrift IDL.
   * @return null if the value is not found.
   */
  public static ConsistencyLevel findByValue(int value) { 
    switch (value) {
      case 0:
        return STRONG;
      case 1:
        return EVENTUAL;
      case 2:
        return WEAK;
      default:
        return null;
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy