erigon-pulse/erigon-lib/state/domain_shared.go
battlmonstr 231e468e19 Add 'erigon-lib/' from commit '93d9c9d9fe4bd8a49f7a98a6bce0f0da7094c7d3'
git-subtree-dir: erigon-lib
git-subtree-mainline: 3c8cbda809
git-subtree-split: 93d9c9d9fe
2023-09-20 14:50:25 +02:00

26 lines
482 B
Go

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]
}