-
Notifications
You must be signed in to change notification settings - Fork 15
More flexible interfaces #80
base: master
Are you sure you want to change the base?
Conversation
fe0c7e2 to
73445bc
Compare
be23337 to
442fe78
Compare
|
(Currently based on #81 to have it work in lotus) |
laser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big changes here - and I'm glad to see that the operational stuff (e.g. worker-related code) is gone.
Two main observations:
- I'm not sure why the
SectorProviderinterface exists when we could simply implementstorage.Storage. That cutover would require that the caller give up control of the picking of the sector number (becausestorage.Storage#NewSectorpicks it for them), but that doesn't seem like a big deal to me. - The
AcquireSectormethod returns a function which I believe is used to coordinate concurrent access to sector files - but the one implementation ofSectorProvider#AcquireSector(Basic) in this PR returns a no-op function, which leads me to believe thatSectorBuilder#ReadPieceFromSealedSectoris racey.
sectorbuild_cgo.go
Outdated
|
|
||
| // TODO: this needs to get smarter when we start supporting partial unseals | ||
| unsealedPath, err := sfs.AllocSector(fs.DataUnsealed, sb.Miner, sb.ssize, true, sectorNum) | ||
| path, doneUnsealed, err := sb.sectors.AcquireSector(ctx, sectorNum, FTUnsealed, FTUnsealed, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you want to pass sectorNum to AcquireSector here (for the temporary file used to hold unsealed bytes).
Imagine a scenario in which SectorBuilder#ReadPieceFromSealedSector is called concurrently for the same sectorNum. The two calls will race: Both will call ffi.Unseal and will provide the same destination file path, and likely clobber each other's file writes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: The above comment assumes that sb.sectors is of type Basic.
Fix AddPiece with existing pieces
This PR aims to move a bunch of filesystem/worker handling logic up to implementations, making the codebase here much, much smaller and cleaner, and giving impls better flexibility
Also exposes the new 4-stage sector sealing process