// Remove - remove object or bucket(s).
325757
func (c *s3Client) Remove(isIncomplete, isRemoveBucket bool, contentCh <-chan *clientContent) <-chan *probe.Error {
	errorCh := make(chan *probe.Error)

	prevBucket := ""
	// Maintain objectsCh, statusCh for each bucket
	var objectsCh chan string
	var statusCh <-chan minio.RemoveObjectError

	go func() {
		defer close(errorCh)
		for content := range contentCh {
			// Convert content.URL.Path to objectName for objectsCh.
			bucket, objectName := c.splitPath(content.URL.Path)

			// We don't treat path when bucket is
			// empty, just skip it when it happens.
			if bucket == "" {
				continue
			}

			// Init objectsCh the first time.
			if prevBucket == "" {
				objectsCh = make(chan string)
				prevBucket = bucket
				if isIncomplete {
					statusCh = c.removeIncompleteObjects(bucket, objectsCh)
				} else {
					statusCh = c.api.RemoveObjects(bucket, objectsCh)
				}
			}

			if prevBucket != bucket {
				if objectsCh != nil {
					close(objectsCh)
				}
				for removeStatus := range statusCh {
					errorCh <- probe.NewError(removeStatus.Err)
				}
				// Remove bucket if it qualifies.
				if isRemoveBucket && !isIncomplete {
					if err := c.api.RemoveBucket(prevBucket); err != nil {
						errorCh <- probe.NewError(err)
					}
				}
				// Re-init objectsCh for next bucket
				objectsCh = make(chan string)
				if isIncomplete {
					statusCh = c.removeIncompleteObjects(bucket, objectsCh)
				} else {
					statusCh = c.api.RemoveObjects(bucket, objectsCh)
				}
				prevBucket = bucket
			}

			if objectName != "" {
				// Send object name once but continuously checks for pending
				// errors in parallel, the reason is that minio-go RemoveObjects
				// can block if there is any pending error not received yet.
				sent := false
				for !sent {
					select {
					case objectsCh <- objectName:
						sent = true
					case removeStatus := <-statusCh:
						errorCh <- probe.NewError(removeStatus.Err)
					}
				}
			} else {
				// end of bucket - close the objectsCh
				if objectsCh != nil {
					close(objectsCh)
				}
				objectsCh = nil
			}
		}
		// Close objectsCh at end of contentCh
		if objectsCh != nil {
			close(objectsCh)
		}
		// Write remove objects status to errorCh
		if statusCh != nil {
			for removeStatus := range statusCh {
				errorCh <- probe.NewError(removeStatus.Err)
			}
		}
		// Remove last bucket if it qualifies.
		if isRemoveBucket && prevBucket != "" && !isIncomplete {
			if err := c.api.RemoveBucket(prevBucket); err != nil {
				errorCh <- probe.NewError(err)
			}
		}
	}()
	return errorCh
}
904695
func (b *bucket) Delete(key []byte) error {
	if b.writable {
		return b.Bucket.Delete(key)
	}
	return kv.ErrTxNotWritable
}
443866
func (b *Bucket) Delete(k string) error {
	return b.Write(k, 0, 0, nil, Raw)
}
389163
func (s *Bucket) Delete() (*DeleteBucketOutput, error) {
	r, x, err := s.DeleteRequest()

	if err != nil {
		return x, err
	}

	err = r.Send()
	if err != nil {
		return nil, err
	}

	requestID := r.HTTPResponse.Header.Get(http.CanonicalHeaderKey("X-QS-Request-ID"))
	x.RequestID = &requestID

	return x, err
}
1250171
func (b *Bucket) Delete(key []byte) error {
	_ = b.btree.Delete(&item{key: key})
	return nil
}
1058579
func (c Collector) Remove(k string) {
	if c.Has(k) {
		delete(c, k)
	}
}
556589
func (rs *Set) Remove() error {
	conn := rs.pool.Get(rs.dbindex)
	_, err := conn.Do("DEL", rs.id)
	return err
}
1260190
func (s *Sublist) Remove(sub *subscription) error {
	return s.remove(sub, true)
}
71321
func (f *FS) Delete(ctx context.Context, obj string) error {
	params := &s3.DeleteObjectInput{
		Bucket: aws.String(f.bucket),
		Key:    aws.String(obj),
	}

	_, err := f.client.DeleteObjectWithContext(ctx, params)
	if err != nil {
		return err
	}
	return nil
}
536988
func (node *Node) Remove(keys []string) {

	if len(keys) == 0 {
		return
	}

	sort.Strings(keys)
	node.remove(keys)
}
790694
func (u *User) Remove(key string) {
	u.Lock()
	defer u.Unlock()
	delete(u.data, key)
}
348094
func (s *Service) Remove() error {
	err := s.remove()
	if errors.IsNotFound(err) {
		logger.Debugf("service %q not installed", s.Name())
		return nil
	} else if err != nil {
		logger.Errorf("failed to remove service %q: %v", s.Name(), err)
		return err
	}
	logger.Debugf("service %q successfully removed", s.Name())
	return nil
}
264913
func (m *Model) Remove() {
	for _, dir := range m.dirs {
		_ = os.RemoveAll(dir)
	}
}
1007504
func (b *Box) Remove(i int) {
	if len(b.children) <= i || i < 0 {
		return
	}

	b.children = append(b.children[:i], b.children[i+1:]...)
}
1170598
func (c *Container) Remove(ctx context.Context) error {
	if c.Engine == nil {
		return ErrNilEngine
	}
	return c.Engine.VirtualizationRemove(ctx, c.ID, true, true)
}
36463
func (s *Schedule) Remove(key interface{}) {
	if item, ok := s.m[key]; ok {
		heap.Remove(&s.items, item.i)
		delete(s.m, key)
	}
}
1205034
func (stor *maas2Storage) Remove(name string) error {
	name = stor.prefixWithPrivateNamespace(name)
	file, err := stor.maasController.GetFile(name)
	if err != nil {
		return errors.Trace(err)
	}
	return file.Delete()
}