Skip to content

Commit

Permalink
Merge pull request ipfs/go-fetcher#23 from ipfs/feat/withreifier
Browse files Browse the repository at this point in the history
Add a WithReifier method to allow easier derivation of non-unixfs pathing

This commit was moved from ipfs/go-fetcher@5ca55a2
  • Loading branch information
hannahhoward authored Aug 11, 2021
2 parents a338663 + dff188c commit f066909
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fetcher/impl/blockservice/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ func (fc FetcherConfig) NewSession(ctx context.Context) fetcher.Fetcher {
return &fetcherSession{linkSystem: ls, protoChooser: protoChooser}
}

// WithReifier derives a different fetcher factory from the same source but
// with a chosen NodeReifier for pathing semantics.
func (fc FetcherConfig) WithReifier(nr ipld.NodeReifier) fetcher.Factory {
return FetcherConfig{
blockService: fc.blockService,
NodeReifier: nr,
PrototypeChooser: fc.PrototypeChooser,
}
}

// interface check
var _ fetcher.Factory = FetcherConfig{}

Expand Down

0 comments on commit f066909

Please sign in to comment.