Address review

This commit is contained in:
Łukasz Magiera 2020-06-05 10:21:21 +02:00
parent 13176e8b53
commit c06dc750da
3 changed files with 5 additions and 3 deletions

View File

@ -19,7 +19,6 @@ func (m *Manager) CheckProvable(ctx context.Context, spt abi.RegisteredProof, se
var bad []abi.SectorID var bad []abi.SectorID
// TODO: More better checks // TODO: More better checks
// TODO: This should live in sector-storage
// TODO: Use proper locking // TODO: Use proper locking
for _, sector := range sectors { for _, sector := range sectors {
err := func() error { err := func() error {

View File

@ -73,7 +73,9 @@ func (t SectorFileType) SealSpaceUse(spt abi.RegisteredProof) (uint64, error) {
return need, nil return need, nil
} }
func (t SectorFileType) All() (out [FileTypes]bool) { func (t SectorFileType) All() [FileTypes]bool {
var out [FileTypes]bool
for i := range out { for i := range out {
out[i] = t&(1<<i) > 0 out[i] = t&(1<<i) > 0
} }

View File

@ -26,7 +26,8 @@ func (l *sectorLock) canLock(read SectorFileType, write SectorFileType) bool {
} }
} }
return l.w&(read|write) == 0 // check that there are no locks taken for either read or write file types we want
return l.w&read == 0 && l.w&write == 0
} }
func (l *sectorLock) tryLock(read SectorFileType, write SectorFileType) bool { func (l *sectorLock) tryLock(read SectorFileType, write SectorFileType) bool {