forked from TrueCloudLab/frostfs-node
[#539] getsvc: Write payload direct to out stream
To reduce memory allocations. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
286242cad0
commit
99bb488ebd
4 changed files with 27 additions and 28 deletions
|
@ -113,9 +113,10 @@ func (r *request) HeadObject(ctx context.Context, id oid.ID) (*objectSDK.Object,
|
|||
return w.Object(), nil
|
||||
}
|
||||
|
||||
func (r *request) GetObject(ctx context.Context, id oid.ID, rng *objectSDK.Range, payloadBuffer []byte) (*objectSDK.Object, error) {
|
||||
w := NewSimpleObjectWriter()
|
||||
w.SetPayloadBuffer(payloadBuffer)
|
||||
func (r *request) GetObjectAndWritePayload(ctx context.Context, id oid.ID, rng *objectSDK.Range, writer ChunkWriter) (*objectSDK.Object, error) {
|
||||
w := &payloadWriter{
|
||||
origin: writer,
|
||||
}
|
||||
|
||||
p := r.prm
|
||||
p.common = p.common.WithLocalOnly(false)
|
||||
|
@ -128,7 +129,7 @@ func (r *request) GetObject(ctx context.Context, id oid.ID, rng *objectSDK.Range
|
|||
if err := r.getObjectWithIndependentRequest(ctx, p); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return w.Object(), nil
|
||||
return w.obj, nil
|
||||
}
|
||||
|
||||
func (r *request) getObjectWithIndependentRequest(ctx context.Context, prm RequestParameters) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue