Skip to content

Commit

Permalink
Add a WithReifier method to allow easier derivation of different path…
Browse files Browse the repository at this point in the history
…ing semantics

This commit was moved from ipfs/go-fetcher@b24de2c
  • Loading branch information
willscott committed Aug 10, 2021
1 parent a338663 commit dff188c
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 dff188c

Please sign in to comment.