1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.omid.committable.hbase;
19
20 import com.google.inject.Inject;
21 import com.google.inject.name.Named;
22 import org.apache.hadoop.hbase.util.Bytes;
23
24 import static com.google.common.base.Charsets.UTF_8;
25
26 public class HBaseCommitTableConfig {
27
28 public static final String COMMIT_TABLE_NAME_KEY = "omid.committable.tablename";
29 public static final String COMMIT_TABLE_CF_NAME_KEY = "omid.committable.cfname";
30 public static final String COMMIT_TABLE_LWM_CF_NAME_KEY = "omid.committable.lwm.cfname";
31
32 public static final String DEFAULT_COMMIT_TABLE_NAME = "OMID_COMMIT_TABLE";
33 public static final String DEFAULT_COMMIT_TABLE_CF_NAME = "F";
34 public static final String DEFAULT_COMMIT_TABLE_LWM_CF_NAME = "LWF";
35
36 static final byte[] COMMIT_TABLE_QUALIFIER = "C".getBytes(UTF_8);
37 static final byte[] INVALID_TX_QUALIFIER = "IT".getBytes(UTF_8);
38 static final byte[] LOW_WATERMARK_QUALIFIER = "LWC".getBytes(UTF_8);
39 static final byte[] LOW_WATERMARK_ROW = "LOW_WATERMARK".getBytes(UTF_8);
40
41
42
43
44
45 private String tableName = DEFAULT_COMMIT_TABLE_NAME;
46 private byte[] commitTableFamily = Bytes.toBytes(DEFAULT_COMMIT_TABLE_CF_NAME);
47 private byte[] lowWatermarkFamily = Bytes.toBytes(DEFAULT_COMMIT_TABLE_LWM_CF_NAME);
48
49
50
51
52
53 public String getTableName() {
54 return tableName;
55 }
56
57
58 @Inject(optional = true)
59 public void setTableName(@Named(COMMIT_TABLE_NAME_KEY) String tableName) {
60 this.tableName = tableName;
61 }
62
63 public byte[] getCommitTableFamily() {
64 return commitTableFamily;
65 }
66
67
68 @Inject(optional = true)
69 public void setCommitTableFamily(@Named(COMMIT_TABLE_CF_NAME_KEY) String commitTableFamily) {
70 this.commitTableFamily = commitTableFamily.getBytes(UTF_8);
71 }
72
73 public byte[] getLowWatermarkFamily() {
74 return lowWatermarkFamily;
75 }
76
77 @Inject(optional = true)
78 public void setLowWatermarkFamily(@Named(COMMIT_TABLE_LWM_CF_NAME_KEY) String lowWatermarkFamily) {
79 this.lowWatermarkFamily = lowWatermarkFamily.getBytes(UTF_8);
80 }
81
82 }