Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Add a WithReifier method to allow easier derivation of non-unixfs pathing #23

Merged
merged 1 commit into from
Aug 11, 2021
Merged
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
10 changes: 10 additions & 0 deletions 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