2323import static com .alipay .oceanbase .rpc .util .Serialization .encodeObUniVersionHeader ;
2424
2525public class ObHBaseParams extends ObKVParamsBase {
26- int caching = -1 ; // 限制scan返回的行的数量
27- int callTimeout = -1 ; // scannerLeasePeriodTimeout,代表客户端scan的单个rpc超时时间以及服务端的scan的超时时间的一部分
28- boolean allowPartialResults = true ; // 是否允许行内部分返回
29- boolean isCacheBlock = false ; // 是否启用缓存
30- boolean checkExistenceOnly = false ; // 查看是否存在不返回数据
26+ int caching = -1 ; // limit the number of for each rpc call
27+ int callTimeout = -1 ; // scannerLeasePeriodTimeout in hbase, client rpc timeout
28+ boolean allowPartialResults = true ; // whether allow partial row return or not
29+ boolean isCacheBlock = false ; // whether enable server block cache and row cache or not
30+ boolean checkExistenceOnly = false ; // check the existence only
31+
32+ private static final int FLAG_ALLOW_PARTIAL_RESULTS = 1 << 0 ;
33+ private static final int FLAG_IS_CACHE_BLOCK = 1 << 1 ;
34+ private static final int FLAG_CHECK_EXISTENCE_ONLY = 1 << 2 ;
3135
3236 public ObHBaseParams () {
3337 pType = paramType .HBase ;
@@ -87,11 +91,11 @@ public byte[] booleansToByteArray() {
8791 byte [] bytes = new byte [1 ]; // 1 byte for 4 booleans
8892
8993 if (allowPartialResults )
90- bytes [0 ] |= 0x01 ; // 00000010
94+ bytes [0 ] |= FLAG_ALLOW_PARTIAL_RESULTS ;
9195 if (isCacheBlock )
92- bytes [0 ] |= 0x02 ; // 00000100
96+ bytes [0 ] |= FLAG_IS_CACHE_BLOCK ;
9397 if (checkExistenceOnly )
94- bytes [0 ] |= 0x04 ; // 00001000
98+ bytes [0 ] |= FLAG_CHECK_EXISTENCE_ONLY ;
9599
96100 return bytes ;
97101 }
@@ -117,9 +121,9 @@ public byte[] encode() {
117121
118122 public void byteArrayToBooleans (ByteBuf bytes ) {
119123 byte b = bytes .readByte ();
120- allowPartialResults = (b & 0x01 ) != 0 ;
121- isCacheBlock = (b & 0x02 ) != 0 ;
122- checkExistenceOnly = (b & 0x04 ) != 0 ;
124+ allowPartialResults = (b & FLAG_ALLOW_PARTIAL_RESULTS ) != 0 ;
125+ isCacheBlock = (b & FLAG_IS_CACHE_BLOCK ) != 0 ;
126+ checkExistenceOnly = (b & FLAG_CHECK_EXISTENCE_ONLY ) != 0 ;
123127 }
124128
125129 public Object decode (ByteBuf buf ) {
0 commit comments