[#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:
// - **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

View file

@ -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;
}