MCPcopy Create free account
hub / github.com/bytedance/terarkdb / Status

Class Status

java/src/main/java/org/rocksdb/Status.java:14–138  ·  view source on GitHub ↗

Represents the status returned by a function call in RocksDB. Currently only used with RocksDBException when the status is not Code#Ok

Source from the content-addressed store, hash-verified

12 * status is not {@link Code#Ok}
13 */
14public class Status {
15 private final Code code;
16 /* @Nullable */ private final SubCode subCode;
17 /* @Nullable */ private final String state;
18
19 public Status(final Code code, final SubCode subCode, final String state) {
20 this.code = code;
21 this.subCode = subCode;
22 this.state = state;
23 }
24
25 /**
26 * Intentionally private as this will be called from JNI
27 */
28 private Status(final byte code, final byte subCode, final String state) {
29 this.code = Code.getCode(code);
30 this.subCode = SubCode.getSubCode(subCode);
31 this.state = state;
32 }
33
34 public Code getCode() {
35 return code;
36 }
37
38 public SubCode getSubCode() {
39 return subCode;
40 }
41
42 public String getState() {
43 return state;
44 }
45
46 public String getCodeString() {
47 final StringBuilder builder = new StringBuilder()
48 .append(code.name());
49 if(subCode != null && subCode != SubCode.None) {
50 builder.append("(")
51 .append(subCode.name())
52 .append(")");
53 }
54 return builder.toString();
55 }
56
57 // should stay in sync with /include/rocksdb/status.h:Code and /java/rocksjni/portal.h:toJavaStatusCode
58 public enum Code {
59 Ok( (byte)0x0),
60 NotFound( (byte)0x1),
61 Corruption( (byte)0x2),
62 NotSupported( (byte)0x3),
63 InvalidArgument( (byte)0x4),
64 IOError( (byte)0x5),
65 MergeInProgress( (byte)0x6),
66 Incomplete( (byte)0x7),
67 ShutdownInProgress( (byte)0x8),
68 TimedOut( (byte)0x9),
69 Aborted( (byte)0xA),
70 Busy( (byte)0xB),
71 Expired( (byte)0xC),

Callers 15

PutCFMethod · 0.50
MergeCFMethod · 0.50
DeleteCFMethod · 0.50
SingleDeleteCFMethod · 0.50
DeleteRangeCFMethod · 0.50
MarkBeginPrepareMethod · 0.50
MarkEndPrepareMethod · 0.50
MarkNoopMethod · 0.50
MarkRollbackMethod · 0.50
MarkCommitMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected