nspcc-dev / neofs-api

NeoFS API documentation and proto files declaration
Apache License 2.0
11 stars 15 forks source link

Do not store system data in raw key-value attributes #272

Closed cthulhu-rider closed 5 months ago

cthulhu-rider commented 1 year ago

NeoFS protocol contains several messages with raw string k-v attributes. These fields is dedicated for the user- or application-specific stuff and the system almost always not interested in them. At the same time, there are system attributes like __NEOFS__EXPIRATION_EPOCH. This is very (very) bad approach cuz it raises a lot of duality issues.

The most interesting case is https://github.com/nspcc-dev/neofs-api/blob/7ae1a7438b19fc4ca32c451db67de170edb539a7/object/service.proto#L527 where user attributes are mixed with object headers and even logical properties. For example, expiration attribute is a regular attribute in SEARCH context, and the system overall.

Proposal

  1. Add new field for each system attribute
  2. Never ever add system data to raw attributes

Sad thing that we already have attributes like __NEOFS__EXPIRATION_EPOCH that must be supported until next major version.

roman-khimov commented 1 year ago

expiration attribute is a regular attribute in SEARCH context, and the system overall.

There are good things about it too, it can be used in various attribute-related expressions just like any other attribute, not needing any specific logic.

Add new field for each system attribute

Which adds some overhead even when the attribute is not used.

supported until next major version.

No major version can help with old objects.

I don't think we can or even should change this. Frankly, it'd be easier to maintain the system if we had more attributes, like object creation epoch is completely useless right now, but we can't create an object without it. It also allows for more extensibility without object format changes.

roman-khimov commented 5 months ago

Not planned.