Refactor 'Pool' #316
No reviewers
TrueCloudLab/storage-core-committers
TrueCloudLab/storage-core-developers
TrueCloudLab/storage-services-committers
TrueCloudLab/storage-services-developers
Labels
No labels
P0
P1
P2
P3
good first issue
pool
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-sdk-go#316
Loading…
Reference in a new issue
No description provided.
Delete branch "achuprov/frostfs-sdk-go:feat/refactorPool"
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?
Close #300
This PR splits the functionality of
Pool
into the following components:Pool
: Provides the external interface for interaction.connectionManager
: Implements the internal functionality for managing clients.healthCheck
: Handles client health monitoring.@ -0,0 +12,4 @@
"sync/atomic"
"time"
sdkClient "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
nitpick: consider remove uppercase from
sdkClient
in all files@ -1967,3 +1948,3 @@
)
// NewPool creates connection pool using parameters.
// NewPool creates cnnectionManager using parameters.
Typo. Overall I would change comment a bit, e.g.
NewPool inits a connectionManager and returns a new Pool instance
. Same fornewConnectionManager
.It
NewPool
createsconnectionManager
, what doesnewConnectionManager
do?@ -2688,19 +2190,19 @@ func (p *Pool) GetObject(ctx context.Context, prm PrmObjectGet) (ResGetObject, e
//
// Main return value MUST NOT be processed on an erroneous return.
question: Are these comments (here and in other methods) necessary? I believe it's clear that we should not process the result if an error occurs
In general, LGTM but I have feeling that these entities (
Pool
,connectionManager
andhealthchek
) are still tight coupled, know a lot about each other (and share responsibility).healthcheck
struct knows about buffers, node paramsfunc (h *healthCheck) startRebalance(ctx context.Context, callback func(ctx context.Context, buffers [][]float64), nodesParams []*nodesParam) {
though it just runs
callback
by tickercase <-ticker.C:
callback(ctx, buffers)
ticker.Reset(h.clientRebalanceInterval)
Pool
struct knows a lot aboutconnectionManager
. Let's look atPutObject
func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (ResPutObject, error) {
As I understand the main idea is getting from connection manager ready client to use. I would expect we form some parameters (prmContext is just fine) and invoke method (initCallContext is also just fine) to get client.
But
p.manager.fillAppropriateKey(&prm.prmCommon)
if err := p.manager.openDefaultSession(ctx, &ctxCall); err != nil {
manager
ni.SetCurrentEpoch(p.manager.cache.Epoch())
manager
p.manager.checkSessionTokenErr(err, ctxCall.endpoint)
I suggest we should make all these struct more loosely coupled. To make it easier to understand responsibility we can place (maybe just during development) each struct into separate package and work with it know nothing about inner struct and just using exported methods
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.