// deleteRangeInclusive deletes all steps within the given range.
// Note that llrb.(*Tree).DoRange does not operate on the node matching the end of a range.
329457
func deleteRangeInclusive(t *llrb.Tree, start, end int) {
	var delQ []llrb.Comparable
	t.DoRange(func(c llrb.Comparable) (done bool) {
		delQ = append(delQ, c)
		return
	}, query(start), query(end+1))
	for _, p := range delQ {
		t.Delete(p)
	}
}
158015
func (r *raftLog) DeleteRange(min, max uint64) (retErr error) {
	r.Lock()
	defer r.Unlock()

	start := time.Now()
	r.log.Noticef("Deleting raft logs from %v to %v", min, max)
	err := r.deleteRange(min, max)
	dur := time.Since(start)
	durTxt := fmt.Sprintf("Deletion took %v", dur)
	if dur > 2*time.Second {
		r.log.Errorf(durTxt)
	} else {
		r.log.Noticef(durTxt)
	}
	return err
}
1042302
func (c *Client) DeleteTree(prefix string) error {
	return c.deleteRecurse(prefix, true)
}
962076
func (mg *MailgunImpl) DeleteRoute(ctx context.Context, id string) error {
	r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id)
	r.setClient(mg.Client())
	r.setBasicAuth(basicAuthUser, mg.APIKey())
	_, err := makeDeleteRequest(ctx, r)
	return err
}
1205222
func NewTermRangeInclusiveQuery(min, max string, minInclusive, maxInclusive *bool) *query.TermRangeQuery {
	return query.NewTermRangeInclusiveQuery(min, max, minInclusive, maxInclusive)
}
613512
func (db *DB) DeleteAllEntries() {
	db.mu.Lock()
	defer db.mu.Unlock()

	db.expectedExecuteFetch = make([]ExpectedExecuteFetch, 0)
	db.expectedExecuteFetchIndex = 0
}
724515
func (t *LLRB) DeleteMax() Item {
	var deleted Item
	t.root, deleted = deleteMax(t.root)
	if t.root != nil {
		t.root.Black = true
	}
	if deleted != nil {
		t.count--
	}
	return deleted
}
747266
func (i *Index) DeleteRule(objectID string, opts ...interface{}) (res UpdateTaskRes, err error) {
	if objectID == "" {
		err = errs.ErrMissingObjectID
		res.wait = noWait
		return
	}

	path := i.path("/rules/%s", url.QueryEscape(objectID))
	err = i.transport.Request(&res, http.MethodDelete, path, nil, call.Write, opts...)
	res.wait = i.WaitTask
	return
}
1227207
func LoadDeleteRanges(ctx sessionctx.Context, safePoint uint64) (ranges []DelRangeTask, _ error) {
	return loadDeleteRangesFromTable(ctx, deleteRangesTable, safePoint)
}
421679
func (s *Wrapper) DeleteRange(ctx context.Context, startKey []byte, endKey []byte) error {
	return s.backend.DeleteRange(ctx, startKey, endKey)
}
798743
func (m *CouchDBBackend) DeleteInternal(ctx context.Context, key string) error {
	defer metrics.MeasureSince([]string{"couchdb", "delete"}, time.Now())

	revision, _ := m.client.rev(url.PathEscape(key))
	deleted := true
	return m.client.put(couchDBEntry{
		ID:      url.PathEscape(key),
		Rev:     revision,
		Deleted: &deleted,
	})
}
1154038
func IsDeletionCandidate(obj metav1.Object, finalizer string) bool {
	return obj.GetDeletionTimestamp() != nil && slice.ContainsString(obj.GetFinalizers(),
		finalizer, nil)
}
946756
func (d *indirectIndex) DeleteRange(keys [][]byte, minTime, maxTime int64) bool {
	// If we're deleting everything, we won't need to worry about partial deletes.
	if minTime <= d.minTime && maxTime >= d.maxTime {
		return d.Delete(keys)
	}

	// Is the range passed in outside of the time range for the file?
	if minTime > d.maxTime || maxTime < d.minTime {
		return false
	}

	// General outline:
	// Under the read lock, determine the set of actions we need to
	// take and on what keys to take them. Then, under the write
	// lock, perform those actions. We keep track of some state
	// during the read lock to make double checking under the
	// write lock cheap.

	d.mu.RLock()
	iter := d.ro.Iterator()
	var (
		ok      bool
		trbuf   []TimeRange
		entries []IndexEntry
		pending []pendingTombstone
		err     error
	)

	for i, key := range keys {
		if !iter.Next() || !bytes.Equal(iter.Key(&d.b), key) {
			if exact, _ := iter.Seek(key, &d.b); !exact {
				continue
			}
		}

		entryOffset := iter.EntryOffset(&d.b)
		entries, err = readEntriesTimes(d.b.access(entryOffset, 0), entries)
		if err != nil {
			// If we have an error reading the entries for a key, we should just pretend
			// the whole key is deleted. Maybe a better idea is to report this up somehow
			// but that's for another time.
			iter.Delete()
			continue
		}

		// Is the time range passed outside of the time range we have stored for this key?
		min, max := entries[0].MinTime, entries[len(entries)-1].MaxTime
		if minTime > max || maxTime < min {
			continue
		}

		// Does the range passed in cover every value for the key?
		if minTime <= min && maxTime >= max {
			iter.Delete()
			continue
		}

		// Does adding the minTime and maxTime cover the entries?
		offset := iter.Offset()
		trbuf, ok = d.coversEntries(offset, key, trbuf, entries, minTime, maxTime)
		if ok {
			iter.Delete()
			continue
		}

		// Save that we should add a tombstone for this key, and how many tombstones
		// already existed to avoid double checks.
		pending = append(pending, pendingTombstone{
			Key:         i,
			Index:       iter.Index(),
			Offset:      offset,
			EntryOffset: entryOffset,
			Tombstones:  len(d.tombstones[offset]),
		})
	}

	d.mu.RUnlock()

	if len(pending) == 0 && !iter.HasDeletes() {
		return false
	}

	d.mu.Lock()
	defer d.mu.Unlock()

	for _, p := range pending {
		// Check the existing tombstones. If the length did not/ change, then we know
		// that we don't need to double check coverage, since we only ever increase the
		// number of tombstones for a key.
		if trs := d.tombstones[p.Offset]; p.Tombstones == len(trs) {
			d.tombstones[p.Offset] = insertTimeRange(trs, minTime, maxTime)
			continue
		}

		// Since the length changed, we have to do the expensive overlap check again.
		// We re-read the entries again under the write lock because this should be
		// rare and only during concurrent deletes to the same key. We could make
		// a copy of the entries before getting here, but that penalizes the common
		// no-concurrent case.
		entries, err = readEntriesTimes(d.b.access(p.EntryOffset, 0), entries)
		if err != nil {
			// If we have an error reading the entries for a key, we should just pretend
			// the whole key is deleted. Maybe a better idea is to report this up somehow
			// but that's for another time.
			delete(d.tombstones, p.Offset)
			iter.SetIndex(p.Index)
			if iter.Offset() == p.Offset {
				iter.Delete()
			}
			continue
		}

		trbuf, ok = d.coversEntries(p.Offset, keys[p.Key], trbuf, entries, minTime, maxTime)
		if ok {
			delete(d.tombstones, p.Offset)
			iter.SetIndex(p.Index)
			if iter.Offset() == p.Offset {
				iter.Delete()
			}
			continue
		}

		// Append the TimeRange into the tombstones.
		trs := d.tombstones[p.Offset]
		d.tombstones[p.Offset] = insertTimeRange(trs, minTime, maxTime)
	}

	iter.Done()
	return true
}
25484
func NewTermRangeInclusiveQuery(min, max string, minInclusive, maxInclusive *bool) *TermRangeQuery {
	return &TermRangeQuery{
		Min:          min,
		Max:          max,
		InclusiveMin: minInclusive,
		InclusiveMax: maxInclusive,
	}
}
503335
func (g *Graph) deleteEdges_locked(fromType, toType vertexType, toNamespace, toName string) {
	// get the "to" side
	toVert, exists := g.getVertex_rlocked(toType, toNamespace, toName)
	if !exists {
		return
	}

	// delete all edges between vertices of fromType and toVert
	neighborsToRemove := []*namedVertex{}
	neighborsToRecompute := []*namedVertex{}
	g.graph.VisitTo(toVert, func(from graph.Node) bool {
		fromVert := from.(*namedVertex)
		if fromVert.vertexType != fromType {
			return true
		}
		// remove the edge
		g.graph.RemoveEdge(simple.Edge{F: fromVert, T: toVert})
		// track vertexes that changed edges
		if g.graph.Degree(fromVert) == 0 {
			neighborsToRemove = append(neighborsToRemove, fromVert)
		} else {
			neighborsToRecompute = append(neighborsToRecompute, fromVert)
		}
		return true
	})

	// clean up orphaned verts
	for _, v := range neighborsToRemove {
		g.removeVertex_locked(v)
	}

	// recompute destination indexes for neighbors that dropped outbound edges
	for _, v := range neighborsToRecompute {
		g.recomputeDestinationIndex_locked(v)
	}
}
879128
func (c *FakeClient) DeleteRelease(rlsName string, opts ...DeleteOption) (*rls.UninstallReleaseResponse, error) {
	for i, rel := range c.Rels {
		if rel.Name == rlsName {
			c.Rels = append(c.Rels[:i], c.Rels[i+1:]...)
			return &rls.UninstallReleaseResponse{
				Release: rel,
			}, nil
		}
	}

	return nil, storageerrors.ErrReleaseNotFound(rlsName)
}
1356146
func (s *Sanitizer) DeleteRange(ctx context.Context, startKey []byte, endKey []byte) error {
	if !isKeySafe(startKey) {
		return trace.BadParameter(errorMessage)
	}
	if !isKeySafe(endKey) {
		return trace.BadParameter(errorMessage)
	}
	return s.backend.DeleteRange(ctx, startKey, endKey)
}