package state // KvList sort.Interface to sort write list by keys type KvList struct { Keys []string Vals [][]byte } func (l *KvList) Push(key string, val []byte) { l.Keys = append(l.Keys, key) l.Vals = append(l.Vals, val) } func (l *KvList) Len() int { return len(l.Keys) } func (l *KvList) Less(i, j int) bool { return l.Keys[i] < l.Keys[j] } func (l *KvList) Swap(i, j int) { l.Keys[i], l.Keys[j] = l.Keys[j], l.Keys[i] l.Vals[i], l.Vals[j] = l.Vals[j], l.Vals[i] }