[#62] object/transformer: Fix incorrect relation init stage
In previous implementation InitRelations call in payload size limiter was called in write chunk method. This provoked clearing the split header in children starting from the second. Replace InitRelations call to the 1st child allocating stage. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
13080aa7a1
commit
64691e6248
1 changed files with 3 additions and 3 deletions
|
@ -79,6 +79,9 @@ func (s *payloadSizeLimiter) initialize() {
|
||||||
s.parent.ResetRelations()
|
s.parent.ResetRelations()
|
||||||
s.parentHashers = s.currentHashers
|
s.parentHashers = s.currentHashers
|
||||||
s.current = fromObject(s.parent)
|
s.current = fromObject(s.parent)
|
||||||
|
|
||||||
|
// initialize blank split header
|
||||||
|
s.current.InitRelations()
|
||||||
}
|
}
|
||||||
|
|
||||||
// set previous object to the last previous identifier
|
// set previous object to the last previous identifier
|
||||||
|
@ -217,9 +220,6 @@ func (s *payloadSizeLimiter) initializeLinking() {
|
||||||
func (s *payloadSizeLimiter) writeChunk(chunk []byte) error {
|
func (s *payloadSizeLimiter) writeChunk(chunk []byte) error {
|
||||||
// statement is true if the previous write of bytes reached exactly the boundary.
|
// statement is true if the previous write of bytes reached exactly the boundary.
|
||||||
if s.written > 0 && s.written%s.maxSize == 0 {
|
if s.written > 0 && s.written%s.maxSize == 0 {
|
||||||
// initialize blank split header
|
|
||||||
s.current.InitRelations()
|
|
||||||
|
|
||||||
// we need to release current object
|
// we need to release current object
|
||||||
if _, err := s.release(false); err != nil {
|
if _, err := s.release(false); err != nil {
|
||||||
return errors.Wrap(err, "could not release object")
|
return errors.Wrap(err, "could not release object")
|
||||||
|
|
Loading…
Reference in a new issue