Skip to content

Commit

Permalink
Expose the BlockService with a new getter.
Browse files Browse the repository at this point in the history
It turns out that building path Resolvers on top of something like IPFS-lite
requires access to the blockService so that an IPLD fetcher can be built out
of it.
  • Loading branch information
hsanjuan committed Jul 6, 2022
1 parent 9a84caf commit b7626da
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ipfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/ipfs/go-datastore"
blockstore "github.com/ipfs/go-ipfs-blockstore"
chunker "github.com/ipfs/go-ipfs-chunker"
"github.com/ipfs/go-ipfs-exchange-interface"
exchange "github.com/ipfs/go-ipfs-exchange-interface"
offline "github.com/ipfs/go-ipfs-exchange-offline"
provider "github.com/ipfs/go-ipfs-provider"
"github.com/ipfs/go-ipfs-provider/queue"
Expand Down Expand Up @@ -333,7 +333,12 @@ func (p *Peer) HasBlock(ctx context.Context, c cid.Cid) (bool, error) {
return p.BlockStore().Has(ctx, c)
}

// Exchange returns the underlying exchange implementation
// Exchange returns the underlying exchange implementation.
func (p *Peer) Exchange() exchange.Interface {
return p.exch
}

// BlockService returns the underlying blockservice implementation.
func (p *Peer) BlockService() blockservice.BlockService {
return p.bserv
}

0 comments on commit b7626da

Please sign in to comment.