Apply suggestions from code review

Co-authored-by: dirkmc <dirkmdev@gmail.com>
This commit is contained in:
Aarsh Shah 2021-05-19 11:17:56 +05:30 committed by Dirk McCormick
parent 73613ee883
commit d33d426692
4 changed files with 4 additions and 4 deletions

View File

@ -244,7 +244,7 @@ func (m *Manager) SectorsUnsealPiece(ctx context.Context, sector storage.SectorR
// save us some work in case another piece is requested from here
log.Debugf("unseal sector %d", sector.ID)
// Note: This unsealed call will essentially become a no-op of the worker already has an Unsealed sector file for the given sector.
// Note: This unseal piece call will essentially become a no-op if the worker already has an Unsealed sector file for the given sector.
_, err := m.waitSimpleCall(ctx)(w.UnsealPiece(ctx, sector, 0, abi.PaddedPieceSize(ssize).Unpadded(), ticket, *unsealed))
log.Debugf("completed unseal sector %d", sector.ID)
return err

View File

@ -43,7 +43,7 @@ func NewPieceProvider(storage *stores.Remote, index stores.SectorIndex, uns Unse
// tryReadUnsealedPiece will try to read the unsealed piece from an existing unsealed sector file for the given sector from any worker that has it.
// It will NOT try to schedule an Unseal of a sealed sector file for the read.
//
// Will return a nil reader if the piece does NOT exist in any unsealed file/there is not unsealed file for the given sector on any of the workers.
// Returns a nil reader if the piece does NOT exist in any unsealed file or there is no unsealed file for the given sector on any of the workers.
func (p *pieceProvider) tryReadUnsealedPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (io.ReadCloser, context.CancelFunc, error) {
// acquire a lock purely for reading unsealed sectors
ctx, cancel := context.WithCancel(ctx)

View File

@ -249,7 +249,7 @@ func (handler *FetchHandler) remoteGetAllocated(w http.ResponseWriter, r *http.R
}
defer func() {
if err := pf.Close(); err != nil {
log.Error("close partial file: ", err)
log.Error("closing partial file: ", err)
}
}()

View File

@ -532,7 +532,7 @@ func (r *Remote) Reader(ctx context.Context, s storage.SectorRef, offset, size a
continue
}
// readRemote fetches a reader that we can used to read the unsealed piece from the remote worker.
// readRemote fetches a reader that we can use to read the unsealed piece from the remote worker.
// It uses a ranged HTTP query to ensure we ONLY read the unsealed piece and not the entire unsealed file.
rd, err = r.readRemote(ctx, url, offset, size)
if err != nil {