[#1621] pilorama: Remove Timestamp field from nodeInfo

It is already present in `Meta`.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-07-22 13:02:28 +03:00 committed by Anton Nikiforov
parent 1044adbe94
commit e1c3bdbfa6
2 changed files with 5 additions and 6 deletions

View file

@ -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)
}
})
}

View file

@ -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 {