Skip to content

Commit

Permalink
feat: only require the NodeGetter interface instead of the DAG interface
Browse files Browse the repository at this point in the history
This makes it possible to pass in a dagservice "session" for better performance
when fetching from bitswap.
  • Loading branch information
Stebalien committed Mar 27, 2020
1 parent 3e2cf7a commit 8a30145
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions car.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ type CarHeader struct {
}

type carWriter struct {
ds format.DAGService
ds format.NodeGetter
w io.Writer
walk WalkFunc
}

type WalkFunc func(format.Node) ([]*format.Link, error)

func WriteCar(ctx context.Context, ds format.DAGService, roots []cid.Cid, w io.Writer) error {
func WriteCar(ctx context.Context, ds format.NodeGetter, roots []cid.Cid, w io.Writer) error {
return WriteCarWithWalker(ctx, ds, roots, w, DefaultWalkFunc)
}

func WriteCarWithWalker(ctx context.Context, ds format.DAGService, roots []cid.Cid, w io.Writer, walk WalkFunc) error {
func WriteCarWithWalker(ctx context.Context, ds format.NodeGetter, roots []cid.Cid, w io.Writer, walk WalkFunc) error {

h := &CarHeader{
Roots: roots,
Expand Down

0 comments on commit 8a30145

Please sign in to comment.