mirror of
https://github.com/nspcc-dev/neofs-sdk-go.git
synced 2026-03-01 04:29:18 +00:00
Separate type for object header #247
Labels
No labels
I2
I3
I4
S1
S2
S3
S4
U0
U1
U2
U2
U2
U3
U4
blocked
bug
client
config
discussion
documentation
enhancement
epic
feature
go
good first issue
help wanted
performance
pool
question
security
task
test
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nspcc-dev/neofs-sdk-go#247
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 @cthulhu-rider on GitHub (Dec 6, 2024).
Is your feature request related to a problem? Please describe.
currently,
objectprovidesObjectstructure type, but noHeaderone. This type would be helpful for HEAD ops (Client, node storage, etc.). Now such ops return instances of theObjecttype with unset payload field. I see following drawbacks in this approach:Describe the solution you'd like
Additional context
iirc @carpawell had questions why there is no header type. I couldnt find any issue, pls share if smth already exists
@carpawell commented on GitHub (Dec 6, 2024):
I always did not understand why there is no header while IMO it is a natural understanding for our HEAD operation and objects in general: every object has a header and every object has a payload. Sometimes we need only a header and vice versa. I have not opened any issues about it.
@roman-khimov commented on GitHub (Dec 9, 2024):
Yeah, we need this type, passing
object.Objectand doingCutPayload()tricks is very confusing, you never know what you have in code: a complete object or header only. But we need it to follow proto spec as well, signature is a part of the header IIRC.@cthulhu-rider commented on GitHub (Dec 9, 2024):
signature is not a part of header itself
nspcc-dev/neofs-api@e66b25d4bf/object/types.proto (L226), so it's transmitted besidenspcc-dev/neofs-api@e66b25d4bf/object/service.proto (L462)@roman-khimov commented on GitHub (Dec 9, 2024):
Header, SignedHeader, Object?
@cthulhu-rider commented on GitHub (Dec 9, 2024):
SignedHeaderincludes ID here?@roman-khimov commented on GitHub (Dec 9, 2024):
It's so tempting for me to make it a method with cached internal value (
transaction.Transaction). We need to evaluate real use cases, I know we have a number of uses forSignedHeader(maybe even more so than forHeaderalone).@cthulhu-rider commented on GitHub (Dec 9, 2024):
cached values are often a source of errors. I would stick with simple tuples with open logic
https://pkg.go.dev/github.com/nspcc-dev/neofs-sdk-go/object#Object.MarshalHeaderJSON is what i remember.
nspcc-dev/neo-go@5f92da21fa/pkg/services/oracle/neofs/neofs.go (L185). ThegetObjHeadercould returnobject.Headervarious tuples can be used:
nspcc-dev/neofs-api@e66b25d4bf/object/service.proto (L439-L452), no IDHeaderWithSignaturetooand i remember no usecase where we need (ID, signature, header) tuple
finally, for now i see
Header∈HeaderWithSignature∈Objecttype system@cthulhu-rider commented on GitHub (Dec 9, 2024):
it must be noted that transition to the heading types must be carried out carefully. For example,
CutPayloadreturns an object. So,nspcc-dev/neofs-node@918307b073/pkg/local_object_storage/metabase/put.go (L186)means that metabase stores (ID, signature, header) tuples. Not rly good to store storage key in the value, but it is what it is, updated code must take this into account. Normally, metabase could storeHeaderWithSignatureALSO!!!: do not forget about field numbers.
ObjectandHeaderWithSignaturehave different ones. Field nums are essential forMarshaland any protobuf functionality