mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-06 19:12:19 +00:00
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]
|
||
|
}
|