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 { type Import struct {
Key int64 Key int64
Err string Err string
Root *cid.Cid Root *cid.Cid
Source string Source string
FilePath string FilePath string
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -158,8 +158,8 @@ func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, deadline
} }
if sbfCount == 0 { if sbfCount == 0 {
log.Warnw("No recoveries to declare", "deadline", deadline, "faulty", uc) log.Warnw("No recoveries to declare", "deadline", deadline, "faulty", uc)
return nil return nil
} }
params := &miner.DeclareFaultsRecoveredParams{ params := &miner.DeclareFaultsRecoveredParams{