// Delete a tree - if the tree exists will return the CommitID of the latest saved version
962284
func (muf *MutableForest) Delete(prefix []byte) (*CommitID, error) {
	bs, removed := muf.commitsTree.Delete(prefix)
	if !removed {
		return nil, nil
	}
	return UnmarshalCommitID(bs)
}
345639
func (n *Node) delete(comparator Comparator, key *Key) *Key {
	i := n.search(comparator, key.Value)
	if i == len(n.ChildValues) {
		return nil
	}

	n.deleteValueAt(i)
	n.deleteKeyAt(i)

	return key
}
843122
func (c *CommitLog) DeleteAll() error {
	if err := c.Close(); err != nil {
		return err
	}
	return os.RemoveAll(c.path)
}
396427
func (s *Server) Delete(ctx context.Context, filePath string, version topo.Version) error {
	nodePath := path.Join(s.root, filePath)

	if version != nil {
		// We have to do a transaction. This means: if the
		// node revision is what we expect, delete it,
		// otherwise get the file. If the transaction doesn't
		// succeed, we also ask for the value of the
		// node. That way we'll know if it failed because it
		// didn't exist, or because the version was wrong.
		txnresp, err := s.cli.Txn(ctx).
			If(clientv3.Compare(clientv3.ModRevision(nodePath), "=", int64(version.(EtcdVersion)))).
			Then(clientv3.OpDelete(nodePath)).
			Else(clientv3.OpGet(nodePath)).
			Commit()
		if err != nil {
			return convertError(err, nodePath)
		}
		if !txnresp.Succeeded {
			if len(txnresp.Responses) > 0 {
				if len(txnresp.Responses[0].GetResponseRange().Kvs) > 0 {
					return topo.NewError(topo.BadVersion, nodePath)
				}
			}
			return topo.NewError(topo.NoNode, nodePath)
		}
		return nil
	}

	// This is just a regular unconditional Delete here.
	resp, err := s.cli.Delete(ctx, nodePath)
	if err != nil {
		return convertError(err, nodePath)
	}
	if resp.Deleted != 1 {
		return topo.NewError(topo.NoNode, nodePath)
	}
	return nil
}
128612
func (d *Database) Del(path string) {
	d.mtx.Lock()
	defer d.mtx.Unlock()

	if path == "" {
		d.root = &Node{
			Children: map[string]*Node{},
		}
		return
	}

	rabbitHole := strings.Split(path, "/")
	current := d.root

	// traverse to target node's parent
	var delIdx int
	for ; delIdx < len(rabbitHole)-1; delIdx++ {
		next, ok := current.Children[rabbitHole[delIdx]]
		if !ok {
			// item does not exist, no need to do anything
			return
		}

		current = next
	}

	endNode := current
	leafPath := rabbitHole[len(rabbitHole)-1]
	delete(endNode.Children, leafPath)

	for tmp := endNode.prune(); tmp != nil; tmp = tmp.prune() {
		delIdx--
		endNode = tmp
	}

	if endNode != nil {
		delete(endNode.Children, rabbitHole[delIdx])
	}
}
705285
func (c *FakeNodes) Delete(name string, options *v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewRootDeleteAction(nodesResource, name), &corev1.Node{})
	return err
}
97451
func (s *MockStore) DeleteTree(prefix string) error {
	delete(s.db, prefix)
	return nil
}
1224784
func (c *DbClient) Delete(path, key string) {
	c.Lock()
	defer c.Unlock()

	fileData, ok := c.db[path]
	if !ok {
		return
	}
	delete(fileData, key)
}
629031
func (sync *NodeSync) Delete(node *v1.Node) {
	sync.opChan <- &deleteOp{node}
	close(sync.opChan)
}
998973
func (tree *MutableTree) Remove(key []byte) ([]byte, bool) {
	val, orphaned, removed := tree.remove(key)
	tree.addOrphans(orphaned)
	return val, removed
}
491356
func DeleteNode(tx Tx, id string) error {
	return tx.delete(tableNode, id)
}
593588
func (m *tree) deleteLeftmost() (*tree, *tree) {
	if m.isLeaf() {
		return m, nilMap
	}

	for i, t := range m.children {
		if t != nilMap {
			deleted, child := t.deleteLeftmost()
			newMap := m.clone()
			newMap.children[i] = child
			recalculateCount(newMap)
			return deleted, newMap
		}
	}
	panic("Tree isn't a leaf but also had no children. How does that happen?")
}
351763
func (b *BinaryTree) Delete(value Comparable) *Comparable {
	// first find the node because of my decision to not allow access to nodes.
	node := b.search(value)
	if node == nil {
		return nil
	}
	if node.left == nil {
		b.transplant(node, node.right)
	} else if node.right == nil {
		b.transplant(node, node.left)
	} else {
		replacement := minimum(node.right)
		if replacement.parent != node {
			b.transplant(replacement, replacement.right) // sever ties
			replacement.right = node.right
		}
		replacement.right.parent = replacement
		replacement.left = node.left
		replacement.left.parent = replacement
		b.transplant(node, replacement)
	}
	return &node.value
}
285298
func (nt *NodeTree) RemoveNode(n *v1.Node) error {
	nt.mu.Lock()
	defer nt.mu.Unlock()
	return nt.removeNode(n)
}
889253
func (t *txn) Delete(key string) keyval.BytesTxn {
	t.updates = append(t.updates, &update{
		key:   []byte(key),
		value: nil,
	})
	return t
}
465321
func (tree *MutableTree) remove(key []byte) (value []byte, orphans []*Node, removed bool) {
	if tree.root == nil {
		return nil, nil, false
	}
	newRootHash, newRoot, _, value, orphaned := tree.recursiveRemove(tree.root, key)
	if len(orphaned) == 0 {
		return nil, nil, false
	}

	if newRoot == nil && newRootHash != nil {
		tree.root = tree.ndb.GetNode(newRootHash)
	} else {
		tree.root = newRoot
	}
	return value, orphaned, true
}
769849
func (s *S3) Delete(ctx context.Context, path string) error {
	return fmt.Errorf("Delete not implemented for S3")
}