mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +00:00
231e468e19
git-subtree-dir: erigon-lib git-subtree-mainline:3c8cbda809
git-subtree-split:93d9c9d9fe
26 lines
482 B
Go
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]
|
|
}
|