[#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 <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-09-16 18:11:53 +04:00 committed by LeL
parent d6090eb2fc
commit b4cdca989f

View file

@ -40,14 +40,21 @@ message ObjectSessionContext {
// Type of request for which the token is issued // Type of request for which the token is issued
Verb verb = 1 [json_name = "verb"]; Verb verb = 1 [json_name = "verb"];
// Objects involved in the session. `address` MUST be set. // Carries objects involved in the object session.
// `container_id` field indicates which container the session is spread to. message Target {
// `container_id` MUST be correctly filled and set. // Indicates which container the session is spread to. Field MUST be set
// `object_id` field indicates which objects in the specified container the // and correct.
// session is spread to. `object_id` MUST be correctly filled or unset. refs.ContainerID container = 1 [json_name = "container"];
// If `object_id` field is set, then the session applies only to this object,
// otherwise, to all objects of the specified container. // Indicates which objects the session is spread to. Objects are expected
neo.fs.v2.refs.Address address = 2 [json_name = "address"]; // 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. // Context information for Session Tokens related to ContainerService requests.