This is drifting off the topic of the original post, but
http://code.google.com/p/leveldb-go/source/browse/leveldb/memdb/memdb.go
offers a skiplist-backed equivalent of a sorted-by-key
map[[]byte][]byte. Use it as-is (but be aware that you'll have to
manually compact after deletions), or use the code as inspiration for
your own skiplist implementation.
var keys := make([]string, 0, len(m))for k := range(m) {keys := append(keys, k)}
villa.SortF(len(keys),
func(i, j int)bool { return m[keys[i] < m[keys[j]] },
func(i, j) { keys[i], keys[j] = keys[j], keys[i] })
keys := make([]string, 0, len(m))
for k := range m {
keys = append(keys, k)
}
sort.Strings(keys)