From b4cdca989fc3171b1179b629425b75bcb27f68c1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 16 Sep 2022 18:11:53 +0400 Subject: [PATCH] [#202] session: Support sessions issued for an object group Sometimes it is useful to open single session which covers several objects in the container. In previous implementation it could be done: * by opening container-global session * by opening N per-object sessions Both approaches are not optimal for the mentioned need. Define `ObjectSessionContext.Target` which is backward compatible with `refs.Address` in binary format. Replace `address` field of `refs.Address` type in `ObjectSessionContext` message with `target` field of `ObjectSessionContext.Target` type. This change saves backward compatibility in binary format, but break the JSON one. Such a breakage is considered admissible for now since NeoFS API protocol hasn't declared JSON compatibility yet. Signed-off-by: Leonard Lyubich --- session/types.proto | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/session/types.proto b/session/types.proto index 099b7d5..d00e99f 100644 --- a/session/types.proto +++ b/session/types.proto @@ -40,14 +40,21 @@ message ObjectSessionContext { // Type of request for which the token is issued Verb verb = 1 [json_name = "verb"]; - // Objects involved in the session. `address` MUST be set. - // `container_id` field indicates which container the session is spread to. - // `container_id` MUST be correctly filled and set. - // `object_id` field indicates which objects in the specified container the - // session is spread to. `object_id` MUST be correctly filled or unset. - // If `object_id` field is set, then the session applies only to this object, - // otherwise, to all objects of the specified container. - neo.fs.v2.refs.Address address = 2 [json_name = "address"]; + // Carries objects involved in the object session. + message Target { + // Indicates which container the session is spread to. Field MUST be set + // and correct. + refs.ContainerID container = 1 [json_name = "container"]; + + // Indicates which objects the session is spread to. Objects are expected + // to be stored in the NeoFS container referenced by `container` field. + // Each element MUST have correct format. + repeated refs.ObjectID objects = 2 [json_name = "objects"]; + } + // Object session target. MUST be correctly formed and set. If `objects` + // field is not empty, then the session applies only to these elements, + // otherwise, to all objects from the specified container. + Target target = 2 [json_name = "target"]; } // Context information for Session Tokens related to ContainerService requests.