forked from TrueCloudLab/frostfs-node
[#1329] tree: Do not sync trees that are from external containers
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
ea9a5690cb
commit
f5f560d903
1 changed files with 9 additions and 1 deletions
|
@ -14,13 +14,21 @@ import (
|
|||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
|
||||
// ErrNotInContainer is returned when operation could not be performed
|
||||
// because the node is not included in the container.
|
||||
var ErrNotInContainer = errors.New("node is not in container")
|
||||
|
||||
// Synchronize tries to synchronize log starting from the last stored height.
|
||||
func (s *Service) Synchronize(ctx context.Context, cid cid.ID, treeID string) error {
|
||||
nodes, _, err := s.getContainerNodes(cid)
|
||||
nodes, pos, err := s.getContainerNodes(cid)
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't get container nodes: %w", err)
|
||||
}
|
||||
|
||||
if pos < 0 {
|
||||
return ErrNotInContainer
|
||||
}
|
||||
|
||||
lm, err := s.forest.TreeGetOpLog(cid, treeID, 0)
|
||||
if err != nil && !errors.Is(err, pilorama.ErrTreeNotFound) {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue