From 8c0b0362ca96f29621eafa0e687e2a7d73849b8b Mon Sep 17 00:00:00 2001 From: jeremyhi Date: Tue, 5 Nov 2024 14:34:26 +0800 Subject: [PATCH] chore: update status code (#53) --- .../src/main/java/io/greptime/Status.java | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/ingester-protocol/src/main/java/io/greptime/Status.java b/ingester-protocol/src/main/java/io/greptime/Status.java index 657af8a..946acf3 100644 --- a/ingester-protocol/src/main/java/io/greptime/Status.java +++ b/ingester-protocol/src/main/java/io/greptime/Status.java @@ -21,6 +21,8 @@ /** * Common status code for public API. + *

+ * Always follow GreptimeDB's STATUS CODE */ public enum Status { // ====== Begin of common status code ============== @@ -37,8 +39,12 @@ public enum Status { Internal(1003, true), // Invalid arguments. InvalidArguments(1004), - // / The task is cancelled. + // The task is cancelled. Cancelled(1005), + // Illegal state. + IllegalState(1006), + // Caused by some error originated from external system. + External(1007), // ====== End of common status code ================ // ====== Begin of SQL related status code ========= @@ -56,18 +62,35 @@ public enum Status { // ====== Begin of catalog related status code ===== // Table already exists. TableAlreadyExists(4000), + // Table not found. TableNotFound(4001), + // Table column not found. TableColumnNotFound(4002), + // Table column already exists. TableColumnExists(4003), + // Database not found. DatabaseNotFound(4004), + // Region not found. RegionNotFound(4005), + // Region already exists. RegionAlreadyExists(4006), + // Region is read-only in current state. RegionReadonly(4007), + // Region is not in a proper state to handle specific request. + RegionNotReady(4008), + // Region is temporarily in busy state. + RegionBusy(4009), + // Table is temporarily unable to handle the request. + TableUnavailable(4010), + // Database already exists. + DatabaseAlreadyExists(4011), // ====== End of catalog related status code ======= // ====== Begin of storage related status code ===== // Storage is temporarily unable to handle the request StorageUnavailable(5000, true), + // Request is outdated, e.g., version mismatch. + RequestOutdated(5001), // ====== End of storage related status code ======= // ====== Begin of server related status code ===== @@ -91,9 +114,8 @@ public enum Status { // Illegal request to connect catalog-schema AccessDenied(7005), // User is not authorized to perform the operation - PermissionDenied(7006), -// ====== End of auth related status code ===== -; + PermissionDenied(7006); + // ====== End of auth related status code ===== private static final Map DICT = new HashMap<>();