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
+7 -6
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)))
+1 -1
View File
@@ -238,4 +238,4 @@ func (fsr *fsLockedRepo) DeleteDatastore(ns string) error {
}
return nil
}
}
+8 -7
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
+1 -1
View File
@@ -19,7 +19,7 @@ type dsProvider interface {
}
type MultiStore struct {
provider dsProvider
provider dsProvider
namespace string
open map[int64]*Store
+3 -3
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
}