func (n *node) AsDir() {
	if !n.IsDir() {
		n.Children = make(map[string]*node)
	}
	n.Notify(Delete)
}
AsDir convert node to dir
package store
import (
	"container/list"
	"encoding/json"
	"errors"
	"path"
	"sync"
)
type node struct {
	Name string `json:"name"`
	parent *node
	watchers *list.List
	Value    string           `json:"value"`     
	Children map[string]*node `json:"children"`  
	store *store  
	watcherLock sync.RWMutex
}
func newKV(store *store, nodeName string, value string, parent *node) *node {
	if len(nodeName) == 0 {
		panic(errors.New("nodeName can not be emtpy."))
	}
	n := &node{
		Name:        nodeName,
		parent:      parent,
		watchers:    nil,
		Children:    nil,
		Value:       value,
		store:       store,
		watcherLock: sync.RWMutex{},
	}
	parent.Add(n)
	n.Notify(Update)
	return n
}
func newDir(store *store, nodeName string, parent *node) *node {
	if len(nodeName) == 0 {
		panic(errors.New("nodeName can not be emtpy."))
	}
	n := &node{
		Name:     nodeName,
		parent:   parent,
		watchers: nil,
		Children: make(map[string]*node),
		store:    store,
	}
	if parent != nil {
		parent.Add(n)
	}
	return n
}
func (n *node) Path() string {
	if n.parent == nil {
		return n.Name
	} else {
		return path.Join(n.parent.Path(), n.Name)
	}
}
func (n *node) RelativePath(end *node) string {
	if n.parent == nil || n == end {
		return "/"
	} else {
		return path.Join(n.parent.RelativePath(end), n.Name)
	}
}
func (n *node) IsRoot() bool {
	return n.parent == nil
}
func (n *node) IsDir() bool {
	return n.Children != nil
}