This commit is contained in:
Łukasz Magiera 2020-07-07 11:38:22 +02:00
parent 24ed43d541
commit 7175b1dd65
7 changed files with 26 additions and 24 deletions

View File

@ -355,10 +355,10 @@ type MinerSectors struct {
}
type Import struct {
Key int64
Key int64
Err string
Root *cid.Cid
Root *cid.Cid
Source string
FilePath string
}

View File

@ -49,6 +49,7 @@ import (
)
var DefaultHashFunction = uint64(mh.BLAKE2B_MIN + 31)
const dealStartBuffer abi.ChainEpoch = 10000 // TODO: allow setting
type API struct {
@ -306,13 +307,13 @@ func (a *API) ClientImportLocal(ctx context.Context, f io.Reader) (cid.Cid, erro
prefix.MhType = DefaultHashFunction
params := ihelper.DagBuilderParams{
Maxlinks: build.UnixfsLinksPerLevel,
RawLeaves: true,
Maxlinks: build.UnixfsLinksPerLevel,
RawLeaves: true,
CidBuilder: cidutil.InlineBuilder{
Builder: prefix,
Limit: 126,
},
Dagserv: bufferedDS,
Dagserv: bufferedDS,
}
db, err := params.New(chunker.NewSizeSplitter(file, int64(build.UnixfsChunkSize)))
@ -594,13 +595,13 @@ func (a *API) clientImport(ctx context.Context, ref api.FileRef, store *importmg
prefix.MhType = DefaultHashFunction
params := ihelper.DagBuilderParams{
Maxlinks: build.UnixfsLinksPerLevel,
RawLeaves: true,
Maxlinks: build.UnixfsLinksPerLevel,
RawLeaves: true,
CidBuilder: cidutil.InlineBuilder{
Builder: prefix,
Limit: 126,
},
Dagserv: bufDs,
Dagserv: bufDs,
}
db, err := params.New(chunker.NewSizeSplitter(file, int64(build.UnixfsChunkSize)))

View File

@ -238,4 +238,4 @@ func (fsr *fsLockedRepo) DeleteDatastore(ns string) error {
}
return nil
}
}

View File

@ -12,24 +12,25 @@ import (
)
type Mgr struct {
mds *MultiStore
ds datastore.Batching
mds *MultiStore
ds datastore.Batching
Blockstore blockstore.Blockstore
}
type Label string
const (
LSource = "source" // Function which created the import
LRootCid = "root" // Root CID
LSource = "source" // Function which created the import
LRootCid = "root" // Root CID
LFileName = "filename" // Local file path
LMTime = "mtime" // File modification timestamp
LMTime = "mtime" // File modification timestamp
)
func New(mds *MultiStore, ds datastore.Batching) *Mgr {
return &Mgr{
mds: mds,
Blockstore: &multiReadBs{
Blockstore: &multiReadBs{
mds: mds,
},
@ -99,4 +100,4 @@ func (m *Mgr) Info(id int64) (*StoreMeta, error) {
}
// m.Info
// m.Delete
// m.Delete

View File

@ -19,7 +19,7 @@ type dsProvider interface {
}
type MultiStore struct {
provider dsProvider
provider dsProvider
namespace string
open map[int64]*Store

View File

@ -37,15 +37,15 @@ func openStore(ds datastore.Batching) (*Store, error) {
dag := merkledag.NewDAGService(bsvc)
return &Store{
ds: ds,
ds: ds,
fm: fm,
Fstore: fstore,
Bstore: ibs,
bsvc: bsvc,
DAG: dag,
bsvc: bsvc,
DAG: dag,
}, nil
}

View File

@ -150,16 +150,16 @@ func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, deadline
if err != nil {
return xerrors.Errorf("checking unrecovered sectors: %w", err)
}
// if all sectors failed to recover, don't declare recoveries
sbfCount, err := sbf.Count()
if err != nil {
return xerrors.Errorf("counting recovered sectors: %w", err)
}
if sbfCount == 0 {
log.Warnw("No recoveries to declare", "deadline", deadline, "faulty", uc)
return nil
log.Warnw("No recoveries to declare", "deadline", deadline, "faulty", uc)
return nil
}
params := &miner.DeclareFaultsRecoveredParams{