From b0ad1b9ed2af18e2c222e4812fa5fb821478d008 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 30 Dec 2022 16:29:11 +0300 Subject: [PATCH] [#2193] pilorama: Use `do` in `TreeMove` It should be similar to a `TreeAddByPath`. `applyOperation` is used for `Apply` when the operation can be inserted in the middle of a log. Signed-off-by: Evgenii Stratonikov --- pkg/local_object_storage/pilorama/boltdb.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/local_object_storage/pilorama/boltdb.go b/pkg/local_object_storage/pilorama/boltdb.go index 4c4c4e3ce..3fb67d326 100644 --- a/pkg/local_object_storage/pilorama/boltdb.go +++ b/pkg/local_object_storage/pilorama/boltdb.go @@ -139,18 +139,18 @@ func (t *boltForest) TreeMove(d CIDDescriptor, treeID string, m *Move) (*LogMove } var lm LogMove + lm.Move = *m return &lm, t.db.Batch(func(tx *bbolt.Tx) error { bLog, bTree, err := t.getTreeBuckets(tx, d.CID, treeID) if err != nil { return err } - m.Time = t.getLatestTimestamp(bLog, d.Position, d.Size) - if m.Child == RootID { - m.Child = t.findSpareID(bTree) + lm.Time = t.getLatestTimestamp(bLog, d.Position, d.Size) + if lm.Child == RootID { + lm.Child = t.findSpareID(bTree) } - lm.Move = *m - return t.applyOperation(bLog, bTree, &lm) + return t.do(bLog, bTree, make([]byte, 17), &lm) }) }