From a0311f6ae0591ac55f2dbb1e71e9e6ad605b6f4b Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 17 Jun 2025 11:14:05 +0300 Subject: [PATCH] object: Allow header with payload chunk in first GET response message Previously, heading and chunk fields were mutually exclusive in each GET response message. With this, server sent 1st message with the header only, then messages with payload chunks came. This behavior is inefficient since any object with a non-empty payload requires one more message. The smaller the payload, the greater the overhead. This modifies GET protocol to allow header and chunk to be attached to the same message. For backward compatibility, requests from older clients will be processed as before. Signed-off-by: Leonard Lyubich --- object/service.proto | 19 ++++++++++--------- proto-docs/object.md | 6 +++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/object/service.proto b/object/service.proto index dfb4dea7..964c5ccb 100644 --- a/object/service.proto +++ b/object/service.proto @@ -291,17 +291,18 @@ message GetResponse { // Object metadata headers Header header = 3; } - // Single message in the response stream. - oneof object_part { - // Initial part of the object stream - Init init = 1; - // Chunked object payload - bytes chunk = 2; + // Initial part of the object stream. Mutually exclusive with `split_info` + // and, for requests with `meta_header.version` <= 2.17, with `chunk`. + Init init = 1; - // Meta information of split hierarchy for object assembly. - SplitInfo split_info = 3; - } + // Chunked object payload. Mutually exclusive with `split_info` and, for + // requests with `meta_header.version` <= 2.17, `init`. + bytes chunk = 2; + + // Meta information of split hierarchy for object assembly. Mutually + // exclusive with `init` and `chunk`. + SplitInfo split_info = 3; } // Body of get object response message. Body body = 1; diff --git a/proto-docs/object.md b/proto-docs/object.md index b289b623..c24b5064 100644 --- a/proto-docs/object.md +++ b/proto-docs/object.md @@ -569,9 +569,9 @@ GET Object Response body | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| init | [GetResponse.Body.Init](#neo.fs.v2.object.GetResponse.Body.Init) | | Initial part of the object stream | -| chunk | [bytes](#bytes) | | Chunked object payload | -| split_info | [SplitInfo](#neo.fs.v2.object.SplitInfo) | | Meta information of split hierarchy for object assembly. | +| init | [GetResponse.Body.Init](#neo.fs.v2.object.GetResponse.Body.Init) | | Initial part of the object stream. Mutually exclusive with `split_info` and, for requests with `meta_header.version` <= 2.17, with `chunk`. | +| chunk | [bytes](#bytes) | | Chunked object payload. Mutually exclusive with `split_info` and, for requests with `meta_header.version` <= 2.17, `init`. | +| split_info | [SplitInfo](#neo.fs.v2.object.SplitInfo) | | Meta information of split hierarchy for object assembly. Mutually exclusive with `init` and `chunk`. |