Make client import actually work

This commit is contained in:
Łukasz Magiera
2019-07-15 16:17:34 +02:00
parent 55b9f8d550
commit cec4918cd9
4 changed files with 8 additions and 2 deletions
+1
View File
@@ -59,6 +59,7 @@ func reqContext(cctx *cli.Context) context.Context {
}
var Commands = []*cli.Command{
clientCmd,
chainCmd,
netCmd,
versionCmd,
+2 -2
View File
@@ -40,8 +40,8 @@ func (s *LocalStorage) ClientImport(ctx context.Context, path string) (cid.Cid,
Maxlinks: ihelper.DefaultLinksPerBlock,
RawLeaves: true,
CidBuilder: nil,
Dagserv: bufferedDS, // flush?
NoCopy: false,
Dagserv: bufferedDS,
NoCopy: true,
}
db, err := params.New(chunker.DefaultSplitter(file))
+2
View File
@@ -87,6 +87,8 @@ func ClientDAG(lc fx.Lifecycle, r repo.LockedRepo) (ipld.DAGService, error) {
blocks := namespace.Wrap(clientds, datastore.NewKey("blocks"))
fm := filestore.NewFileManager(clientds, filepath.Dir(r.Path()))
fm.AllowFiles = true
// TODO: fm.AllowUrls (needs more code in client import)
bs := blockstore.NewBlockstore(blocks)
fstore := filestore.NewFilestore(bs, fm)
+3
View File
@@ -151,6 +151,9 @@ func (fsr *fsLockedRepo) stillValid() error {
func (fsr *fsLockedRepo) Datastore(ns string) (datastore.Batching, error) {
fsr.dsOnce.Do(func() {
fsr.ds, fsr.dsErr = badger.NewDatastore(fsr.join(fsDatastore), nil)
/*if fsr.dsErr == nil {
fsr.ds = datastore.NewLogDatastore(fsr.ds, "fsrepo")
}*/
})
if fsr.dsErr != nil {
return nil, fsr.dsErr