From e1c3bdbfa68b379a1f505c804bd04227c0977936 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Fri, 22 Jul 2022 13:02:28 +0300 Subject: [PATCH] [#1621] pilorama: Remove `Timestamp` field from `nodeInfo` It is already present in `Meta`. Signed-off-by: Evgenii Stratonikov Signed-off-by: Evgenii Stratonikov --- pkg/local_object_storage/pilorama/forest_test.go | 2 +- pkg/local_object_storage/pilorama/inmemory.go | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/local_object_storage/pilorama/forest_test.go b/pkg/local_object_storage/pilorama/forest_test.go index e31e5fe9..d7ddbc70 100644 --- a/pkg/local_object_storage/pilorama/forest_test.go +++ b/pkg/local_object_storage/pilorama/forest_test.go @@ -859,7 +859,7 @@ func testTreeGetByPath(t *testing.T, s Forest) { single := mf.treeMap[cid.String()+"/"+treeID] t.Run("test meta", func(t *testing.T) { for i := 0; i < 6; i++ { - require.Equal(t, uint64(i), single.infoMap[Node(i+1)].Timestamp) + require.Equal(t, uint64(i), single.infoMap[Node(i+1)].Meta.Time) } }) } diff --git a/pkg/local_object_storage/pilorama/inmemory.go b/pkg/local_object_storage/pilorama/inmemory.go index b9a24158..8a6a3d86 100644 --- a/pkg/local_object_storage/pilorama/inmemory.go +++ b/pkg/local_object_storage/pilorama/inmemory.go @@ -2,9 +2,8 @@ package pilorama // nodeInfo couples parent and metadata. type nodeInfo struct { - Parent Node - Meta Meta - Timestamp Timestamp + Parent Node + Meta Meta } // state represents state being replicated. @@ -98,7 +97,7 @@ func (s *state) do(op *Move) LogMove { } if !ok { - p.Timestamp = op.Time + p.Meta.Time = op.Time } else { s.removeChild(op.Child, p.Parent) } @@ -206,7 +205,7 @@ func (t tree) get(attr string, path []string, latest bool) []Node { fileName := string(info.Meta.GetAttr(attr)) if fileName == path[len(path)-1] { if latest { - if info.Timestamp >= lastTs { + if info.Meta.Time >= lastTs { nodes = append(nodes[:0], children[i]) } } else {