[#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 <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-02-15 23:02:18 +03:00 committed by LeL
parent 3793783ed4
commit 7b83b9df4e
2 changed files with 18 additions and 2 deletions

View file

@ -35,7 +35,13 @@ service ObjectService {
// Statuses: // Statuses:
// - **OK** (0, SECTION_SUCCESS): // - **OK** (0, SECTION_SUCCESS):
// object has been successfully saved in the container; // 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); rpc Put(stream PutRequest) returns (PutResponse);
// Delete the object from a container. There is no immediate removal // Delete the object from a container. There is no immediate removal
@ -44,7 +50,9 @@ service ObjectService {
// Statuses: // Statuses:
// - **OK** (0, SECTION_SUCCESS): // - **OK** (0, SECTION_SUCCESS):
// object has been successfully marked to be removed from the container; // 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); rpc Delete(DeleteRequest) returns (DeleteResponse);
// Returns the object Headers without data payload. By default full header is // Returns the object Headers without data payload. By default full header is

View file

@ -103,8 +103,15 @@ enum Object {
// Details: // Details:
// - [**0**] Human-readable description. // - [**0**] Human-readable description.
ACCESS_DENIED = 0; ACCESS_DENIED = 0;
// [**2049**] Object not found. // [**2049**] Object not found.
OBJECT_NOT_FOUND = 1; 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. // Section of statuses for container-related operations.
@ -117,6 +124,7 @@ enum Container {
enum Session { enum Session {
// [**4096**] Token not found. // [**4096**] Token not found.
TOKEN_NOT_FOUND = 0; TOKEN_NOT_FOUND = 0;
// [**4097**] Token has expired. // [**4097**] Token has expired.
TOKEN_EXPIRED = 1; TOKEN_EXPIRED = 1;
} }