Refactor get service #193
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#193
Loading…
Reference in a new issue
No description provided.
Delete branch "dstepanov-yadro/frostfs-node:refactoring/OBJECT-3610_getsvc"
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?
Resolve linters for get service
Refactor get serviceto WIP: Refactor get serviced380229b0f
to5718390a84
WIP: Refactor get serviceto Refactor get service@ -81,4 +78,2 @@
}
func (exec execCtx) context() context.Context {
return exec.ctx
Do we still need the field in the struct?
No, we dont. It's dropped.
@ -193,2 +59,2 @@
}
}
forwarder := &getRequestForwarder{
OnceResign: &sync.Once{},
Is there any reason you don't just use non-pointer field in struct and omit the initialization?
This is the easiest way to meet this requirement: Values containing the types defined in this package should not be copied. (https://pkg.go.dev/sync)
but
forwarder
is already a pointer? i am ok with that, just want to come to some approach that will be commonly adopted in that repo (the other code do not use pointer inside a pointer i guess)But you should always think how holder of
sync.Mutex (RWMutex, Once...)
will be used.Periods in commits' bodies, please. It is a completed sentence (and quite often more than one sentence).
@ -0,0 +29,4 @@
Stream *streamObjectWriter
}
func (f *getRequestForwarder) forwardRequestToNode(ctx context.Context, addr network.Address, c client.MultiAddressClient, pubkey []byte) (*object.Object, error) {
so not used second return value?
forwardRequestToNode
is used as an argument forfunc groupAddressRequestForwarder(...)
function.groupAddressRequestForwarder
requires two values to be returned. It is possible to use a lambda function, but I don't like it.Do you think that with a lambda and one return value it will be easier to understand?
no, do not like lambdas usually as more complex thing for a reader.
originally, comment was about that: seems like anything that is
...forwarder...
should not return objects. ifgroupAddressRequestForwarder
is used somewhere else AND that is not a complete refactor and we plan to reorganize it later, im ok with thatHEAD request requires return result from forwarder
@ -0,0 +56,4 @@
return nil, err
}
if err := f.readStream(ctx, c, getStream, pubkey); err != nil {
can we just return
f.readStream
err if no details are added? (personally, i would add some details viafmt.Errorf
)related to more than just that line
Fixed.
3a80d96ff5
to97f87137af
fixed
97f87137af
tob091e78063
@ -468,4 +252,0 @@
p.SetRequestForwarder(groupAddressRequestForwarder(func(addr network.Address, c client.MultiAddressClient, pubkey []byte) (*object.Object, error) {
var err error
key, err := s.keyStorage.GetKey(nil)
@fyrchik @carpawell Is it an error that
key
is requested at every head and get request? For get range request the key is requested once.Fixed it in the last commit.
Not an error, it should return the same key each time used.
Thx, then it can be requested once.
@ -11,3 +11,3 @@
)
func (exec *execCtx) assemble() {
func (exec *execCtx) assemble(ctx context.Context) {
Can we use more meaningful commit message for this? Like a sentence you use in the body.
And same for the last commit, we have 2 commits with identical message doing pretty different things.
Fixed
fbd35ce39c
to7dbeb09b94