MCPcopy Create free account
hub / github.com/ethstorage/es-node / TryReadWithMeta

Method TryReadWithMeta

ethstorage/shard_manager.go:202–210  ·  view source on GitHub ↗

TryReadWithMeta Read the encoded KV data and meta from storage file and decode it. Return error if the read IO fails. Return false if the data is not managed by the ShardManager.

(kvIdx uint64, readLen int)

Source from the content-addressed store, hash-verified

200// Return error if the read IO fails.
201// Return false if the data is not managed by the ShardManager.
202func (sm *ShardManager) TryReadWithMeta(kvIdx uint64, readLen int) ([]byte, []byte, bool, error) {
203 shardIdx := kvIdx / sm.kvEntries
204 if ds, ok := sm.shardMap[shardIdx]; ok {
205 b, commit, err := ds.ReadWithMeta(kvIdx, readLen)
206 return b, commit, true, err
207 } else {
208 return nil, nil, false, nil
209 }
210}
211
212func (sm *ShardManager) GetShardMiner(shardIdx uint64) (common.Address, bool) {
213 if ds, ok := sm.shardMap[shardIdx]; ok {

Callers

nothing calls this directly

Calls 1

ReadWithMetaMethod · 0.80

Tested by

no test coverage detected