code: func (s *Store) kvsDeleteTreeTxn(tx *memdb.Txn, idx uint64, prefix string) error {
  
  	// For prefix deletes, only insert one tombstone and delete the entire subtree
  
  	deleted, err := tx.DeletePrefix("kvs", "id_prefix", prefix)
  
  	if err != nil {
  		return fmt.Errorf("failed recursive deleting kvs entry: %s", err)
  	}
  
  	if deleted {
  		if prefix != "" { // don't insert a tombstone if the entire tree is deleted, all watchers on keys will see the max_index of the tree
  			if err := s.kvsGraveyard.InsertTxn(tx, prefix, idx); err != nil {
  				return fmt.Errorf("failed adding to graveyard: %s", err)
  			}
  		}
  		if err := tx.Insert("index", &IndexEntry{"kvs", idx}); err != nil {
  			return fmt.Errorf("failed updating index: %s", err)
  		}
  	}
  	return nil
  }
docs: // kvsDeleteTreeTxn is the inner method that does a recursive delete inside an
  // existing transaction.