forked from TrueCloudLab/frostfs-node
[#539] getsvc: Use buffer to assemble object
To reduce memory consumption. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
32c77f3a23
commit
286242cad0
4 changed files with 20 additions and 7 deletions
|
@ -49,10 +49,18 @@ func NewSimpleObjectWriter() *SimpleObjectWriter {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *SimpleObjectWriter) SetPayloadBuffer(buffer []byte) {
|
||||
if buffer != nil {
|
||||
s.pld = buffer[:0]
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SimpleObjectWriter) WriteHeader(_ context.Context, obj *objectSDK.Object) error {
|
||||
s.obj = obj
|
||||
|
||||
s.pld = make([]byte, 0, obj.PayloadSize())
|
||||
if s.pld == nil {
|
||||
s.pld = make([]byte, 0, obj.PayloadSize())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue