Refactor get service #193

Merged
fyrchik merged 7 commits from dstepanov-yadro/frostfs-node:refactoring/OBJECT-3610_getsvc into master 2023-04-05 14:38:49 +00:00

Resolve linters for get service

Resolve linters for get service
dstepanov-yadro changed title from Refactor get service to WIP: Refactor get service 2023-03-31 11:51:32 +00:00
dstepanov-yadro force-pushed refactoring/OBJECT-3610_getsvc from d380229b0f to 5718390a84 2023-03-31 11:52:25 +00:00 Compare
dstepanov-yadro changed title from WIP: Refactor get service to Refactor get service 2023-03-31 14:48:26 +00:00
dstepanov-yadro requested review from storage-core-committers 2023-03-31 14:48:33 +00:00
dstepanov-yadro requested review from storage-core-developers 2023-03-31 14:48:33 +00:00
fyrchik reviewed 2023-04-03 08:39:10 +00:00
@ -81,4 +78,2 @@
}
func (exec execCtx) context() context.Context {
return exec.ctx
Owner

Do we still need the field in the struct?

Do we still need the field in the struct?
Author
Member

No, we dont. It's dropped.

No, we dont. It's dropped.
fyrchik marked this conversation as resolved
@ -193,2 +59,2 @@
}
}
forwarder := &getRequestForwarder{
OnceResign: &sync.Once{},
Owner

Is there any reason you don't just use non-pointer field in struct and omit the initialization?

Is there any reason you don't just use non-pointer field in struct and omit the initialization?
Author
Member

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)

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)
Contributor

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 `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)
Author
Member

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.

> 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.
fyrchik approved these changes 2023-04-03 08:39:24 +00:00
fyrchik approved these changes 2023-04-03 09:49:06 +00:00
aarifullin approved these changes 2023-04-03 13:07:16 +00:00
acid-ant approved these changes 2023-04-03 15:42:59 +00:00
carpawell requested changes 2023-04-03 15:56:00 +00:00
carpawell left a comment
Contributor

Periods in commits' bodies, please. It is a completed sentence (and quite often more than one sentence).

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) {
Contributor

so not used second return value?

so not used second return value?
Author
Member

forwardRequestToNode is used as an argument for func 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?

```forwardRequestToNode``` is used as an argument for ```func 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?
Contributor

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.

is used as an argument for func groupAddressRequestForwarder(...) function

originally, comment was about that: seems like anything that is ...forwarder... should not return objects. if groupAddressRequestForwarder is used somewhere else AND that is not a complete refactor and we plan to reorganize it later, im ok with that

> 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. > is used as an argument for func groupAddressRequestForwarder(...) function originally, comment was about that: seems like anything that is `...forwarder...` should not return objects. if `groupAddressRequestForwarder` is used somewhere else AND that is not a complete refactor and we plan to reorganize it later, im ok with that
Author
Member

HEAD request requires return result from forwarder

HEAD request requires return result from forwarder
@ -0,0 +56,4 @@
return nil, err
}
if err := f.readStream(ctx, c, getStream, pubkey); err != nil {
Contributor

can we just return f.readStream err if no details are added? (personally, i would add some details via fmt.Errorf)

related to more than just that line

can we just return `f.readStream` err if no details are added? (personally, i would add some details via `fmt.Errorf`) related to more than just that line
Author
Member

Fixed.

Fixed.
carpawell marked this conversation as resolved
dstepanov-yadro force-pushed refactoring/OBJECT-3610_getsvc from 3a80d96ff5 to 97f87137af 2023-04-03 16:38:22 +00:00 Compare
Author
Member

Periods in commits' bodies, please. It is a completed sentence (and quite often more than one sentence).

fixed

> Periods in commits' bodies, please. It is a completed sentence (and quite often more than one sentence). fixed
dstepanov-yadro force-pushed refactoring/OBJECT-3610_getsvc from 97f87137af to b091e78063 2023-04-03 16:57:22 +00:00 Compare
dstepanov-yadro reviewed 2023-04-04 10:09:31 +00:00
dstepanov-yadro reviewed 2023-04-04 10:25:43 +00:00
@ -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)
Author
Member

@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.

@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.
Owner

Not an error, it should return the same key each time used.

Not an error, it should return the same key each time used.
Author
Member

Thx, then it can be requested once.

Thx, then it can be requested once.
fyrchik marked this conversation as resolved
fyrchik reviewed 2023-04-05 04:54:52 +00:00
@ -11,3 +11,3 @@
)
func (exec *execCtx) assemble() {
func (exec *execCtx) assemble(ctx context.Context) {
Owner

Can we use more meaningful commit message for this? Like a sentence you use in the body.

Can we use more meaningful commit message for this? Like a sentence you use in the body.
Owner

And same for the last commit, we have 2 commits with identical message doing pretty different things.

And same for the last commit, we have 2 commits with identical message doing pretty different things.
Author
Member

Fixed

Fixed
dstepanov-yadro force-pushed refactoring/OBJECT-3610_getsvc from fbd35ce39c to 7dbeb09b94 2023-04-05 08:07:20 +00:00 Compare
dstepanov-yadro requested review from carpawell 2023-04-05 08:11:37 +00:00
fyrchik approved these changes 2023-04-05 08:11:39 +00:00
aarifullin approved these changes 2023-04-05 14:07:13 +00:00
fyrchik merged commit c58ab0c369 into master 2023-04-05 14:38:49 +00:00
fyrchik referenced this pull request from a commit 2023-04-05 14:38:49 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#193
No description provided.