[#237] pool: Return creation epoch from object put #237

Merged
alexvanin merged 1 commit from mbiryukova/frostfs-sdk-go:feature/epoch_from_object_put into master 2024-07-22 06:15:26 +00:00
Member

Signed-off-by: Marina Biryukova m.biryukova@yadro.com

Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
mbiryukova self-assigned this 2024-07-12 11:51:14 +00:00
mbiryukova added 1 commit 2024-07-12 11:51:16 +00:00
[#xxx] pool: Return creation epoch from object put
Some checks failed
DCO / DCO (pull_request) Failing after 1m22s
Tests and linters / Tests (1.21) (pull_request) Successful in 2m15s
Tests and linters / Tests (1.20) (pull_request) Successful in 2m28s
Tests and linters / Lint (pull_request) Successful in 5m35s
8d764f37aa
Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
mbiryukova force-pushed feature/epoch_from_object_put from 8d764f37aa to 0858160c88 2024-07-12 11:51:52 +00:00 Compare
mbiryukova changed title from [#xxx] pool: Return creation epoch from object put to [#237] pool: Return creation epoch from object put 2024-07-12 11:52:27 +00:00
mbiryukova requested review from storage-core-committers 2024-07-12 12:06:03 +00:00
mbiryukova requested review from storage-core-developers 2024-07-12 12:06:03 +00:00
mbiryukova requested review from storage-sdk-committers 2024-07-12 12:06:04 +00:00
mbiryukova requested review from storage-sdk-developers 2024-07-12 12:06:06 +00:00
mbiryukova requested review from storage-services-committers 2024-07-12 12:06:07 +00:00
mbiryukova requested review from storage-services-developers 2024-07-12 12:06:09 +00:00
fyrchik approved these changes 2024-07-12 12:49:12 +00:00
achuprov approved these changes 2024-07-12 14:08:56 +00:00
dkirillov reviewed 2024-07-15 06:29:35 +00:00
@ -80,6 +81,10 @@ func (x ResObjectPut) StoredObjectID() oid.ID {
return x.obj
}
func (x ResObjectPut) StoredEpoch() uint64 {
Member

We need comment I suppose (to be consistent with other methods)

We need comment I suppose (to be consistent with other methods)
dkirillov marked this conversation as resolved
@ -96,0 +97,4 @@
epoch uint64
}
func (r *ResObjectPutSingle) Epoch() uint64 {
Member

Also need comment

Also need comment
dkirillov marked this conversation as resolved
pool/pool.go Outdated
@ -2449,3 +2449,3 @@
//
// Main return value MUST NOT be processed on an erroneous return.
func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, error) {
func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (oid.ID, uint64, error) {
Member

Let's introduce new struct that contains both id and epoch rather than return these values individually

Let's introduce new struct that contains both id and epoch rather than return these values individually
dkirillov marked this conversation as resolved
mbiryukova force-pushed feature/epoch_from_object_put from 0858160c88 to 249f76cfe8 2024-07-15 09:33:57 +00:00 Compare
aarifullin approved these changes 2024-07-15 10:16:32 +00:00
aarifullin left a comment
Member

OK with me

OK with me
alexvanin approved these changes 2024-07-15 11:58:40 +00:00
dkirillov reviewed 2024-07-15 13:28:16 +00:00
dkirillov reviewed 2024-07-15 13:28:51 +00:00
pool/pool.go Outdated
@ -2460,2 +2472,3 @@
var ctxCall callContext
var (
res ResPutObject
Member

(non-blocking): Can we don't introduce this variable?

I suggest:

diff --git a/pool/pool.go b/pool/pool.go
index 6e435a1..651702b 100644
--- a/pool/pool.go
+++ b/pool/pool.go
@@ -2470,19 +2470,16 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (ResPutObject, e
 
 	p.fillAppropriateKey(&prm.prmCommon)
 
-	var (
-		res     ResPutObject
-		ctxCall callContext
-	)
+	var ctxCall callContext
 	ctxCall.sessionClientCut = prm.clientCut
 	if err := p.initCallContext(&ctxCall, prm.prmCommon, prmCtx); err != nil {
-		return res, fmt.Errorf("init call context: %w", err)
+		return ResPutObject{}, fmt.Errorf("init call context: %w", err)
 	}
 
 	if ctxCall.sessionDefault {
 		ctxCall.sessionTarget = prm.UseSession
 		if err := p.openDefaultSession(ctx, &ctxCall); err != nil {
-			return res, fmt.Errorf("open default session: %w", err)
+			return ResPutObject{}, fmt.Errorf("open default session: %w", err)
 		}
 	}
 
@@ -2493,12 +2490,11 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (ResPutObject, e
 		prm.setNetworkInfo(ni)
 	}
 
-	var err error
-	res, err = ctxCall.client.objectPut(ctx, prm)
+	res, err := ctxCall.client.objectPut(ctx, prm)
 	if err != nil {
 		// removes session token from cache in case of token error
 		p.checkSessionTokenErr(err, ctxCall.endpoint)
-		return res, fmt.Errorf("init writing on API client %s: %w", ctxCall.endpoint, err)
+		return ResPutObject{}, fmt.Errorf("init writing on API client %s: %w", ctxCall.endpoint, err)
 	}
 
 	return res, nil

(non-blocking): Can we don't introduce this variable? I suggest: ```diff diff --git a/pool/pool.go b/pool/pool.go index 6e435a1..651702b 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -2470,19 +2470,16 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (ResPutObject, e p.fillAppropriateKey(&prm.prmCommon) - var ( - res ResPutObject - ctxCall callContext - ) + var ctxCall callContext ctxCall.sessionClientCut = prm.clientCut if err := p.initCallContext(&ctxCall, prm.prmCommon, prmCtx); err != nil { - return res, fmt.Errorf("init call context: %w", err) + return ResPutObject{}, fmt.Errorf("init call context: %w", err) } if ctxCall.sessionDefault { ctxCall.sessionTarget = prm.UseSession if err := p.openDefaultSession(ctx, &ctxCall); err != nil { - return res, fmt.Errorf("open default session: %w", err) + return ResPutObject{}, fmt.Errorf("open default session: %w", err) } } @@ -2493,12 +2490,11 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (ResPutObject, e prm.setNetworkInfo(ni) } - var err error - res, err = ctxCall.client.objectPut(ctx, prm) + res, err := ctxCall.client.objectPut(ctx, prm) if err != nil { // removes session token from cache in case of token error p.checkSessionTokenErr(err, ctxCall.endpoint) - return res, fmt.Errorf("init writing on API client %s: %w", ctxCall.endpoint, err) + return ResPutObject{}, fmt.Errorf("init writing on API client %s: %w", ctxCall.endpoint, err) } return res, nil ```
dkirillov approved these changes 2024-07-15 13:28:57 +00:00
mbiryukova force-pushed feature/epoch_from_object_put from 249f76cfe8 to 2c2bcfc834 2024-07-15 14:52:41 +00:00 Compare
alexvanin merged commit 7e94a6adf2 into master 2024-07-22 06:15:26 +00:00
alexvanin deleted branch feature/epoch_from_object_put 2024-07-22 06:15:29 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-sdk-developers
TrueCloudLab/storage-services-developers
No milestone
No project
No assignees
6 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-sdk-go#237
No description provided.