mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-06 09:42:19 +00:00
1793e7d21d
Former-commit-id: 5021890d223501bf163d6beae4e4e732673950d2 [formerly 92e89aed0c61909971cf9262cd3002bf2ae2328a] Former-commit-id: 0fd4497f880213878965107de3f782b44c33f065
30 lines
427 B
Go
30 lines
427 B
Go
package sharding
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
)
|
|
|
|
type shardKV struct {
|
|
kv map[common.Hash][]byte
|
|
}
|
|
|
|
func (sb *shardKV) Get(k common.Hash) ([]byte, error) {
|
|
v := sb.kv[k]
|
|
if v == nil {
|
|
return nil, fmt.Errorf("Key Not Found")
|
|
}
|
|
return v, nil
|
|
}
|
|
|
|
func (sb *shardKV) Put(k common.Hash, v []byte) {
|
|
sb.kv[k] = v
|
|
return
|
|
}
|
|
|
|
func (sb *shardKV) Delete(k common.Hash) {
|
|
delete(sb.kv, k)
|
|
return
|
|
}
|