[#266] services/tree: Return operation log up to some height
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
ec73bda3f8
commit
98d6580eb8
1 changed files with 5 additions and 1 deletions
|
@ -532,9 +532,13 @@ func (s *Service) GetOpLog(req *GetOpLogRequest, srv TreeService_GetOpLogServer)
|
||||||
}
|
}
|
||||||
|
|
||||||
h := b.GetHeight()
|
h := b.GetHeight()
|
||||||
|
lastHeight, err := s.forest.TreeHeight(srv.Context(), cid, b.GetTreeId())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
for {
|
for {
|
||||||
lm, err := s.forest.TreeGetOpLog(srv.Context(), cid, b.GetTreeId(), h)
|
lm, err := s.forest.TreeGetOpLog(srv.Context(), cid, b.GetTreeId(), h)
|
||||||
if err != nil || lm.Time == 0 {
|
if err != nil || lm.Time == 0 || lastHeight < lm.Time {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue