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

Method TryReadMeta

ethstorage/shard_manager.go:280–288  ·  view source on GitHub ↗

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

(kvIdx uint64)

Source from the content-addressed store, hash-verified

278// Return error if the read IO fails.
279// Return false if the data is not managed by the ShardManager.
280func (sm *ShardManager) TryReadMeta(kvIdx uint64) ([]byte, bool, error) {
281 shardIdx := kvIdx / sm.kvEntries
282 if ds, ok := sm.shardMap[shardIdx]; ok {
283 b, err := ds.ReadMeta(kvIdx) // read all the data
284 return b, true, err
285 } else {
286 return nil, false, nil
287 }
288}
289
290// TryReadChunk Read the encoded KV data using chunkIdx from storage file and decode it.
291// Return error if the read IO fails.

Callers

nothing calls this directly

Calls 1

ReadMetaMethod · 0.45

Tested by

no test coverage detected