From 74c861342e19611dba534bb719aafda757f0d009 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 5 Sep 2022 16:46:56 +0300 Subject: [PATCH] [#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 --- pkg/services/tree/service.go | 3 ++- pkg/services/tree/service.pb.go | Bin 97443 -> 99801 bytes pkg/services/tree/service.proto | 2 ++ pkg/services/tree/service_grpc.pb.go | Bin 15010 -> 15166 bytes pkg/services/tree/service_neofs.pb.go | Bin 46953 -> 47054 bytes pkg/services/tree/types.pb.go | Bin 9666 -> 9843 bytes 6 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/services/tree/service.go b/pkg/services/tree/service.go index 374e80ae53..4506095ee7 100644 --- a/pkg/services/tree/service.go +++ b/pkg/services/tree/service.go @@ -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 { diff --git a/pkg/services/tree/service.pb.go b/pkg/services/tree/service.pb.go index a278e582772218b74057414d9342863e547151b4..1f4a74c6fe660a3b9365e8fb9ec2d1b4cbcdc854 100644 GIT binary patch delta 5802 zcmcgvYjjlA65%*+n{g|Y! zfZuM{N$c|VD6-?o#uZivHbA4NZfuq?QAv_CQ226OD8G9q>oyu1%LF*QODS!0T#HZ6 z)|qB_WP|cH1WCrSj<{|*Q;`AkDEt%Sik6$~s&kghL$QDKcMmnRtXZ3Ny^JGNjfU6Qn;`jxnVmM&X0 z1|U|Fp*~4+EI$^Xnt|iyJE6uR*aNENX7RFY;c$5aJfk5t0k^n?14DN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v;Qx&*2SWfEXxWyd!M579qtl3X=(Eg4ei ziJgTxJd{S&DNGRi?Gj+xnZi8SRc5#}1X)3BHIlP{C998S@?V(+cCBRLlq|Baqu)fQ zvY-?zKQqv9BE*xB&GK%%qo*aAi~!a(1?|q36olLESm<&dgwkL(SeVU9xy@-|=sQ9n zovO3Jfbm0#eCK5Q{PYgid`&LsLu__xD*`L_K1!qkJ415L2+2H^g8t+H3#VX{1JWg; zSjy0dCVvGI*lhlijn!Y7>D62)C2JnAVd7wib6Gpsu9CCMq=2`A+_sj1d|v3w-jVN{vHD^rm?t_$KHHl~xNyiy83m9<W>5mJv&T`$9Gw30Vz%VjG;r86sip+-BROrkIXtgJnjgE% tBG91{sE}^#tE3xt#_pLFg_J@CD+c2~DWuL)NaD}G_%x>Hqf*e#{|~EPb;1Au diff --git a/pkg/services/tree/service.proto b/pkg/services/tree/service.proto index 94741c4dae..43aba82c42 100644 --- a/pkg/services/tree/service.proto +++ b/pkg/services/tree/service.proto @@ -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. diff --git a/pkg/services/tree/service_grpc.pb.go b/pkg/services/tree/service_grpc.pb.go index 7de60958c8118e3aa2403261ab52fa45d05b5eee..091f30c5c5604978ac25e24424112f20dbad418b 100644 GIT binary patch delta 172 zcmZ2fy02_P1Ea~t#v=B~ev)i%{slhy=?X=uC8b4q#R`cE#U(|liMa~-X$m>{>FKE{ z3i$=8MTsSu`9Rs?lEk8t%)E4kw4(f6h2s3&RE3Px%=C;Bz0Dul&4j6Go~m@MJOHwW BKbZgk delta 22 ecmdm2wy1PM1Eb-_#v=C3jvOY!n-5D@%L4#zGzg~v diff --git a/pkg/services/tree/service_neofs.pb.go b/pkg/services/tree/service_neofs.pb.go index eb4b2b4732e97e7f4e6281fa4d693ce3fd192ace..0eea38fe017a51f1ba503f3daf78370b59c471bb 100644 GIT binary patch delta 70 zcmV-M0J;C^?gGy50lVBtZ0W`C0B%lG4P;C~I%w`O;KWSqDlW+wPlkj;2 clg~#Tldwk%lO$iIlV5EUldY{4vu|tqOB#6{fB*mh delta 36 ucmV+<0Nel0?*i%W0EwhMBXVYc5Pm@DRHI diff --git a/pkg/services/tree/types.pb.go b/pkg/services/tree/types.pb.go index 5a2173073688a680211ad36e61aaaff21ad73745..5dac12d551c33c492797fb26df806b1128c972ed 100644 GIT binary patch delta 221 zcmY+8y=uZx7=~#x83zX;;?#F69nM)q=PZ>HDFw$)C&{ONn7^K%)O7X&3T~ae1@R7g zOWuG9xVXL#&%^s4T^2JbUwkPMx*cb%bOU3xORUpmU`sed_-4C-)kH9)Yfeb`{%`d# zIei@;N1bb}=Ga+6q4E~?B5DqSHy_@yT4j#J`P19?r!82LW|i>|rKnt-ae^&1PzEWj vxM)`{@J{9H65+?&ttkfMgY?8xr}Mf{-Aj}!DCA^}S`*?jZN&L`@E2SGVO~iL delta 55 zcmezDbI5z5c>$y0#uW>gSiMs#6%;1NGrMoz&D_Mz0^&|Sz$`hrhhL8+I5RyD$WhtM IEKnc@05uE}%>V!Z