Make working with key-value pairs more convenient #167
Labels
enhancement
Improving existing functionality
I3
Minimal impact
S3
Minimally significant
U4
Nothing urgent
Milestone
Overview
We have several features which are represented as key-value string|binary pairs:
neofs-sdk-go/object/attribute.go
Line 8 in df5c69e
neofs-sdk-go/container/attribute.go
Line 8 in df5c69e
neofs-sdk-go/netmap/network_info.go
Line 103 in df5c69e
neofs-sdk-go/client/common.go
Line 63 in df5c69e
and so on. In order to process them there is a need to use the constant keys. In current implementation they are defined in NeoFS API Go library. I think it is still the best place to define them, but we need to either
While
1
seems redundant,2
is not recommended approach at all.On the other hand, values encode certain data, which leads to the need to know what and how to decode when processing the value.
So we need smth more convenient.
Proposal
Provide per-key function pair which
A prime example of this approach is a function pair:
neofs-sdk-go/container/attribute.go
Line 114 in df5c69e
neofs-sdk-go/container/attribute.go
Line 125 in df5c69e
These functions allow the application to understand that the container's name and zone can be written to the container descriptor, and abstract away the rest of the details. At the same time, this is not a method of the
Container
type, which means that the application understands that the function is just an auxiliary one, which means that SDK has all the tools to do the same directly.I propose to implement function pairs for all such cases. Also it'd be useful to mention these functions in docs of the base methods (
SetAttributes
for example above).The text was updated successfully, but these errors were encountered: