Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions chain/export/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ func (ce *ChainExporter) Export(ctx context.Context) error {
}

// we haven't visited this cid and its part of a dag, write it to file
if err := ce.writeContent(c); err != nil {
if err := ce.writeContent(ctx, c); err != nil {
return err
}

if kind == BlockHeader {
blk, err := ce.store.Get(c)
blk, err := ce.store.Get(ctx, c)
if err != nil {
return err
}
Expand All @@ -121,25 +121,25 @@ func (ce *ChainExporter) Export(ctx context.Context) error {
// of range.
if b.Height == 0 || b.Height > abi.ChainEpoch(ce.Config.MinHeight) {
if ce.Config.IncludeMessages {
if err := ce.pushNewLinks(b.Messages, todo); err != nil {
if err := ce.pushNewLinks(ctx, b.Messages, todo); err != nil {
return err
}
}

if ce.Config.IncludeReceipts {
if err := ce.pushNewLinks(b.ParentMessageReceipts, todo); err != nil {
if err := ce.pushNewLinks(ctx, b.ParentMessageReceipts, todo); err != nil {
return err
}
}

if ce.Config.IncludeStateRoots {
if err := ce.pushNewLinks(b.ParentStateRoot, todo); err != nil {
if err := ce.pushNewLinks(ctx, b.ParentStateRoot, todo); err != nil {
return err
}
}
}
} else if kind == Dag {
if err := ce.pushNewLinks(c, todo); err != nil {
if err := ce.pushNewLinks(ctx, c, todo); err != nil {
return err
}
} else {
Expand All @@ -149,9 +149,9 @@ func (ce *ChainExporter) Export(ctx context.Context) error {
return nil
}

func (ce *ChainExporter) pushNewLinks(c cid.Cid, s *Stack) error {
func (ce *ChainExporter) pushNewLinks(ctx context.Context, c cid.Cid, s *Stack) error {
s.Push(c, Dag)
data, err := ce.store.Get(c)
data, err := ce.store.Get(ctx, c)
if err != nil {
return err
}
Expand All @@ -160,8 +160,8 @@ func (ce *ChainExporter) pushNewLinks(c cid.Cid, s *Stack) error {
})
}

func (ce *ChainExporter) writeContent(c cid.Cid) error {
blk, err := ce.store.Get(c)
func (ce *ChainExporter) writeContent(ctx context.Context, c cid.Cid) error {
blk, err := ce.store.Get(ctx, c)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion commands/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func openChainAndBlockStores(ctx context.Context, path string) (*store.ChainStor
}

cs := store.NewChainStore(chainAndStateBs, chainAndStateBs, mds, nil, nil)
if err := cs.Load(); err != nil {
if err := cs.Load(ctx); err != nil {
return nil, nil, nil, xerrors.Errorf("loading repo (%s) chain store: %w", repoDir, err)
}

Expand Down
12 changes: 6 additions & 6 deletions commands/util/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ func ImportFromFsFile(ctx context.Context, r repo.Repo, fs fs.File, snapshot boo
cst := store.NewChainStore(bs, bs, mds, filcns.Weight, j)
defer cst.Close() //nolint:errcheck

ts, err := cst.Import(fs)
ts, err := cst.Import(ctx, fs)

if err != nil {
return xerrors.Errorf("importing chain failed: %w", err)
}

if err := cst.FlushValidationCache(); err != nil {
if err := cst.FlushValidationCache(ctx); err != nil {
return xerrors.Errorf("flushing validation cache failed: %w", err)
}

Expand All @@ -63,7 +63,7 @@ func ImportFromFsFile(ctx context.Context, r repo.Repo, fs fs.File, snapshot boo
return err
}

err = cst.SetGenesis(gb.Blocks()[0])
err = cst.SetGenesis(ctx, gb.Blocks()[0])
if err != nil {
return err
}
Expand Down Expand Up @@ -161,14 +161,14 @@ func ImportChain(ctx context.Context, r repo.Repo, fname string, snapshot bool)
bar.Units = pb.U_BYTES

bar.Start()
ts, err := cst.Import(br)
ts, err := cst.Import(ctx, br)
bar.Finish()

if err != nil {
return xerrors.Errorf("importing chain failed: %w", err)
}

if err := cst.FlushValidationCache(); err != nil {
if err := cst.FlushValidationCache(ctx); err != nil {
return xerrors.Errorf("flushing validation cache failed: %w", err)
}

Expand All @@ -177,7 +177,7 @@ func ImportChain(ctx context.Context, r repo.Repo, fname string, snapshot bool)
return err
}

err = cst.SetGenesis(gb.Blocks()[0])
err = cst.SetGenesis(ctx, gb.Blocks()[0])
if err != nil {
return err
}
Expand Down
Loading