// DeletePath removes a key from the tree.
// Keys is an array of path elements (e.g. {"a","b","c"}).
170140
func (t *Tree) DeletePath(keys []string) error {
	keyLen := len(keys)
	if keyLen == 1 {
		delete(t.values, keys[0])
		return nil
	}
	tree := t.GetPath(keys[:keyLen-1])
	item := keys[keyLen-1]
	switch node := tree.(type) {
	case *Tree:
		delete(node.values, item)
		return nil
	}
	return errors.New("no such key to delete")
}
225480
func (r *router) DELETE(path string, handler Route) {
	r.group.DELETE(path, handler)
}
944370
func (c *CloudAPI) DeleteKey(keyName string) error {
	if err := c.ProcessFunctionHook(c, keyName); err != nil {
		return err
	}

	for i, key := range c.keys {
		if key.Name == keyName {
			c.keys = append(c.keys[:i], c.keys[i+1:]...)
			return nil
		}
	}

	return fmt.Errorf("Key %s not found", keyName)
}
341257
func (s *encryptedKeyStorage) Delete(ctx context.Context, path string) error {
	encPath, err := s.encryptPath(path)
	if err != nil {
		return err
	}

	return s.s.Delete(ctx, encPath)
}
973112
func Delete(json, path string) (string, error) {
	return Set(json, path, dtype{})
}
551375
func (ptree *ptree) Delete(keys ...common.Comparator) {
	ra := newRemoveAction(keys)
	ptree.checkAndRun(ra)
	ra.completer.Wait()
}
469297
func (t *Mutable) Delete(key []byte) {
	// Find the node for the key along with its parent.  There is nothing to
	// do if the key does not exist.
	node, parent := t.get(key)
	if node == nil {
		return
	}

	// When the only node in the tree is the root node and it is the one
	// being deleted, there is nothing else to do besides removing it.
	if parent == nil && node.left == nil && node.right == nil {
		t.root = nil
		t.count = 0
		t.totalSize = 0
		return
	}

	// Perform rotations to move the node to delete to a leaf position while
	// maintaining the min-heap.
	var isLeft bool
	var child *treapNode
	for node.left != nil || node.right != nil {
		// Choose the child with the higher priority.
		if node.left == nil {
			child = node.right
			isLeft = false
		} else if node.right == nil {
			child = node.left
			isLeft = true
		} else if node.left.priority >= node.right.priority {
			child = node.left
			isLeft = true
		} else {
			child = node.right
			isLeft = false
		}

		// Rotate left or right depending on which side the child node
		// is on.  This has the effect of moving the node to delete
		// towards the bottom of the tree while maintaining the
		// min-heap.
		if isLeft {
			child.right, node.left = node, child.right
		} else {
			child.left, node.right = node, child.left
		}
		t.relinkGrandparent(child, node, parent)

		// The parent for the node to delete is now what was previously
		// its child.
		parent = child
	}

	// Delete the node, which is now a leaf node, by disconnecting it from
	// its parent.
	if parent.right == node {
		parent.right = nil
	} else {
		parent.left = nil
	}
	t.count--
	t.totalSize -= nodeSize(node)
}
587745
func (c *Client) Delete(key string) error {
	return c.deleteRecurse(key, false)
}
1173943
func (m *dirsMap) Delete(key string) {
	m.data.Delete(m.normalizeKey(key))
}
841866
func (p *PathManager) Paths() []string {
	p.l.RLock()
	defer p.l.RUnlock()

	paths := make([]string, 0, p.paths.Len())
	walkFn := func(k []byte, v interface{}) bool {
		paths = append(paths, string(k))
		return false
	}
	p.paths.Root().Walk(walkFn)
	return paths
}
773242
func (s *Section) DeleteKey(name string) {
	if s.f.BlockMode {
		s.f.lock.Lock()
		defer s.f.lock.Unlock()
	}

	for i, k := range s.keyList {
		if k == name {
			s.keyList = append(s.keyList[:i], s.keyList[i+1:]...)
			delete(s.keys, name)
			delete(s.keysHash, name)
			return
		}
	}
}
539186
func (c *Scratch) Delete(key string) string {
	c.mu.Lock()
	delete(c.values, key)
	c.mu.Unlock()
	return ""
}
137351
func (t *Tree) GetPath(keys []string) interface{} {
	if len(keys) == 0 {
		return t
	}
	subtree := t
	for _, intermediateKey := range keys[:len(keys)-1] {
		value, exists := subtree.values[intermediateKey]
		if !exists {
			return nil
		}
		switch node := value.(type) {
		case *Tree:
			subtree = node
		case []*Tree:
			// go to most recent element
			if len(node) == 0 {
				return nil
			}
			subtree = node[len(node)-1]
		default:
			return nil // cannot navigate through other node types
		}
	}
	// branch based on final node type
	switch node := subtree.values[keys[len(keys)-1]].(type) {
	case *tomlValue:
		return node.value
	default:
		return node
	}
}
1204909
func (c *Client) Delete(path string) error {
	return c.Send("DELETE", path, nil, nil)
}
617493
func (fs *FSLocalKeyStore) DeleteKey(host string, username string) error {
	dirPath, err := fs.dirFor(host, false)
	if err != nil {
		return trace.Wrap(err)
	}
	files := []string{
		filepath.Join(dirPath, username+fileExtCert),
		filepath.Join(dirPath, username+fileExtTLSCert),
		filepath.Join(dirPath, username+fileExtPub),
		filepath.Join(dirPath, username),
	}
	for _, fn := range files {
		if err = os.Remove(fn); err != nil {
			return trace.Wrap(err)
		}
	}
	return nil
}
155925
func (p *PathMap) Paths() []*Path {
	p.once.Do(p.init)

	// Build the schema by simply adding the "key"
	schema := make(map[string]*FieldSchema)
	for k, v := range p.Schema {
		schema[k] = v
	}
	schema["key"] = &FieldSchema{
		Type:        TypeString,
		Description: fmt.Sprintf("Key for the %s mapping", p.Name),
	}

	return []*Path{
		&Path{
			Pattern: fmt.Sprintf("%s/%s/?$", p.Prefix, p.Name),

			Callbacks: map[logical.Operation]OperationFunc{
				logical.ListOperation: p.pathList(),
				logical.ReadOperation: p.pathList(),
			},

			HelpSynopsis: fmt.Sprintf("Read mappings for %s", p.Name),
		},

		&Path{
			Pattern: fmt.Sprintf(`%s/%s/(?P<key>[-\w]+)`, p.Prefix, p.Name),

			Fields: schema,

			Callbacks: map[logical.Operation]OperationFunc{
				logical.CreateOperation: p.pathSingleWrite(),
				logical.ReadOperation:   p.pathSingleRead(),
				logical.UpdateOperation: p.pathSingleWrite(),
				logical.DeleteOperation: p.pathSingleDelete(),
			},

			HelpSynopsis: fmt.Sprintf("Read/write/delete a single %s mapping", p.Name),

			ExistenceCheck: p.pathSingleExistenceCheck(),
		},
	}
}
765821
func (s *Secret) DeleteKey(key string) error {
	if s.d == nil {
		return nil
	}
	delete(s.d, key)
	return nil
}