From 7b83b9df4ee87480459401056300587733db48c6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 15 Feb 2022 23:02:18 +0300 Subject: [PATCH] [#194] object: Add status returns related to LOCKs Add `status.Object` section for object failures. Add `LOCKED` and `LOCK_NON_REGULAR_OBJECT` codes to it. Return these codes from `Put` and `Delete` RPCs of `ObjectService`. Signed-off-by: Leonard Lyubich --- object/service.proto | 12 ++++++++++-- status/types.proto | 8 ++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/object/service.proto b/object/service.proto index c608e98..bdce523 100644 --- a/object/service.proto +++ b/object/service.proto @@ -35,7 +35,13 @@ service ObjectService { // Statuses: // - **OK** (0, SECTION_SUCCESS): // object has been successfully saved in the container; - // - Common failures (SECTION_FAILURE_COMMON). + // - Common failures (SECTION_FAILURE_COMMON); + // - **LOCKED** (2048, SECTION_OBJECT): + // placement of an object of type TOMBSTONE that includes at least one locked + // object is prohibited; + // - **LOCK_NON_REGULAR_OBJECT** (2049, SECTION_OBJECT): + // placement of an object of type LOCK that includes at least one object of + // type other than REGULAR is prohibited. rpc Put(stream PutRequest) returns (PutResponse); // Delete the object from a container. There is no immediate removal @@ -44,7 +50,9 @@ service ObjectService { // Statuses: // - **OK** (0, SECTION_SUCCESS): // object has been successfully marked to be removed from the container; - // - Common failures (SECTION_FAILURE_COMMON). + // - Common failures (SECTION_FAILURE_COMMON); + // - **LOCKED** (2048, SECTION_OBJECT): + // deleting a locked object is prohibited. rpc Delete(DeleteRequest) returns (DeleteResponse); // Returns the object Headers without data payload. By default full header is diff --git a/status/types.proto b/status/types.proto index 80b47aa..cef00d3 100644 --- a/status/types.proto +++ b/status/types.proto @@ -103,8 +103,15 @@ enum Object { // Details: // - [**0**] Human-readable description. ACCESS_DENIED = 0; + // [**2049**] Object not found. OBJECT_NOT_FOUND = 1; + + // [**2050**] Operation rejected by the object lock. + LOCKED = 2; + + // [**2051**] Locking an object with a non-REGULAR type rejected. + LOCK_NON_REGULAR_OBJECT = 3; } // Section of statuses for container-related operations. @@ -117,6 +124,7 @@ enum Container { enum Session { // [**4096**] Token not found. TOKEN_NOT_FOUND = 0; + // [**4097**] Token has expired. TOKEN_EXPIRED = 1; }