object: Move target initialization to separate package #1344
No reviewers
TrueCloudLab/storage-core-developers
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
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#1344
Loading…
Reference in a new issue
No description provided.
Delete branch "aarifullin/frostfs-node:feat/patch/refactor/1"
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?
themselves.
Close #1310
3e1bd3a2f0
to1d42455131
[#1310] object: Move target initialization to separate packageto WIP: [#1310] object: Move target initialization to separate package1d42455131
to64ba2b0b4a
WIP: [#1310] object: Move target initialization to separate packageto [#1310] object: Move target initialization to separate package@ -0,0 +17,4 @@
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
)
type Params struct {
Why is this field embedded, while the others are not?
IMO it is better to use explicit names in
Params
.Config
is the field inParams
. Please, check this out@ -0,0 +32,4 @@
SignRequestPrivateKey *ecdsa.PrivateKey
}
Why do we need a separate struct here, just to be able to convert it to the struct of the same shape?
Here are highlighted points that aren't related to specifically to this question, but which help to understand why packages were refactored in this way:
Target
initialization logic should be moved in a common package. Since bothpatch
andput
can reuse thiswriter
andtarget
should be distingushed:writer
package's purpose is to createtransformer.ObjectWriter
writer
package is used in a few packagestarget
package's purpose is to createtransformer.ChunkedObjectWriter
target
is used only withinput
andpatch
streamsIt looked ambiguous with me to use
objectwriter.Params
as an input parameter for target initialization (New
). I admit that such convertation looks ugly - so, I'll remove itSince
target.New
usesobjectwriter.Params
. Please, check this outWhy is it public now?
The file has been moved to another package (now it's within
common/writer
) and we need to access some fields@ -0,0 +38,4 @@
type FormatValidatorConfig interface {
VerifySessionTokenIssuer() bool
}
Why don't you use
Config
like in other code? "Static" is not even a noun (or doesn't have the meaning we are trying to convey here).Ok, I'll rename it back
BTW, I have named it
Static
because I was not sure that using the wordConfig
is appropriate for non-service package - as it was previosly input
service package.Static
- I meant that there parameters are set during initialzation only unlike field inParams
@ -21,6 +21,7 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/policy"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/network"
PutSingle seems to differ heavily from the regular PUT, as it uses multiple exported entities from our new packages, without using more coarse chunks.
Why is it so? It seems we send the same object to some target. Optimizations?
Ah... That's the hardest thing in this refactoring. The refactoring for
single
is not for optimization purpose. I believe thatPutSingle
is not related neither towriter
nor totarget
. It still uses the config (currently it'sStatic
that's going to be renamed) andNodeDescriptor
.Moving
Static
(Config
) and common things likeNodeDescriptor
to one more separate package is not the big dealIf we go one step further and move
NodeIterator
to a separate package (together with it's config), will it help somehow? Or is the issue deeper?@ -37,2 +38,3 @@
var errInvalidPayloadChecksum = errors.New("incorrect payload checksum")
var (
errInvalidPayloadChecksum = errors.New("incorrect payload checksum")
This error is still present in
common/target/validation.go
. Is it used there? Is is the same error as here?These two errors have been moved to
common/errors
package as they used in bothtarget
andput
packages. I would not like to import errors from packagetarget
because that one who will reading the codebase won't get the idea how should he has guessed to import these errors from the packagetarget
Frankly, I would avoid name clash with the package from
stdlib
.Can we just reuse errors from
target
package? We are importing it anyway, so no new dependency occurs.@aarifullin
Fixed
@ -55,4 +53,4 @@
// MaxObjectSize returns maximum payload size for the streaming session.
//
// Must be called after the successful Init.
func (p *Streamer) MaxObjectSize() uint64 {
Previously this method exported private field, what do we need this method for now?
Removed
[#1310] object: Move target initialization to separate packageto object: Move target initialization to separate package64ba2b0b4a
toa85561bf25
a85561bf25
to28a1208240
28a1208240
to90cf89b26c
90cf89b26c
to1fe5c82667
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
@ -21,6 +21,8 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/policy"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/network"
targeterrors "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/common/target"
Why use different alias here?
Oh, sorry. That was left after multiple renamings.
I have removed all aliases for
common/target
package because this package's name seems unambiguous1fe5c82667
to18220985bf