Remove bufio writer and double creation of OffsetWriter

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
Evgeniy Kulikov 2020-12-10 18:15:18 +03:00
parent 776eed76fb
commit 8168181658

View file

@ -1,7 +1,6 @@
package layer package layer
import ( import (
"bufio"
"context" "context"
"io" "io"
"net/url" "net/url"
@ -68,11 +67,8 @@ func (n *layer) objectHead(ctx context.Context, address *object.Address) (*objec
// objectGet and write it into provided io.Reader. // objectGet and write it into provided io.Reader.
func (n *layer) objectGet(ctx context.Context, p *getParams) (*object.Object, error) { func (n *layer) objectGet(ctx context.Context, p *getParams) (*object.Object, error) {
// prepare length/offset writer // prepare length/offset writer
b := bufio.NewWriter(p.Writer) w := newWriter(p.Writer, p.offset, p.length)
w := newWriter(b, p.offset, p.length) return n.cli.Object().Get(ctx, p.address, sdk.WithGetWriter(w))
writer := newWriter(w, p.offset, p.length)
return n.cli.Object().Get(ctx, p.address, sdk.WithGetWriter(writer))
} }
// objectPut into NeoFS, took payload from io.Reader. // objectPut into NeoFS, took payload from io.Reader.