forked from TrueCloudLab/frostfs-node
[#199] putsvc: Refactor put object
Resolve containedctx linter for streamer and remote target Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
cecea8053a
commit
27bdddc48f
24 changed files with 171 additions and 125 deletions
|
@ -2,6 +2,7 @@ package putsvc
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
@ -92,7 +93,7 @@ func (t *validatingTarget) WriteHeader(obj *objectSDK.Object) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (t *validatingTarget) Write(p []byte) (n int, err error) {
|
||||
func (t *validatingTarget) Write(ctx context.Context, p []byte) (n int, err error) {
|
||||
chunkLn := uint64(len(p))
|
||||
|
||||
if !t.unpreparedObject {
|
||||
|
@ -107,7 +108,7 @@ func (t *validatingTarget) Write(p []byte) (n int, err error) {
|
|||
}
|
||||
}
|
||||
|
||||
n, err = t.nextTarget.Write(p)
|
||||
n, err = t.nextTarget.Write(ctx, p)
|
||||
if err == nil {
|
||||
t.writtenPayload += uint64(n)
|
||||
}
|
||||
|
@ -115,7 +116,7 @@ func (t *validatingTarget) Write(p []byte) (n int, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func (t *validatingTarget) Close() (*transformer.AccessIdentifiers, error) {
|
||||
func (t *validatingTarget) Close(ctx context.Context) (*transformer.AccessIdentifiers, error) {
|
||||
if !t.unpreparedObject {
|
||||
// check payload size correctness
|
||||
if t.payloadSz != t.writtenPayload {
|
||||
|
@ -127,5 +128,5 @@ func (t *validatingTarget) Close() (*transformer.AccessIdentifiers, error) {
|
|||
}
|
||||
}
|
||||
|
||||
return t.nextTarget.Close()
|
||||
return t.nextTarget.Close(ctx)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue