only occur check for DAGs

This commit is contained in:
vyzo 2021-07-05 11:11:08 +03:00
parent c81ae5fc20
commit 839f7bd2b5

View File

@ -1205,19 +1205,21 @@ func (s *SplitStore) walkObjectIncomplete(c cid.Cid, walked *cid.Set, f, missing
return nil
}
// occurs check
has, err := s.hot.Has(c)
if err != nil {
return xerrors.Errorf("error occur checking %s: %w", c, err)
}
if !has {
err = missing(c)
if err == errStopWalk {
return nil
// occurs check -- only for DAGs
if c.Prefix().Codec == cid.DagCBOR {
has, err := s.hot.Has(c)
if err != nil {
return xerrors.Errorf("error occur checking %s: %w", c, err)
}
return err
if !has {
err = missing(c)
if err == errStopWalk {
return nil
}
return err
}
}
if err := f(c); err != nil {
@ -1233,7 +1235,7 @@ func (s *SplitStore) walkObjectIncomplete(c cid.Cid, walked *cid.Set, f, missing
}
var links []cid.Cid
err = s.view(c, func(data []byte) error {
err := s.view(c, func(data []byte) error {
return cbg.ScanForLinks(bytes.NewReader(data), func(c cid.Cid) {
links = append(links, c)
})