forked from TrueCloudLab/frostfs-node
[#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:
parent
8a47f9ba12
commit
74c861342e
6 changed files with 4 additions and 1 deletions
|
@ -308,12 +308,13 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest)
|
||||||
|
|
||||||
info := make([]*GetNodeByPathResponse_Info, 0, len(nodes))
|
info := make([]*GetNodeByPathResponse_Info, 0, len(nodes))
|
||||||
for _, node := range 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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var x GetNodeByPathResponse_Info
|
var x GetNodeByPathResponse_Info
|
||||||
|
x.ParentId = parent
|
||||||
x.NodeId = node
|
x.NodeId = node
|
||||||
x.Timestamp = m.Time
|
x.Timestamp = m.Time
|
||||||
if b.AllAttributes {
|
if b.AllAttributes {
|
||||||
|
|
BIN
pkg/services/tree/service.pb.go
generated
BIN
pkg/services/tree/service.pb.go
generated
Binary file not shown.
|
@ -202,6 +202,8 @@ message GetNodeByPathResponse {
|
||||||
uint64 timestamp = 2;
|
uint64 timestamp = 2;
|
||||||
// Node meta-information.
|
// Node meta-information.
|
||||||
repeated KeyValue meta = 3;
|
repeated KeyValue meta = 3;
|
||||||
|
// Parent ID.
|
||||||
|
uint64 parent_id = 4;
|
||||||
}
|
}
|
||||||
message Body {
|
message Body {
|
||||||
// List of nodes stored by path.
|
// List of nodes stored by path.
|
||||||
|
|
BIN
pkg/services/tree/service_grpc.pb.go
generated
BIN
pkg/services/tree/service_grpc.pb.go
generated
Binary file not shown.
BIN
pkg/services/tree/service_neofs.pb.go
generated
BIN
pkg/services/tree/service_neofs.pb.go
generated
Binary file not shown.
BIN
pkg/services/tree/types.pb.go
generated
BIN
pkg/services/tree/types.pb.go
generated
Binary file not shown.
Loading…
Reference in a new issue