// Remove unpins c for iid regarding any pin type.
// If c is unpinned for iid, this is a noop.
Remove unpins c for iid regarding any pin type.
If c is unpinned for iid, this is a noop.
// Remove unpins c for iid regarding any pin type . // If c is unpinned for iid this is a noop .
func (s *Store) Remove(iid ffs.APIID, c cid.Cid) error {
	s.lock.Lock()
	defer s.lock.Unlock()
	r, ok := s.cache[c]
	if !ok {
		log.Warnf("%s removing globally unpinned cid %s", iid, c)
		return nil
	}
	c1idx := -1
	for i, p := range r.Pins {
		if p.APIID == iid {
			c1idx = i
			break
		}
	}
	if c1idx == -1 {
		log.Warnf("%s removing unpinned cid %s", iid, c)
		return nil
	}
	r.Pins[c1idx] = r.Pins[len(r.Pins)-1]
	r.Pins = r.Pins[:len(r.Pins)-1]
	return s.persist(r)
}
func ( s * Store ) Remove ( iid ffs . APIID , c cid . Cid ) error { s . lock . Lock ( ) defer s . lock . Unlock ( ) r , ok := s . cache [ c ] if ! ok { log . Warnf ( " " , iid , c ) return nil } c1idx := - 1 for i , p := range r . Pins { if p . APIID == iid { c1idx = i break } } if c1idx == - 1 { log . Warnf ( " " , iid , c ) return nil } r . Pins [ c1idx ] = r . Pins [ len ( r . Pins ) - 1 ] r . Pins = r . Pins [ : len ( r . Pins ) - 1 ] return s . persist ( r ) }
Remove unpins c for iid regarding any pin type.
Remove unpins c for iid regarding any pin type .