changes as per review
This commit is contained in:
parent
43453bb633
commit
05ba3de5cc
12
extern/sector-storage/piece_provider.go
vendored
12
extern/sector-storage/piece_provider.go
vendored
@ -53,14 +53,14 @@ func (p *pieceProvider) IsUnsealed(ctx context.Context, sector storage.SectorRef
|
|||||||
return false, xerrors.Errorf("size is not a valid piece size: %w", err)
|
return false, xerrors.Errorf("size is not a valid piece size: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
ctxLock, cancel := context.WithCancel(ctx)
|
||||||
if err := p.index.StorageLock(ctx, sector.ID, storiface.FTUnsealed, storiface.FTNone); err != nil {
|
|
||||||
cancel()
|
|
||||||
return false, xerrors.Errorf("acquiring read sector lock: %w", err)
|
|
||||||
}
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
return p.storage.CheckIsUnsealed(ctx, sector, abi.PaddedPieceSize(offset.Padded()), size.Padded())
|
if err := p.index.StorageLock(ctxLock, sector.ID, storiface.FTUnsealed, storiface.FTNone); err != nil {
|
||||||
|
return false, xerrors.Errorf("acquiring read sector lock: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return p.storage.CheckIsUnsealed(ctxLock, sector, abi.PaddedPieceSize(offset.Padded()), size.Padded())
|
||||||
}
|
}
|
||||||
|
|
||||||
// tryReadUnsealedPiece will try to read the unsealed piece from an existing unsealed sector file for the given sector from any worker that has it.
|
// tryReadUnsealedPiece will try to read the unsealed piece from an existing unsealed sector file for the given sector from any worker that has it.
|
||||||
|
Loading…
Reference in New Issue
Block a user