// RemoveStaged deletes from the pinstore c if all
// existing pins are stage-pins, if not it fails.
// This is a safe method used by GCs to unpin unpinnable cids.
RemoveStaged deletes from the pinstore c if all
existing pins are stage-pins, if not it fails.
This is a safe method used by GCs to unpin unpinnable cids.
// RemoveStaged deletes from the pinstore c if all // existing pins are stage - pins if not it fails . // This is a safe method used by GCs to unpin unpinnable cids .
func (s *Store) RemoveStaged(c cid.Cid) error {
	s.lock.Lock()
	defer s.lock.Unlock()
	pc, ok := s.cache[c]
	if !ok {
		return fmt.Errorf("c isn't pinned")
	}
	for _, p := range pc.Pins {
		if !p.Staged {
			return fmt.Errorf("all pins should be stage type")
		}
	}
	if err := s.ds.Delete(makeKey(c)); err != nil {
		return fmt.Errorf("deleting from datastore: %s", err)
	}
	delete(s.cache, c)
	return nil
}
func ( s * Store ) RemoveStaged ( c cid . Cid ) error { s . lock . Lock ( ) defer s . lock . Unlock ( ) pc , ok := s . cache [ c ] if ! ok { return fmt . Errorf ( " " ) } for _ , p := range pc . Pins { if ! p . Staged { return fmt . Errorf ( " " ) } } if err := s . ds . Delete ( makeKey ( c ) ) ; err != nil { return fmt . Errorf ( " " , err ) } delete ( s . cache , c ) return nil }
RemoveStaged deletes from the pinstore c if all
existing pins are stage-pins, if not it fails.
RemoveStaged deletes from the pinstore c if all existing pins are stage - pins if not it fails .