From b24de2cb27b4008c031e886138a6f348ecaffd16 Mon Sep 17 00:00:00 2001 From: Will Scott Date: Mon, 9 Aug 2021 22:55:11 -0700 Subject: [PATCH] Add a WithReifier method to allow easier derivation of different pathing semantics --- impl/blockservice/fetcher.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/impl/blockservice/fetcher.go b/impl/blockservice/fetcher.go index b0ee9f4..237f3f9 100644 --- a/impl/blockservice/fetcher.go +++ b/impl/blockservice/fetcher.go @@ -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{}