[#1753] services/tree: Add parent ID to the GetNodeByPath response

Currently, you need to use `GetSubTree` to get parent, which seems an
overkill.

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-09-05 16:46:56 +03:00 committed by fyrchik
parent 8a47f9ba12
commit 74c861342e
6 changed files with 4 additions and 1 deletions

View file

@ -308,12 +308,13 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest)
info := make([]*GetNodeByPathResponse_Info, 0, len(nodes))
for _, node := range nodes {
m, _, err := s.forest.TreeGetMeta(cid, b.GetTreeId(), node)
m, parent, err := s.forest.TreeGetMeta(cid, b.GetTreeId(), node)
if err != nil {
return nil, err
}
var x GetNodeByPathResponse_Info
x.ParentId = parent
x.NodeId = node
x.Timestamp = m.Time
if b.AllAttributes {

Binary file not shown.

View file

@ -202,6 +202,8 @@ message GetNodeByPathResponse {
uint64 timestamp = 2;
// Node meta-information.
repeated KeyValue meta = 3;
// Parent ID.
uint64 parent_id = 4;
}
message Body {
// List of nodes stored by path.

Binary file not shown.

Binary file not shown.

Binary file not shown.