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)
| 278 | // Return error if the read IO fails. |
| 279 | // Return false if the data is not managed by the ShardManager. |
| 280 | func (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. |