Skip to content

Commit

Permalink
[#194] object: Add status returns related to LOCKs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Leonard Lyubich authored and cthulhu-rider committed Feb 22, 2022
1 parent 3793783 commit 7b83b9d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 10 additions & 2 deletions object/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions status/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -117,6 +124,7 @@ enum Container {
enum Session {
// [**4096**] Token not found.
TOKEN_NOT_FOUND = 0;

// [**4097**] Token has expired.
TOKEN_EXPIRED = 1;
}

0 comments on commit 7b83b9d

Please sign in to comment.