2020-03-26 02:50:56 +00:00
|
|
|
package ffiwrapper
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
|
|
|
logging "github.com/ipfs/go-log/v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
var log = logging.Logger("ffiwrapper")
|
|
|
|
|
2020-03-26 19:34:38 +00:00
|
|
|
type Sealer struct {
|
2020-03-26 02:50:56 +00:00
|
|
|
sealProofType abi.RegisteredProof
|
|
|
|
postProofType abi.RegisteredProof
|
|
|
|
ssize abi.SectorSize // a function of sealProofType and postProofType
|
|
|
|
|
|
|
|
sectors SectorProvider
|
|
|
|
stopping chan struct{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func fallbackPostChallengeCount(sectors uint64, faults uint64) uint64 {
|
|
|
|
challengeCount := ElectionPostChallengeCount(sectors, faults)
|
|
|
|
if challengeCount > MaxFallbackPostChallengeCount {
|
|
|
|
return MaxFallbackPostChallengeCount
|
|
|
|
}
|
|
|
|
return challengeCount
|
|
|
|
}
|
|
|
|
|
2020-03-26 19:34:38 +00:00
|
|
|
func (sb *Sealer) Stop() {
|
2020-03-26 02:50:56 +00:00
|
|
|
close(sb.stopping)
|
|
|
|
}
|
|
|
|
|
2020-03-26 19:34:38 +00:00
|
|
|
func (sb *Sealer) SectorSize() abi.SectorSize {
|
2020-03-26 02:50:56 +00:00
|
|
|
return sb.ssize
|
|
|
|
}
|
|
|
|
|
2020-03-26 19:34:38 +00:00
|
|
|
func (sb *Sealer) SealProofType() abi.RegisteredProof {
|
2020-03-26 02:50:56 +00:00
|
|
|
return sb.sealProofType
|
|
|
|
}
|
|
|
|
|
2020-03-26 19:34:38 +00:00
|
|
|
func (sb *Sealer) PoStProofType() abi.RegisteredProof {
|
2020-03-26 02:50:56 +00:00
|
|
|
return sb.postProofType
|
|
|
|
}
|