Pre-sealing holes

License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera
2019-12-06 18:53:33 +01:00
parent 8780faf07a
commit 80592a87cf
4 changed files with 33 additions and 21 deletions
+16 -10
View File
@@ -119,12 +119,14 @@ type Config struct {
SectorSize uint64
Miner address.Address
WorkerThreads uint8
WorkerThreads uint8
OverrideLastID uint64
CacheDir string
SealedDir string
StagedDir string
UnsealedDir string
_ struct{} // guard against nameless init
}
func New(cfg *Config, ds dtypes.MetadataDS) (*SectorBuilder, error) {
@@ -142,17 +144,21 @@ func New(cfg *Config, ds dtypes.MetadataDS) (*SectorBuilder, error) {
}
var lastUsedID uint64
b, err := ds.Get(lastSectorIdKey)
switch err {
case nil:
i, err := strconv.ParseInt(string(b), 10, 64)
if err != nil {
if cfg.OverrideLastID != 0 {
lastUsedID = cfg.OverrideLastID
} else {
b, err := ds.Get(lastSectorIdKey)
switch err {
case nil:
i, err := strconv.ParseInt(string(b), 10, 64)
if err != nil {
return nil, err
}
lastUsedID = uint64(i)
case datastore.ErrNotFound:
default:
return nil, err
}
lastUsedID = uint64(i)
case datastore.ErrNotFound:
default:
return nil, err
}
rlimit := cfg.WorkerThreads - PoStReservedWorkers