1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.tikv.txn;
19
20 import org.tikv.kvproto.Kvrpcpb;
21
22
23
24
25
26
27 public class TxnStatus {
28 private long ttl;
29 private long commitTS;
30 private Kvrpcpb.Action action;
31
32 public TxnStatus() {
33 this.ttl = 0L;
34 this.commitTS = 0L;
35 this.action = Kvrpcpb.Action.UNRECOGNIZED;
36 }
37
38 public TxnStatus(long ttl) {
39 this.ttl = ttl;
40 this.commitTS = 0L;
41 this.action = Kvrpcpb.Action.UNRECOGNIZED;
42 }
43
44 public TxnStatus(long ttl, long commitTS) {
45 this.ttl = ttl;
46 this.commitTS = commitTS;
47 this.action = Kvrpcpb.Action.UNRECOGNIZED;
48 }
49
50 public TxnStatus(long ttl, long commitTS, Kvrpcpb.Action action) {
51 this.ttl = ttl;
52 this.commitTS = commitTS;
53 this.action = action;
54 }
55
56 public long getTtl() {
57 return ttl;
58 }
59
60 public void setTtl(long ttl) {
61 this.ttl = ttl;
62 }
63
64 public long getCommitTS() {
65 return commitTS;
66 }
67
68 public void setCommitTS(long commitTS) {
69 this.commitTS = commitTS;
70 }
71
72 public boolean isCommitted() {
73 return ttl == 0 && commitTS > 0;
74 }
75
76 public Kvrpcpb.Action getAction() {
77 return action;
78 }
79
80 public void setAction(Kvrpcpb.Action action) {
81 this.action = action;
82 }
83 }