mirror of
https://github.com/nspcc-dev/neofs-api-go.git
synced 2026-03-01 04:28:56 +00:00
Simplify structure unmarshaling for SDK users #18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @alexvanin on GitHub (Oct 9, 2020).
There is an straightforward way to serialize SDK structure by converting it into unified structure and then using stable marshaler on it.
But there is not simple way to convert it back. To do that, user has to use transport structure even though it is not necessary, because unified structures are matched with protobuf definition.
The issue is that unlike stable marshallers, unmarshallers are a little more complicated. And we don't have to make them stable (with strict field order check in binary message) at all. Can we just hide GRPC or any other transport layer behind
Unmarshal()function inv2/*packages?@cthulhu-rider commented on GitHub (Oct 23, 2020):
I think we can. Here is an example. We can disseminate this approach to all
v2messages.StableUnmarshalcan be renamed toUnmarshal(orUnmarshalBinaryto implementencoding.BinaryUnmarshaler).