forked from TrueCloudLab/frostfs-node
[#6] services/object: Simplify local/remote targets
We do not use the return result from Close() and we always execute both methods in succession. It makes sense to unite them. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
448b48287c
commit
5ff82ff04f
4 changed files with 27 additions and 58 deletions
|
@ -18,8 +18,7 @@ import (
|
|||
)
|
||||
|
||||
type preparedObjectTarget interface {
|
||||
WriteObject(*objectSDK.Object, object.ContentMeta) error
|
||||
Close(ctx context.Context) (*transformer.AccessIdentifiers, error)
|
||||
WriteObject(context.Context, *objectSDK.Object, object.ContentMeta) error
|
||||
}
|
||||
|
||||
type distributedTarget struct {
|
||||
|
@ -170,10 +169,9 @@ func (t *distributedTarget) sendObject(ctx context.Context, node nodeDesc) error
|
|||
|
||||
target := t.nodeTargetInitializer(node)
|
||||
|
||||
if err := target.WriteObject(t.obj, t.objMeta); err != nil {
|
||||
err := target.WriteObject(ctx, t.obj, t.objMeta)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not write header: %w", err)
|
||||
} else if _, err := target.Close(ctx); err != nil {
|
||||
return fmt.Errorf("could not close object stream: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue