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

Method TryReadChunkEncoded

ethstorage/shard_manager.go:308–318  ·  view source on GitHub ↗

TryReadChunkEncoded Read the encoded KV data using chunkIdx from storage file and return it. Return error if the read IO fails. Return false if the data is not managed by the ShardManager.

(chunkIdx uint64)

Source from the content-addressed store, hash-verified

306// Return error if the read IO fails.
307// Return false if the data is not managed by the ShardManager.
308func (sm *ShardManager) TryReadChunkEncoded(chunkIdx uint64) ([]byte, bool, error) {
309 kvIdx := chunkIdx / sm.chunksPerKv
310 cIdx := chunkIdx % sm.chunksPerKv
311 shardIdx := kvIdx / sm.kvEntries
312 if ds, ok := sm.shardMap[shardIdx]; ok {
313 b, err := ds.ReadChunkEncoded(kvIdx, cIdx) // read all the data
314 return b, true, err
315 } else {
316 return nil, false, nil
317 }
318}
319
320func (sm *ShardManager) IsComplete() error {
321 for _, ds := range sm.shardMap {

Callers

nothing calls this directly

Calls 1

ReadChunkEncodedMethod · 0.80

Tested by

no test coverage detected