Skip to content

Commit 8c0b036

Browse files
authored
chore: update status code (#53)
1 parent b0cfed4 commit 8c0b036

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

ingester-protocol/src/main/java/io/greptime/Status.java

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
/**
2323
* Common status code for public API.
24+
* <p>
25+
* Always follow <a href="https://github.com/GreptimeTeam/greptimedb/blob/main/src/common/error/src/status_code.rs">GreptimeDB's STATUS CODE</a>
2426
*/
2527
public enum Status {
2628
// ====== Begin of common status code ==============
@@ -37,8 +39,12 @@ public enum Status {
3739
Internal(1003, true),
3840
// Invalid arguments.
3941
InvalidArguments(1004),
40-
// / The task is cancelled.
42+
// The task is cancelled.
4143
Cancelled(1005),
44+
// Illegal state.
45+
IllegalState(1006),
46+
// Caused by some error originated from external system.
47+
External(1007),
4248
// ====== End of common status code ================
4349

4450
// ====== Begin of SQL related status code =========
@@ -56,18 +62,35 @@ public enum Status {
5662
// ====== Begin of catalog related status code =====
5763
// Table already exists.
5864
TableAlreadyExists(4000),
65+
// Table not found.
5966
TableNotFound(4001),
67+
// Table column not found.
6068
TableColumnNotFound(4002),
69+
// Table column already exists.
6170
TableColumnExists(4003),
71+
// Database not found.
6272
DatabaseNotFound(4004),
73+
// Region not found.
6374
RegionNotFound(4005),
75+
// Region already exists.
6476
RegionAlreadyExists(4006),
77+
// Region is read-only in current state.
6578
RegionReadonly(4007),
79+
// Region is not in a proper state to handle specific request.
80+
RegionNotReady(4008),
81+
// Region is temporarily in busy state.
82+
RegionBusy(4009),
83+
// Table is temporarily unable to handle the request.
84+
TableUnavailable(4010),
85+
// Database already exists.
86+
DatabaseAlreadyExists(4011),
6687
// ====== End of catalog related status code =======
6788

6889
// ====== Begin of storage related status code =====
6990
// Storage is temporarily unable to handle the request
7091
StorageUnavailable(5000, true),
92+
// Request is outdated, e.g., version mismatch.
93+
RequestOutdated(5001),
7194
// ====== End of storage related status code =======
7295

7396
// ====== Begin of server related status code =====
@@ -91,9 +114,8 @@ public enum Status {
91114
// Illegal request to connect catalog-schema
92115
AccessDenied(7005),
93116
// User is not authorized to perform the operation
94-
PermissionDenied(7006),
95-
// ====== End of auth related status code =====
96-
;
117+
PermissionDenied(7006);
118+
// ====== End of auth related status code =====
97119

98120
private static final Map<Integer, Status> DICT = new HashMap<>();
99121

0 commit comments

Comments
 (0)