mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-06 09:42:19 +00:00
84a2cb08d7
Former-commit-id: 4cbacc539c2ef7c273c926d989449def39bf7b9a [formerly 7930332c151ad370317590556169411f875c84f9] Former-commit-id: 7533fcba8e6c6739ccb8ade408654e2b18e50c83
30 lines
447 B
Go
30 lines
447 B
Go
package sharding
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
)
|
|
|
|
type shardBackend struct {
|
|
kv map[common.Hash][]byte
|
|
}
|
|
|
|
func (sb *shardBackend) 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 *shardBackend) Put(k common.Hash, v []byte) {
|
|
sb.kv[k] = v
|
|
return
|
|
}
|
|
|
|
func (sb *shardBackend) Delete(k common.Hash) {
|
|
delete(sb.kv, k)
|
|
return
|
|
}
|