This function is only called by DownloadFinished which already uses s.mu to protect the s.blobMetas, so we don't need to lock in this function
(kvIndices []uint64, commits []common.Hash)
| 510 | // This function is only called by DownloadFinished which already uses s.mu to protect the s.blobMetas, so |
| 511 | // we don't need to lock in this function |
| 512 | func (s *StorageManager) updateLocalMetas(kvIndices []uint64, commits []common.Hash) { |
| 513 | for i, idx := range kvIndices { |
| 514 | meta := [32]byte{} |
| 515 | new(big.Int).SetInt64(int64(idx)).FillBytes(meta[0:5]) |
| 516 | copy(meta[32-HashSizeInContract:32], commits[i][0:HashSizeInContract]) |
| 517 | |
| 518 | s.blobMetas[idx] = meta |
| 519 | } |
| 520 | |
| 521 | // In case the kvEntryCount is smaller than old kvEntryCount because of removal, we need to remove those metas |
| 522 | LocalMetaLen := len(s.blobMetas) |
| 523 | for i := int(s.kvEntryCount); i < LocalMetaLen; i++ { |
| 524 | delete(s.blobMetas, uint64(i)) |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | // Please note that the caller function must uses s.mu to protect the s.blobMetas reading in this function |
| 529 | func (s *StorageManager) getKvMetas(kvIndices []uint64) ([][32]byte, error) { |