Add PutSingle RPC #31

Merged
fyrchik merged 1 commit from dstepanov-yadro/frostfs-api:feat/put-single into master 2023-07-04 08:28:45 +00:00

View file

@ -231,6 +231,38 @@ service ObjectService {
// - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \ // - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \
// provided session token has expired. // provided session token has expired.
ale64bit marked this conversation as resolved Outdated

Request uses gRPC stream.

This is a bit misleading; the RPC is unary.

> Request uses gRPC stream. This is a bit misleading; the RPC is unary.

fixed

fixed
rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse); rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse);

PayloadHash is also required.

PayloadSize is required for streaming Put, because we need to check planned and actual size, so PutSinle doesn't require this field i think.

PayloadHash is also required. PayloadSize is required for streaming Put, because we need to check planned and actual size, so PutSinle doesn't require this field i think.

I believe it requires -- this is a part of correctly formed object.

I believe it requires -- this is a part of correctly formed object.

Ok, added Payload len to required

Ok, added Payload len to required
ale64bit marked this conversation as resolved Outdated

nit: not sure what kind of rules we have, but I would rather use MUST instead of SHOULD for these things. SHOULD sounds like it's optional.

nit: not sure what kind of rules we have, but I would rather use `MUST` instead of `SHOULD` for these things. `SHOULD` sounds like it's optional.

fixed

fixed
// Put the prepared object into container.
// `ContainerID`, `ObjectID`, `OwnerID`, `PayloadHash` and `PayloadLength` of an object MUST be set.
//
// Extended headers can change `Put` behaviour:
// * [ __SYSTEM__NETMAP_EPOCH \
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
ale64bit marked this conversation as resolved Outdated

s/requsted/requested

s/requsted/requested

fixed

fixed
// Will use the requested version of Network Map for object placement
// calculation.
//
// Please refer to detailed `XHeader` description.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS): \
// object has been successfully saved in the container;
// - Common failures (SECTION_FAILURE_COMMON);
// - **ACCESS_DENIED** (2048, SECTION_OBJECT): \
// write access to the container is denied;
// - **LOCKED** (2050, SECTION_OBJECT): \
// placement of an object of type TOMBSTONE that includes at least one locked
// object is prohibited;
// - **LOCK_NON_REGULAR_OBJECT** (2051, SECTION_OBJECT): \
// placement of an object of type LOCK that includes at least one object of
// type other than REGULAR is prohibited;
// - **CONTAINER_NOT_FOUND** (3072, SECTION_CONTAINER): \
// object storage container not found;
// - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \
// (for trusted object preparation) session private key does not exist or has
// been deleted;
alexvanin marked this conversation as resolved Outdated

Token failure codes are not relevant now.

Token failure codes are not relevant now.
frostfs-node checks session token for every request: https://git.frostfs.info/TrueCloudLab/frostfs-node/src/branch/master/pkg/services/object/acl/v2/service.go#L243
// - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \
// provided session token has expired.
rpc PutSingle(PutSingleRequest) returns (PutSingleResponse);
} }
// GET object request // GET object request
@ -709,3 +741,48 @@ message GetRangeHashResponse {
// transmission. // transmission.
neo.fs.v2.session.ResponseVerificationHeader verify_header = 3; neo.fs.v2.session.ResponseVerificationHeader verify_header = 3;
} }

many of these comments seem superfluous. They don't add any valuable info to the declaration itself.

many of these comments seem superfluous. They don't add any valuable info to the declaration itself.

Well, i think, this is a tradition. And traditions should be respected.

Well, i think, this is a tradition. And traditions should be respected.

The comments could be useful for doc generation.
Agree with @dstepanov-yadro , let's preserve the style.
Could make alterations altogether in a separate task.

The comments could be useful for doc generation. Agree with @dstepanov-yadro , let's preserve the style. Could make alterations altogether in a separate task.
// Object PUT Single request
message PutSingleRequest {
// PUT Single request body
message Body {
// Prepared object with payload.

So, basically, Object + copies_number?
Why do we have 4 separate fields instead of an Object?

So, basically, `Object` + `copies_number`? Why do we have 4 separate fields instead of an `Object`?

fixed

fixed
Object object = 1;
// Number of copies of the object to store within the RPC call. By default,
// object is processed according to the container's placement policy.
// Every number is treated as a minimal number of
// nodes in a corresponding placement vector that must store an object
// to complete the request successfully. The length MUST equal the placement
// vectors number, otherwise request is considered malformed.
repeated uint32 copies_number = 2;
}
// Body of put single object request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.session.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
neo.fs.v2.session.RequestVerificationHeader verify_header = 3;
}
// Object PUT Single response
message PutSingleResponse {
// PUT Single Object response body

PutSingle requires object id passed in the request. So there is nothing to return, but Body is defined like in other models.

PutSingle requires object id passed in the request. So there is nothing to return, but `Body` is defined like in other models.
message Body {
}
// Body of put single object response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.session.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness of
// transmission.
neo.fs.v2.session.ResponseVerificationHeader verify_header = 3;
}