src/server/pkg/hashtree/db.go
func (u *Unordered) Ordered() *Ordered {
	paths := make([]string, len(u.fs))
	i := 0
	for path := range u.fs {
		paths[i] = path
		i++
	}
	sort.Strings(paths)
	o := NewOrdered("")
	for i := 1; i < len(paths); i++ {
		path := paths[i]
		n := u.fs[path]
		if n.DirNode != nil {
			o.putDir(path, n)
		} else {
			o.putFile(path, n)
		}
	}
	return o
}
func (u *Unordered) Ordered() *Ordered {
	paths := make([]string, len(u.fs))
	i := 0
	for path := range u.fs {
		paths[i] = path
		i++
	}
	sort.Strings(paths)
	o := NewOrdered("")
	for i := 1; i < len(paths); i++ {
		path := paths[i]
		n := u.fs[path]
		if n.DirNode != nil {
			o.putDir(path, n)
		} else {
			o.putFile(path, n)
		}
	}
	return o
}
// Ordered converts an unordered hashtree into an ordered hashtree.