erigon-pulse/erigon-lib/state/domain_shared.go

26 lines
482 B
Go
Raw Permalink Normal View History

2023-06-02 02:51:03 +00:00
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]
}